gold/
[external/binutils.git] / gold / ChangeLog
1 2012-05-08  Cary Coutant  <ccoutant@google.com>
2
3         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4         (lines_only_debug_sections): Likewise.
5
6 2012-05-02  Roland McGrath  <mcgrathr@google.com>
7
8         * nacl.cc: New file.
9         * nacl.h: New file.
10         * Makefile.am (CCFILES, HFILES): Add them.
11         * Makefile.in: Regenerate.
12         * i386.cc (Output_data_plt_i386_nacl): New class.
13         (Output_data_plt_i386_nacl_exec): New class.
14         (Output_data_plt_i386_nacl_dyn): New class.
15         (Target_i386_nacl): New class.
16         (Target_selector_i386_nacl): New class.
17         (target_selector_i386): Use it instead of Target_selector_i386.
18         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
19         (Target_x86_64_nacl): New class.
20         (Target_selector_x86_64_nacl): New class.
21         (target_selector_x86_64, target_selector_x32): Use it instead of
22         Target_selector_x86_64.
23         * arm.cc (Output_data_plt_arm_nacl): New class.
24         (Target_arm_nacl): New class.
25         (Target_selector_arm_nacl): New class.
26         (target_selector_arm, target_selector_armbe): Use it instead of
27         Target_selector_arm.
28
29         * target-select.cc (select_target): Take new Input_file* and off_t
30         arguments, pass them on to recognize method of selector.
31         * object.cc (make_elf_sized_object): Update caller.
32         * parameters.cc (parameters_force_valid_target): Likewise.
33         * incremental.cc (make_sized_incremental_binary): Likewise.
34         * target-select.h: Update decl.
35         (Target_selector::recognize): Take new Input_file* argument,
36         pass it on to do_recognize.
37         (Target_selector::do_recognize): Take new Input_file* argument.
38         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
39         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
40         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
41         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
42
43         * target.h (Target::Target_info): New members isolate_execinstr
44         and rosegment_gap.
45         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
46         * arm.cc (Target_arm::arm_info): Update initializer.
47         * i386.cc (Target_i386::i386_info): Likewise.
48         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
49         * sparc.cc (Target_sparc::sparc_info): Likewise.
50         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
51         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
52         * layout.cc (Layout::attach_allocated_section_to_segment):
53         Take new const Target* argument.  If target->isolate_execinstr(), act
54         like --rosegment.
55         (Layout::find_first_load_seg): Take new const Target* argument;
56         if target->isolate_execinstr(), reject PF_X segments.
57         (Layout::relaxation_loop_body): Update caller.
58         (Layout::set_segment_offsets): If target->isolate_execinstr(),
59         reset file offset to zero when we hit LOAD_SEG, and then do a second
60         loop over the segments before LOAD_SEG to reassign offsets after
61         addresses have been determined.  Handle target->rosegment_gap().
62         (Layout::attach_section_to_segment): Take new const Target* argument;
63         pass it to attach_allocated_section_to_segment.
64         (Layout::make_output_section): Update caller.
65         (Layout::attach_sections_to_segments): Take new const Target* argument;
66         pass it to attach_section_to_segment.
67         * gold.cc (queue_middle_tasks): Update caller.
68         * layout.h (Layout): Update method decls with new arguments.
69
70         * arm.cc (Target_arm::Target_arm): Take optional argument for the
71         Target_info pointer to use.
72         (Target_arm::do_make_data_plt): New virtual method.
73         (Target_arm::make_data_plt): New method that calls it.
74         (Target_arm::make_plt_entry): Use it.
75         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
76         for the section alignment.
77         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
78         method.
79         (Output_data_plt_arm::first_plt_entry_offset): Call it.
80         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
81         method.
82         (Output_data_plt_arm::get_plt_entry_size): Call it.
83         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
84         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
85         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
86         method.
87         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
88         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
89         method instead of sizeof(plt_entry).
90         (Output_data_plt_arm::add_entry): Likewise.
91         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
92         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
93         than static method.
94         (Target_arm::plt_entry_size): Likewise.
95         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
96         Move to ...
97         (Output_data_plt_arm_standard): ... here, new class.
98         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
99         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
100         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
101
102         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
103         Take additional argument for the PLT entry size.
104         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
105         Use get_plt_entry_size method rather than plt_entry_size variable.
106         (Output_data_plt_x86_64::reserve_slot): Likewise.
107         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
108         (Output_data_plt_x86_64::add_entry): Likewise.
109         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
110         (Output_data_plt_x86_64::address_for_global): Likewise.
111         (Output_data_plt_x86_64::address_for_local): Likewise.
112         (Output_data_plt_x86_64::set_final_data_size): Likewise.
113         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
114         Make method non-static.
115         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
116         method.
117         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
118         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
119         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
120         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
121         virtual method.
122         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
123         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
124         virtual method.
125         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
126         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
127         virtual method.
128         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
129         (Output_data_plt_x86_64::plt_entry_size)
130         (Output_data_plt_x86_64::first_plt_entry)
131         (Output_data_plt_x86_64::plt_entry)
132         (Output_data_plt_x86_64::tlsdesc_plt_entry)
133         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
134         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
135         (Output_data_plt_x86_64_standard): ... here, new class.
136         (Target_x86_64::Target_x86_64): Take optional argument for the
137         Target_info pointer to use.
138         (Target_x86_64::do_make_data_plt): New virtual method.
139         (Target_x86_64::make_data_plt): New method to call it.
140         (Target_x86_64::init_got_plt_for_update): Use that.
141         Call this->plt_->add_eh_frame method here.
142         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
143         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
144         rather than static method.
145         (Target_x86_64::plt_entry_size): Likewise.
146         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
147         rather than plt_entry_size variable.  Move guts of PLT filling to...
148         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
149         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
150         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
151
152         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
153         additional argument for the section alignment.
154         Don't do add_eh_frame_for_plt here.
155         (Output_data_plt_i386::first_plt_entry_offset): Make the method
156         non-static.  Use get_plt_entry_size method rather than plt_entry_size
157         variable.
158         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
159         method.
160         (Output_data_plt_i386::get_plt_entry_size): Call it.
161         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
162         (Output_data_plt_i386::add_eh_frame): New method to call it.
163         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
164         method.
165         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
166         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
167         method.
168         (Output_data_plt_i386::fill_plt_entry): New method to call it.
169         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
170         method instead of plt_entry_size.
171         (Output_data_plt_i386::plt_entry_size)
172         (Output_data_plt_i386::plt_eh_frame_fde_size)
173         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
174         (Output_data_plt_i386_standard): ... here, new class.
175         (Output_data_plt_i386_exec): New class.
176         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
177         (Output_data_plt_i386_exec::first_plt_entry): ... here.
178         (Output_data_plt_i386::exec_plt_entry): Move to ...
179         (Output_data_plt_i386_exec::plt_entry): ... here.
180         (Output_data_plt_i386_dyn): New class.
181         (Output_data_plt_i386::first_plt_entry): Move to ...
182         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
183         (Output_data_plt_i386::dyn_plt_entry): Move to ...
184         (Output_data_plt_i386_dyn::plt_entry): ... here.
185         (Target_i386::Target_i386): Take optional argument for the Target_info
186         pointer to use.
187         (Target_i386::do_make_data_plt): New virtual method.
188         (Target_i386::make_data_plt): New method to call it.
189         (Target_i386::make_plt_section): Use that.
190         Call this->plt_->add_eh_frame method here.
191         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
192         rather than plt_entry_size variable.
193         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
194         (Output_data_plt_i386::address_for_local): Likewise.
195         (Output_data_plt_i386::do_write): Likewise.
196         Move guts of PLT filling to...
197         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
198         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
199         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
200         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
201
202 2012-05-01  Cary Coutant  <ccoutant@google.com>
203
204         * dwarf_reader.cc (Dwarf_die::read_attributes)
205         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
206         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
207         * reduced_debug_output.cc
208         (Output_reduced_debug_info_section::get_die_end): Remove
209         DW_FORM_GNU_ref_index.  Add default case.
210
211 2012-04-26  Mark Wielaard  <mjw@redhat.com>
212
213         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
214         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
215         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
216         DW_AT_high_pc as offset from DW_AT_low_pc.
217
218         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
219         * testsuite/Makefile.in: Regenerate.
220         * testsuite/gdb_index_test_3.c: New test source file.
221         * testsuite/gdb_index_test_3.sh: New test source file.
222
223 2012-04-25  Ian Lance Taylor  <iant@google.com>
224
225         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
226         pointer.
227         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
228         as a class, not a struct.
229         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
230         (Target_arm::apply_cortex_a8_workaround): Likewise.
231         * gc.h: Declare Reloc_types as a struct, not a class.
232         * object.h: Declare Symbols_data as a struct.
233         * reloc.h: Declare Read_relocs_data as a struct.
234         * target.h: Declare Relocate_info as a struct.
235
236 2012-04-24  David S. Miller  <davem@davemloft.net>
237
238         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
239         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
240         and R_SPARC_WPLT30.
241
242 2012-04-24  Cary Coutant  <ccoutant@google.com>
243
244         * incremental-dump.cc (find_input_containing_global): Replace
245         magic number with symbolic constant.
246         (dump_incremental_inputs): Update version number.
247         * incremental.cc (Output_section_incremental_inputs): Update version
248         number; import symbolic constants from Incremental_inputs_reader.
249         (Incremental_inputs::create_data_sections): Align relocations
250         section correctly for 64-bit targets.
251         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
252         constants; add padding.
253         (Output_section_incremental_inputs::write_header): Add assert for
254         header_size.
255         (Output_section_incremental_inputs::write_input_files): Add assert
256         for input_entry_size.
257         (Output_section_incremental_inputs::write_info_blocks): Add padding;
258         add assert for object_info_size, input_section_entry_size,
259         global_sym_entry_size.
260         * incremental.h (Incremental_inputs_reader): Add symbolic constants
261         for data structure sizes; use them.
262         (Incremental_input_entry_reader): Import symbolic constants from
263         Incremental_inputs_reader; use them.
264
265 2012-04-23  David S. Miller  <davem@davemloft.net>
266
267         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
268         and elf_flags_set_.
269         (Target_sparc::Target_sparc): Initialize new fields.
270         (Target_sparc::do_make_elf_object): New function.
271         (Target_sparc::do_adjust_elf_header): New function.
272
273 2012-04-23  Cary Coutant  <ccoutant@google.com>
274
275         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
276         CU range table of gdb index.
277
278 2012-04-20  David S. Miller  <davem@davemloft.net>
279
280         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
281         instead of false.
282
283 2012-04-16  David S. Miller  <davem@davemloft.net>
284
285         * sparc.cc (Target_sparc::got_address): New function.
286         (Sparc_relocate_functions::gdop_hix22): New function.
287         (Sparc_relocate_functions::gdop_lox10): New function.
288         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
289         relocs.
290         (Target_sparc::Scan::local): Likewise if the global symbol is not
291         preemptible and is not IFUNC.
292         (Target_sparc::Relocate::relocate): Perform GOTDATA code
293         transformations for local and non-preemptible non-IFUNC global
294         symbols.
295
296         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
297         writing out 64-bit part of ranges.
298
299         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
300         -fpic and -fpie respectively.
301         * Makefile.in: Regenerate.
302
303         * sparc.cc (class Target_sparc): Add rela_ifunc_.
304         (Target_sparc::Target_sparc): Initialize new field.
305         (Target_sparc::do_plt_section_for_global): New function.
306         (Target_sparc::do_plt_section_for_local): New function.
307         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
308         (Target_sparc::make_plt_section): New function, broken out of
309         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
310         (Target_sparc::make_plt_entry): Call make_plt_section.
311         (Target_sparc::make_local_ifunc_plt_entry): New function.
312         (Target_sparc::rela_ifunc_section): New function.
313         (Target_sparc::plt_section): Remove const.
314         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
315         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
316         and ifunc_count_ fields.
317         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
318         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
319         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
320         (Output_data_plt_sparc::rela_ifunc): New function.
321         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
322         (Output_data_plt_sparc::has_ifunc_section): New function.
323         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
324         (Output_data_plt_sparc::address_for_global): New function.
325         (Output_data_plt_sparc::address_for_local): New function.
326         (Output_data_plt_sparc::plt_index_to_offset): New function.
327         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
328         and entry_count.
329         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
330         entry_count.
331         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
332         R_SPARC_JMP_IREL to switch.
333         (Target_sparc::Scan::check_non_pic): Likewise.
334         (Target_sparc::Scan::local): Handle IFUNC symbols.
335         (Target_sparc::Scan::local): Likewise.
336         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
337         and plt_address_for_local.
338         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
339         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
340
341         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
342         (class Output_data_reloc): Adjust calls to Output_reloc_type.
343         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
344         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
345         global relocs too.
346         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
347         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
348         calls.
349         * sparc.cc (Target_sparc::Scan::global): Likewise.
350         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
351
352 2012-04-16  Cary Coutant  <ccoutant@google.com>
353
354         * archive.cc (Library_base::should_include_member): Check for
355         --export-dynamic-symbol.
356         * options.h (class General_options): Add --export-dynamic-symbol.
357         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
358         --export-dynamic-symbol.
359         (Symbol_table::gc_mark_undef_symbols): Likewise.
360         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
361
362 2012-04-12  David S. Miller  <davem@davemloft.net>
363
364         * sparc.cc (Reloc::wdisp10): New relocation method.
365         (Reloc::h34): Likewise.
366         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
367         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
368         R_SPARC_WDISP10.
369         (Target_sparc::Scan::local): Likewise.
370         (Target_sparc::Scan::global): Likewise.
371         (Target_sparc::Relocate::relocate): Likewise.
372
373 2012-04-09  Cary Coutant  <ccoutant@google.com>
374
375         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
376         low_pc == 0.
377
378 2012-04-06  Ian Lance Taylor  <iant@google.com>
379
380         * timer.cc: #include <unistd.h>.
381
382 2012-04-06  Roland McGrath  <mcgrathr@google.com>
383
384         * configure.in (AC_CHECK_HEADERS): Add locale.h.
385         * config.in: Regenerate.
386         * configure: Regenerate.
387
388 2012-04-05  Nick Clifton  <nickc@redhat.com>
389
390         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
391         (AM_LC_MESSAGES): Add.
392         * aclocal.m4: Regenerate.
393         * config.in: Regenerate.
394         * configure: Regenerate.
395
396 2012-03-21  Cary Coutant  <ccoutant@google.com>
397
398         * Makefile.am: Add gdb-index.cc, gdb-index.h.
399         * Makefile.in: Regenerate.
400         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
401         (Sized_elf_reloc_mapper::symbol_section): New function.
402         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
403         (make_elf_reloc_mapper): New function.
404         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
405         (Dwarf_abbrev_table::do_read_abbrevs): New function.
406         (Dwarf_abbrev_table::do_get_abbrev): New function.
407         (Dwarf_ranges_table::read_ranges_table): New function.
408         (Dwarf_ranges_table::read_range_list): New function.
409         (Dwarf_pubnames_table::read_section): New function.
410         (Dwarf_pubnames_table::read_header): New function.
411         (Dwarf_pubnames_table::next_name): New function.
412         (Dwarf_die::Dwarf_die): New function.
413         (Dwarf_die::read_attributes): New function.
414         (Dwarf_die::skip_attributes): New function.
415         (Dwarf_die::set_name): New function.
416         (Dwarf_die::set_linkage_name): New function.
417         (Dwarf_die::attribute): New function.
418         (Dwarf_die::string_attribute): New function.
419         (Dwarf_die::int_attribute): New function.
420         (Dwarf_die::uint_attribute): New function.
421         (Dwarf_die::ref_attribute): New function.
422         (Dwarf_die::child_offset): New function.
423         (Dwarf_die::sibling_offset): New function.
424         (Dwarf_info_reader::check_buffer): New function.
425         (Dwarf_info_reader::parse): New function.
426         (Dwarf_info_reader::do_parse): New function.
427         (Dwarf_info_reader::do_read_string_table): New function.
428         (Dwarf_info_reader::lookup_reloc): New function.
429         (Dwarf_info_reader::get_string): New function.
430         (Dwarf_info_reader::visit_compilation_unit): New function.
431         (Dwarf_info_reader::visit_type_unit): New function.
432         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
433         Sized_elf_reloc_mapper.
434         (Sized_dwarf_line_info::symbol_section): Remove function.
435         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
436         (Sized_dwarf_line_info::read_line_mappings): Remove object
437         parameter, adjust callers.
438         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
439         * dwarf_reader.h: Include <sys/types.h>.
440         (class Track_relocs): Remove forward declaration.
441         (class Elf_reloc_mapper): New class.
442         (class Sized_elf_reloc_mapper): New class.
443         (class Dwarf_abbrev_table): New class.
444         (class Dwarf_range_list): New class.
445         (class Dwarf_ranges_table): New class.
446         (class Dwarf_pubnames_table): New class.
447         (class Dwarf_die): New class.
448         (class Dwarf_info_reader): New class.
449         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
450         (Sized_dwarf_line_info::symbol_section): Remove member function.
451         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
452         base class.
453         * gdb-index.cc: New source file.
454         * gdb-index.h: New source file.
455         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
456         and .debug_types sections, call Layout::add_to_gdb_index.
457         (Sized_relobj_incr::do_section_name): Implement.
458         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
459         return type; Implement.
460         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
461         return type.
462         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
463         parameter list and return type.
464         (Sized_incr_dynobj::do_section_contents): Likewise.
465         * layout.cc: Include gdb-index.h.
466         (Layout::Layout): Initialize gdb_index_data_.
467         (Layout::init_fixed_output_section): Check for .gdb_index section.
468         (Layout::add_to_gdb_index): New function. Instantiate.
469         * layout.h: Add forward declaration for class Gdb_index.
470         (Layout::add_to_gdb_index): New member function.
471         (Layout::gdb_index_data_): New data member.
472         * main.cc: Include gdb-index.h.
473         (main): Print statistics for gdb index.
474         * object.cc (Object::section_contents): Move code into
475         do_section_contents.
476         (need_decompressed_section): Check for sections needed when building
477         gdb index.
478         (build_compressed_section_map): Likewise.
479         (Sized_relobj_file::do_read_symbols): Need local symbols when building
480         gdb index.
481         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
482         sections; call Layout::add_to_gdb_index.
483         (Sized_relobj_file::do_decompressed_section_contents): Call
484         do_section_contents directly.
485         * object.h (Object::do_section_contents): Adjust parameter list and
486         return type.
487         (Object::do_decompressed_section_contents): Call do_section_contents
488         directly.
489         (Sized_relobj_file::do_section_contents): Adjust parameter list and
490         return type.
491         * options.h (class General_options): Add --gdb-index option.
492         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
493         list and return type.
494         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
495         * reloc.h (Track_relocs::checkpoint): New function.
496         (Track_relocs::reset): New function.
497
498         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
499         New test cases.
500         * testsuite/Makefile.in: Regenerate.
501         * testsuite/gdb_index_test.cc: New test source file.
502         * testsuite/gdb_index_test_1.sh: New test source file.
503         * testsuite/gdb_index_test_2.sh: New test source file.
504
505 2012-03-19  Doug Kwan  <dougkwan@google.com>
506
507         * arm.cc (Target_arm::do_define_standard_symbols): New method.
508         (Target_arm::do_finalize_sections): Remove code which defines
509         __exidx_start and __exidx_end.  Make symbol table parameter
510         anonymous as it is not used.
511         * gold.cc (queue_middle_tasks): Call target hook to define any
512         target-specific symbols.
513         * target.h (Target::define_standard_symbols): New method.
514         (Target::do_define_standard_symbols): Same.
515         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
516         * testsuite/Makefile.in: Regenerate.
517         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
518         and __exidx_end.
519         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
520         relocations are generated for __exidx_start and __exidx_end.
521
522 2012-03-16  Doug Kwan  <dougkwan@google.com>
523
524         * testsuite/Makefile.am: Disable test initpri3b.
525         * testsuite/Makefile.in: Regenerate.
526
527 2012-03-15  Doug Kwan  <dougkwan@google.com>
528
529         * arm.cc (Target_arm::got_section): Make .got section read-only
530         if -z now is given.
531
532 2012-03-15  Ian Lance Taylor  <iant@google.com>
533
534         PR gold/13850
535         * layout.cc (Layout::make_output_section): Correctly mark
536         SHT_INIT_ARRAY, et. al., as relro.
537
538 2012-03-14  Doug Kwan  <dougkwan@google.com>
539
540         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
541         dynamic relocations for protected symbols in shared objects.
542
543 2012-03-13  Ian Lance Taylor  <iant@google.com>
544
545         * resolve.cc (Symbol_table::resolve): When merging common symbols,
546         keep the larger alignment.
547
548 2012-03-12  Cary Coutant  <ccoutant@google.com>
549
550         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
551         handling of DW_LNE_define_file.
552
553 2012-03-12  Cary Coutant  <ccoutant@google.com>
554
555         * reduced_debug_output.cc
556         (Output_reduced_debug_info_section::get_die_end): Add new FORM
557         codes to switch.
558
559 2012-02-29  Cary Coutant  <ccoutant@google.com>
560
561         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
562
563 2012-02-29  Cary Coutant  <ccoutant@google.com>
564
565         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
566         Call Object::decompressed_section_contents.
567         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
568         New dtor.
569         (Sized_dwarf_line_info::buffer_start_): New data member.
570         * merge.cc (Output_merge_data::do_add_input_section): Call
571         Object::decompressed_section_contents.
572         (Output_merge_string::do_add_input_section): Likewise.
573         * object.cc (need_decompressed_section): New function.
574         (build_compressed_section_map): Decompress sections needed later.
575         (Sized_relobj_file::do_decompressed_section_contents): New function.
576         (Sized_relobj_file::do_discard_decompressed_sections): New function.
577         * object.h (Object::decompressed_section_contents): New function.
578         (Object::discard_decompressed_sections): New function.
579         (Object::do_decompressed_section_contents): New function.
580         (Object::do_discard_decompressed_sections): New function.
581         (Compressed_section_info): New type.
582         (Compressed_section_map): Include decompressed section contents.
583         (Sized_relobj_file::do_decompressed_section_contents): New function.
584         (Sized_relobj_file::do_discard_decompressed_sections): New function.
585
586 2012-02-16  Cary Coutant  <ccoutant@google.com>
587
588         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
589         * testsuite/Makefile.in: Regenerate.
590
591 2012-02-14  Cary Coutant  <ccoutant@google.com>
592
593         * options.cc (General_options::finalize): Disallow -pie and -static.
594
595 2012-02-03  Doug Kwan  <dougkwan@google.com>
596
597         * arm.cc (Arm_relocate_functions::abs8,
598         Arm_relocate_functions::abs16): Use
599         Bits::has_signed_unsigned_overflow32.
600         (Arm_relocate_functions::thm_abs8): Correct range of
601         overflow check.
602         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
603         in assertions.
604
605 2012-02-02  Doug Kwan  <dougkwan@google.com>
606
607         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
608         position independent outputs, not just shared objects.
609
610 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
611
612         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
613         * configure: Regenerated.
614
615 2012-01-27  Ian Lance Taylor  <iant@google.com>
616
617         * reloc.h (Bits): New class with static functions, copied from
618         namespace utils in arm.cc.
619         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
620         instead.
621
622 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
623
624         * incremental.cc (write_info_blocks): Correct relocation offset.
625
626 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
627
628         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
629         (Relocate::tls_gd_to_le): Likewise.
630
631 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
632
633         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
634
635 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
636
637         * configure.ac: Check if -mcmodel=medium works.
638         * configure: Regenerated.
639
640 2012-01-24  Cary Coutant  <ccoutant@google.com>
641
642         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
643         definition and ...
644         (read_unsigned_LEB_128_x): ... this new function.
645         (read_signed_LEB_128): Replaced with inline definition and ...
646         (read_signed_LEB_128_x): ... this new function.
647         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
648         (read_unsigned_LEB_128): Add inline definition.
649         (read_signed_LEB_128_x): New function.
650         (read_signed_LEB_128): Add inline definition.
651         * testsuite/Makefile.am (leb128_unittest): New unit test.
652         * testsuite/Makefile.in: Regenerate.
653         * testsuite/leb128_unittest.cc: New unit test.
654
655 2012-01-23  Ian Lance Taylor  <iant@google.com>
656
657         PR gold/13617
658         * i386.cc (Target_i386::do_code_fill): When using a jmp
659         instruction, pad with nop instructions.
660         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
661
662 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
663
664         * x86_64.cc (gc_process_relocs): Add typename on types used in
665         template.
666         (scan_relocs): Likewise.
667         (relocate_section): Likewise.
668         (apply_relocation): Likewise.
669
670 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
671
672         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
673         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
674         under x32.
675
676 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
677
678         * x86_64.cc: Initial support for x32.
679
680 2012-01-03  Cary Coutant  <ccoutant@google.com>
681
682         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
683         Use abstract base class for GOT.
684         * gold/output.h (class Output_data_got_base): New abstract base class.
685         (class Output_data_got): Derive from new base class, adjust ctors.
686         (Output_data_got::reserve_slot): Make virtual; rename to
687         do_reserve_slot; Adjust callers.
688         * gold/target.h (Sized_target::init_got_plt_for_update): Return
689         pointer to abstract base class.
690         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
691
692 2011-12-18  Ian Lance Taylor  <iant@google.com>
693
694         * object.h (Relobj::local_symbol_value): New function.
695         (Relobj::local_plt_offset): New function.
696         (Relobj::local_has_got_offset): New function.
697         (Relobj::local_got_offset): New function.
698         (Relobj::set_local_got_offset): New function.
699         (Relobj::do_local_symbol_value): New pure virtual function.
700         (Relobj::do_local_plt_offset): Likewise.
701         (Relobj::do_local_has_got_offset): Likewise.
702         (Relobj::do_local_got_offset): Likewise.
703         (Relobj::do_set_local_got_offset): Likewise.
704         (Sized_relobj::do_local_has_got_offset): Rename from
705         local_has_got_offset.
706         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
707         (Sized_relobj::do_set_local_got_offset): Rename from
708         set_local_got_offset.
709         (Sized_relobj_file::do_local_plt_offset): Rename from
710         local_plt_offset.
711         (Sized_relobj_file::do_local_symbol_value): New function.
712         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
713         local_plt_offset.
714         * output.cc (Output_data_got::Got_entry::write): Change object to
715         Relobj.  Use local_symbol_value.
716         (Output_data_got::add_global_with_rel): Change rel_dyn to
717         Output_data_reloc_generic*.  Use add_global_generic.
718         (Output_data_got::add_global_with_rela): Remove.  Change all
719         callers to use add_global_with_rel.
720         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
721         Output_data_reloc_generic*.  Use add_global_generic.
722         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
723         callers to use add_global_pair_with_rel.
724         (Output_data_got::add_local): Change object to Relobj*.
725         (Output_data_got::add_local_plt): Likewise.
726         (Output_data_got::add_local_with_rel): Change object to Relobj*,
727         change rel_dyn to Output_data_reloc_generic*.  Use
728         add_local_generic.
729         (Output_data_got::add_local_with_rela): Remove.  Change all
730         callers to use all_local_with_rel.
731         (Output_data_got::add_local_pair_with_rel): Change object to
732         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
733         add_output_section_generic.
734         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
735         callers to use add_local_pair_with_rel.
736         (Output_data_got::reserve_local): Change object to Relobj*.
737         * output.h: (class Output_data_reloc_generic): Add pure virtual
738         declarations for add_global_generic, add_local_generic,
739         add_output_section_generic.
740         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
741         functions for Output_data_reloc_generic.  Update declarations for
742         changes listed in output.cc.
743         (class Output_data_got): Change template parameter to got_size.
744         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
745         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
746         function.
747         (Sized_relobj_incr::do_local_plt_offset): New function.
748         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
749         add_global_generic.
750
751 2011-12-17  Cary Coutant  <ccoutant@google.com>
752
753         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
754         * resolve.cc (Symbol_table::resolve): Likewise.
755         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
756         arrays.
757         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
758
759 2011-12-16  Ian Lance Taylor  <iant@google.com>
760
761         * output.h (Output_data_reloc_generic::add): Only call
762         add_dynamic_reloc if this is a dynamic reloc section.
763
764 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
765
766         PR gold/13505
767         * target-reloc.h (apply_relocation): Replace <64, false> with
768         <size, big_endian>.
769
770 2011-11-25  Nick Clifton  <nickc@redhat.com>
771
772         * po/it.po: New Italian translation.
773
774 2011-11-17  Sterling Augustine  <saugustine@google.com>
775
776         * script.cc (script_include_directive): Implement.
777         (read_script_file): New local variables name and search_path. Update
778         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
779         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
780         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
781
782 2011-11-11  Sterling Augustine  <saugustine@google.com>
783
784         * yyscript.y (section_cmd): Add support for INCLUDE directive.
785         (file_or_sections_cmd): Likewise.
786
787 2011-11-11  Doug Kwan  <dougkwan@google.com>
788
789         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
790         if --just-symbols is given.
791
792 2011-11-10  Doug Kwan  <dougkwan@google.com>
793
794         PR gold/13362
795         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
796         when processing data relocs.
797         * reloc.h (Relocate_functions::rel_unaligned): New method.
798         (Relocate_functions::pcrel_unaligned): Ditto.
799         (Relocate_functions::rel32_unaligned): Ditto.
800         (Relocate_functions::pcrel32_unaligned): Ditto.
801
802 2011-11-09  Doug Kwan  <dougkwan@google.com>
803
804         PR gold/13362
805         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
806         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
807         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
808         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
809         (Relocate_functions::rel_unaligned): New.
810         (Relocate_functions::rel32_unaligned): New.
811         * target-reloc.h (relocate_for_relocatable): Add code to handle
812         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
813         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
814         arm_unaligned_reloc_r): New targets.
815         * testsuite/Makefile.in: Regenerate.
816         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
817         linking.
818
819 2011-11-02  Ian Lance Taylor  <iant@google.com>
820
821         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
822         NATIVE_LINKER.
823         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
824         * options.cc (General_options::finalize): Use library search path
825         from configure script if specified.  If not native and no sysroot,
826         only search TOOLLIBDIR.
827         * options.h (Search_directory::Search_directory): Change name to
828         const std::string&.
829         (General_options::add_to_library_path_with_sysroot): Change arg to
830         const std::string&.
831         * configure, Makefile.in, config.in: Rebuild.
832
833 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
834
835         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
836         we are working around the ARM1176 Erratum.
837         * options.h (General_options::fix_arm1176): Add option.
838         * testsuite/Makefile.am: Add testcases, and keep current ones
839         working.
840         * testsuite/Makefile.in: Regenerate.
841         * testsuite/arm_fix_1176.s: New file.
842         * testsuite/arm_fix_1176.sh: Likewise.
843
844 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
845
846         * arm.cc (Target_arm::Target_arm): Remove initialisation of
847         may_use_blx_.
848         (Target_arm::may_use_blx): Remove method.
849         (Target_arm::set_may_use_blx): Likewise.
850         (Target_arm::may_use_v4t_interworking): New method.
851         (Target_arm::may_use_v5t_interworking): Likewise.
852         (Target_arm::may_use_blx_): Remove member variable.
853         (Arm_relocate_functions::arm_branch_common): Check for v5T
854         interworking.
855         (Arm_relocate_functions::thumb_branch_common): Likewise.
856         (Reloc_stub::stub_type_for_reloc): Likewise.
857         (Target_arm::do_finalize_sections): Correct interworking checks.
858         * testsuite/Makefile.am: Add new tests.
859         * testsuite/Makefile.in: Regenerate.
860         * testsuite/arm_farcall_arm_arm.s: New test.
861         * testsuite/arm_farcall_arm_arm.sh: Likewise.
862         * testsuite/arm_farcall_arm_thumb.s: Likewise.
863         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
864         * testsuite/arm_farcall_thumb_arm.s: Likewise.
865         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
866         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
867         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
868
869 2011-10-31  Cary Coutant  <ccoutant@google.com>
870
871         PR gold/13023
872         * expression.cc (Expression::eval_with_dot): Add
873         is_section_dot_assignment parameter.
874         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
875         absolute and assigning to dot within a section.
876         * script-sections.cc
877         (Output_section_element_assignment::set_section_addresses): Pass
878         dot_section to set_if_absolute.
879         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
880         as is_section_dot_assignment flag to eval_with_dot.
881         (Output_section_element_dot_assignment::set_section_addresses):
882         Likewise.
883         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
884         parameter.  Also set value if relative to dot_section; set the
885         symbol's output_section.
886         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
887         parameter.  Adjust all callers.
888         (Expression::eval_maybe_dot): Likewise.
889         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
890         Adjust all callers.
891         * testsuite/script_test_2.t: Test assignment of an absolute value
892         to dot within an output section element.
893
894 2011-10-31  Cary Coutant  <ccoutant@google.com>
895
896         * options.h (class General_options): Add --[no-]gnu-unique options.
897         * symtab.cc (Symbol_table::sized_write_globals): Convert
898         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
899
900 2011-10-31  Cary Coutant  <ccoutant@google.com>
901
902         PR gold/13359
903         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
904         unnecessary assertion.
905         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
906
907 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
908
909         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
910         gc_mark_symbol.
911         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
912         gc_mark_symbol.
913         Change to just keep the section associated with symbol.
914         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
915         they are externally visible and --export-dynamic is turned on.
916         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
917
918 2011-10-19  Ian Lance Taylor  <iant@google.com>
919
920         PR gold/13163
921         * script-sections.cc
922         (Output_section_element_dot_assignment::needs_output_section): New
923         function.
924
925 2011-10-19  Ian Lance Taylor  <iant@google.com>
926
927         PR gold/13204
928         * layout.cc (Layout::segment_precedes): Don't assert failure if a
929         --section-start option was seen.
930         * options.h (General_options::any_section_start): New function.
931
932 2011-10-18  David S. Miller  <davem@davemloft.net>
933
934         PR binutils/13301
935         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
936         member to track relocation locations that have moved during TLS
937         reloc optimizations.
938         (Target_sparc::Relocate::Relocate): Initialize to NULL.
939         (Target_sparc::Relocate::relocate): Adjust view down by 4
940         bytes if it matches reloc_adjust_addr_.
941         (Target_sparc::Relocate::relocate_tls): Always move the
942         __tls_get_addr call delay slot instruction forward 4 bytes when
943         performing relaxation.
944
945 2011-10-18  Cary Coutant  <ccoutant@google.com>
946
947         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
948         (Output_file::map_no_anonymous): Check for non-zero
949         return code from posix_fallocate.
950
951 2011-10-17  Cary Coutant  <ccoutant@google.com>
952
953         PR gold/13245
954         * plugin.cc (is_visible_from_outside): Check for symbols
955         referenced from dynamic objects.
956         * resolve.cc (Symbol_table::resolve): Don't count references
957         from dynamic objects as references from real ELF files.
958         * testsuite/plugin_test_2.sh: Adjust expected result.
959
960 2011-10-17  Cary Coutant  <ccoutant@google.com>
961
962         * gold.cc: Include timer.h.
963         (queue_middle_tasks): Stamp time.
964         (queue_final_tasks): Likewise.
965         * main.cc (main): Store timer in parameters.  Print timers
966         for each pass.
967         * parameters.cc (Parameters::Parameters): Initialize timer_.
968         (Parameters::set_timer): New function.
969         (set_parameters_timer): New function.
970         * parameters.h (Parameters::set_timer): New function.
971         (Parameters::timer): New function.
972         (Parameters::timer_): New data member.
973         (set_parameters_timer): New function.
974         * timer.cc (Timer::stamp): New function.
975         (Timer::get_pass_time): New function.
976         * timer.h (Timer::stamp): New function.
977         (Timer::get_pass_time): New function.
978         (Timer::pass_times_): New data member.
979
980 2011-10-17  Cary Coutant  <ccoutant@google.com>
981
982         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
983         task for members of lib groups.
984
985 2011-10-17  Cary Coutant  <ccoutant@google.com>
986
987         PR gold/13288
988         * fileread.cc (File_read::find_view): Add assert.
989         (File_read::make_view): Move bounds check (replace with assert)...
990         (File_read::find_or_make_view): ... to here.
991
992 2011-10-12  Cary Coutant  <ccoutant@google.com>
993
994         * output.cc (Output_file::open_base_file): Handle case where
995         ::read returns less than requested size.
996
997 2011-10-10  Cary Coutant  <ccoutant@google.com>
998
999         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1000         Initialize defined_count_.
1001         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1002         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1003         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1004         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1005         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1006         * incremental.h (Sized_relobj_incr::defined_count_): New data
1007         member.
1008         (Sized_incr_dynobj::defined_count_): New data member.
1009         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1010         Return zeroes instead of internal error.
1011
1012 2011-10-10  Cary Coutant  <ccoutant@google.com>
1013
1014         PR gold/13249
1015         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1016         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1017         * output.h (class Output_reloc): Add use_plt_offset flag.
1018         (Output_reloc::type_): Adjust size of bit field.
1019         (Output_reloc::use_plt_offset_): New bit field.
1020         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1021         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1022         flag.  Adjust all callers.
1023         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1024         creating RELATIVE relocations.
1025
1026 2011-10-10  Nick Clifton  <nickc@redhat.com>
1027
1028         * po/es.po: Updated Spanish translation.
1029         * po/fi.po: Updated Finnish translation.
1030
1031 2011-10-03   Diego Novillo  <dnovillo@google.com>
1032
1033         * options.cc (parse_uint): Fix dereference of RETVAL.
1034
1035 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1036
1037         * layout.h (section_order_map_): New member.
1038         (get_section_order_map): New member function.
1039         * output.cc (Output_section::add_input_section): Check for patterns
1040         only when --section-ordering-file is specified.
1041         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1042         output_sections have been formed.
1043         * layout.cc (Layout_Layout): Initialize section_order_map_.
1044         * plugin.cc (update_section_order): Store order in order_map. Do not
1045         update the order.
1046         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1047         * testsuite/Makefile.in: Regenerate.
1048         * testsuite/plugin_section_order.c: New file.
1049         * testsuite/plugin_final_layout.cc: New file.
1050         * testsuite/plugin_final_layout.sh: New file.
1051
1052 2011-09-29  Cary Coutant  <ccoutant@google.com>
1053
1054         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1055         Check for NULL.
1056         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1057         symbols during incremental update.
1058         (Symbol_table::add_from_dynobj): Likewise.
1059
1060 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1061             Ian Lance Taylor  <iant@google.com>
1062
1063         * symtab.cc (Symbol_table::define_special_symbol): Always
1064         canonicalize version string.
1065
1066 2011-09-26  Cary Coutant  <ccoutant@google.com>
1067
1068         * gold.cc (queue_initial_tasks): Move option checks ...
1069         * options.cc (General_options::finalize): ... to here. Disable
1070         some options; make others fatal.
1071
1072 2011-09-26  Cary Coutant  <ccoutant@google.com>
1073
1074         gcc PR lto/47247
1075         * plugin.cc (get_symbols_v2): New function.
1076         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1077         (is_referenced_from_outside): New function.
1078         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1079         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1080         (get_symbols): Pass version parameter.
1081         (get_symbols_v2): New function.
1082         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1083         parameter.
1084         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1085         (onload): Add LDPT_GET_SYMBOLS_V2.
1086         (all_symbols_read_hook): Use get_symbols_v2; check for
1087         LDPR_PREVAILING_DEF_IRONLY_EXP.
1088         * testsuite/plugin_test_3.sh: Update expected results.
1089
1090 2011-09-23  Simon Baldwin  <simonb@google.com>
1091
1092         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1093         configuration options.
1094         * configure: Regenerate.
1095         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1096         * Makefile.in: Regenerate.
1097         * testsuite/Makefile.in: Regenerate.
1098
1099 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1100
1101         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1102
1103 2011-09-19  Cary Coutant  <ccoutant@google.com>
1104
1105         * incremental.cc (can_incremental_update): Fix typo in comment.
1106         * incremental.h (can_incremental_update): Likewise.
1107
1108 2011-09-18  Cary Coutant  <ccoutant@google.com>
1109
1110         * incremental.cc (can_incremental_update): New function.
1111         * incremental.h (can_incremental_update): New function.
1112         * layout.cc (Layout::init_fixed_output_section): Call it.
1113         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1114         * object.cc (Sized_relobj_file::do_layout): Call
1115         can_incremental_update.
1116
1117 2011-09-13  Cary Coutant  <ccoutant@google.com>
1118
1119         * configure.ac: Check for glibc support for gnu_indirect_function
1120         support with static linking, setting automake conditional
1121         IFUNC_STATIC.
1122         * Makefile.in: Regenerate.
1123         * configure: Regenerate.
1124
1125         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1126         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1127         for IFUNC_STATIC.
1128         * testsuite/Makefile.in: Regenerate.
1129
1130 2011-09-13  Cary Coutant  <ccoutant@google.com>
1131
1132         * incremental.cc (Sized_relobj_incr::do_layout): Call
1133         report_comdat_group for kept comdat sections.
1134         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1135         * testsuite/Makefile.in: Regenerate.
1136         * testsuite/incr_comdat_test_1.cc: New source file.
1137         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1138         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1139         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1140
1141 2011-09-13  Ian Lance Taylor  <iant@google.com>
1142
1143         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1144         variable external_symbols_offset.
1145
1146 2011-09-12  Ian Lance Taylor  <iant@google.com>
1147
1148         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1149         triggered if object has no symbols.
1150
1151 2011-09-09  David S. Miller  <davem@davemloft.net>
1152
1153         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1154         (Output_fill_debug_line::do_write): Likewise.
1155
1156 2011-08-29  Cary Coutant  <ccoutant@google.com>
1157
1158         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1159         casts to match formatting specs.
1160         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1161
1162 2011-08-26  Cary Coutant  <ccoutant@google.com>
1163
1164         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1165         remaining hole size when allocating.
1166         (Layout::make_output_section): Set fill methods for debug sections.
1167         * layout.h (Free_list::Free_list_node): Move from private to
1168         public.
1169         (Free_list::set_min_hole_size): New function.
1170         (Free_list::begin, Free_list::end): New functions.
1171         (Free_list::min_hole_): New data member.
1172         * output.cc: Include dwarf.h.
1173         (Output_fill_debug_info::do_minimum_hole_size): New function.
1174         (Output_fill_debug_info::do_write): New function.
1175         (Output_fill_debug_line::do_minimum_hole_size): New function.
1176         (Output_fill_debug_line::do_write): New function.
1177         (Output_section::Output_section): Initialize new data member.
1178         (Output_section::set_final_data_size): Ensure patch space is larger
1179         than minimum hole size.
1180         (Output_section::do_write): Fill holes in debug sections.
1181         * output.h (Output_fill): New class.
1182         (Output_fill_debug_info): New class.
1183         (Output_fill_debug_line): New class.
1184         (Output_section::set_free_space_fill): New function.
1185         (Output_section::free_space_fill_): New data member.
1186         * testsuite/Makefile.am (incremental_test_3): Add
1187         --incremental-patch option.
1188         (incremental_test_4): Likewise.
1189         (incremental_test_5): Likewise.
1190         (incremental_test_6): Likewise.
1191         (incremental_copy_test): Likewise.
1192         (incremental_common_test_1): Likewise.
1193         * testsuite/Makefile.in: Regenerate.
1194
1195 2011-08-26  Nick Clifton  <nickc@redhat.com>
1196
1197         * po/es.po: Updated Spanish translation.
1198
1199 2011-08-01  Cary Coutant  <ccoutant@google.com>
1200
1201         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1202         * gold/testsuite/Makefile.in: Regenerate.
1203         * gold/testsuite/justsyms_exec.c: New source file.
1204         * gold/testsuite/justsyms_lib.c: New source file.
1205
1206 2011-08-01  Cary Coutant  <ccoutant@google.com>
1207
1208         * layout.cc (Layout::set_segment_offsets): Don't realign text
1209         segment if -Ttext was specified.
1210         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1211         file type.
1212         * object.h (Sized_relobj_file::e_type): New function.
1213         (Sized_relobj_file::e_type_): New data member.
1214         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1215         base address for ET_EXEC files.
1216         * target.cc (Target::do_make_elf_object_implementation): Allow
1217         ET_EXEC files with --just-symbols option.
1218
1219 2011-07-28  Cary Coutant  <ccoutant@google.com>
1220
1221         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1222         Add thread_number parameter.
1223         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1224         * workqueue-threads.cc
1225         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1226         current thread if its thread number is greater than desired thread
1227         count.
1228         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1229         Add thread_number parameter.
1230         (Workqueue::should_cancel_thread): Likewise.
1231         (Workqueue::find_runnable_or_wait): Pass thread_number to
1232         should_cancel_thread.
1233         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1234         parameter.
1235
1236 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1237
1238         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1239         only after checking if it cannot be forced local.
1240         * symtab.h (is_externally_visible): Check if the symbol is not forced
1241         local.
1242
1243 2011-07-15  Ian Lance Taylor  <iant@google.com>
1244
1245         * options.h (class General_options): Add --print-output-format.
1246         Move -EL next to -EB, for  better --help output.
1247         * target-select.cc: Include <cstdio>, "options.h", and
1248         "parameters.h".
1249         (Target_selector::do_target_bfd_name): New function.
1250         (print_output_format): New function.
1251         * target-select.h (class Target_selector): Update declarations.
1252         (Target_selector::target_bfd_name): New function.
1253         (print_output_format): Declare.
1254         * main.cc: Include "target-select.h".
1255         (main): Handle --print-output-format.
1256         * gold.cc: Include "target-select.h".
1257         (queue_initial_tasks): Handle --print-output-format when there are
1258         no input files.
1259         * parameters.cc (parameters_force_valid_target): Give a better
1260         error message if -EB/-EL does not match target.
1261         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1262         function.
1263
1264 2011-07-15  Ian Lance Taylor  <iant@google.com>
1265
1266         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1267         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1268         (Output_data_plt_i386::do_write): Write address of .dynamic
1269         section to first entry in .got.plt section.
1270         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1271         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1272         Initialize layout_.
1273         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1274         section to first entry in .got.plt section.
1275         * layout.h (Layout::dynamic_section): New function.
1276
1277 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1278
1279         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1280         to claim_file call.
1281         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1282         input_section_position_, and input_section_glob_.
1283         (read_layout_from_file): Call function section_ordering_specified.
1284         * layout.h (is_section_ordering_specified): New function.
1285         (section_ordering_specified): New function.
1286         (section_ordering_specified_): New boolean member.
1287         * main.cc(main): Call load_plugins after layout object is defined.
1288         * output.cc (Output_section::add_input_section): Use
1289         function section_ordering_specified to check if section ordering is
1290         needed.
1291         * output.cc (Output_section::add_relaxed_input_section): Use
1292         function section_ordering_specified to check if section ordering is
1293         needed.
1294         (Output_section::update_section_layout): New function.
1295         (Output_section::sort_attached_input_sections): Check if input section
1296         must be reordered.
1297         * output.h (Output_section::update_section_layout): New function.
1298         * plugin.cc (get_section_count): New function.
1299         (get_section_type): New function.
1300         (get_section_name): New function.
1301         (get_section_contents): New function.
1302         (update_section_order): New function.
1303         (allow_section_ordering): New function.
1304         (Plugin::load): Add the new interfaces to the transfer vector.
1305         (Plugin_manager::load_plugins): New parameter.
1306         (Plugin_manager::all_symbols_read): New parameter.
1307         (Plugin_manager::claim_file): New parameter. Save the elf object for
1308         unclaimed objects.
1309         (Plugin_manager::get_elf_object): New function.
1310         (Plugin_manager::get_view): Change to directly use the bool to check
1311         if get_view is called from claim_file_hook.
1312         * plugin.h (input_objects): New function
1313         (Plugin__manager::load_plugins): New parameter.
1314         (Plugin_manager::claim_file): New parameter.
1315         (Plugin_manager::get_elf_object): New function.
1316         (Plugin_manager::in_claim_file_handler): New function.
1317         (Plugin_manager::in_claim_file_handler_): New member.
1318         (layout): New function.
1319         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1320         handler with an extra parameter. Make the elf object before calling
1321         claim_file handler.
1322         * testsuite/plugin_test.c (get_section_count): New function pointer.
1323         (get_section_type): New function pointer.
1324         (get_section_name): New function pointer.
1325         (get_section_contents): New function pointer.
1326         (update_section_order): New function pointer.
1327         (allow_section_ordering): New function pointer.
1328         (onload): Check if the new interfaces exist.
1329
1330 2011-07-13  Ian Lance Taylor  <iant@google.com>
1331
1332         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1333         relro section.
1334         * x86_64.cc (Target_x86_64::got_section): Likewise.
1335         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1336         (relro_now_test_SOURCES): New variable.
1337         (relro_now_test_DEPENDENCIES): New variable.
1338         (relro_now_test_LDFLAGS): New variable.
1339         (relro_now_test_LDADD): New variable.
1340         (relro_now_test.so): New target.
1341         * testsuite/Makefile.in: Rebuild.
1342
1343 2011-07-12  Ian Lance Taylor  <iant@google.com>
1344
1345         PR gold/12980
1346         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1347         GLOB_DAT relocation rather than a RELATIVE relocation for a
1348         protected symbol when creating a shared library.
1349         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1350         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1351         * testsuite/protected_main_1.cc (main): Test that protected
1352         function has same address.
1353
1354 2011-07-11  Ian Lance Taylor  <iant@google.com>
1355
1356         PR gold/12979
1357         * options.h (class General_options): Add -Bgroup.
1358         * options.cc (General_options::finalize): If -Bgroup is set,
1359         default to --unresolved-symbols=report-all.
1360         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1361         * target-reloc.h (issue_undefined_symbol_error): Handle
1362         --unresolved-symbols=report-all.
1363
1364 2011-07-08  Ian Lance Taylor  <iant@google.com>
1365
1366         PR gold/11985
1367         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1368         if linker script discards key sections.
1369         (Layout::create_dynamic_symtab): Likewise.
1370         (Layout::assign_local_dynsym_offsets): Likewise.
1371         (Layout::sized_create_version_sections): Likewise.
1372         (Layout::create_interp): Likewise.
1373         (Layout::finish_dynamic_section): Likewise.
1374         (Layout::set_dynamic_symbol_size): Likewise.
1375
1376 2011-07-08  Ian Lance Taylor  <iant@google.com>
1377
1378         PR gold/12386
1379         * options.h (class General_options): Add --unresolved-symbols.
1380         * target-reloc.h (issue_undefined_symbol_error): Check
1381         --unresolved-symbols.  Add comments.
1382
1383 2011-07-08  Ian Lance Taylor  <iant@google.com>
1384
1385         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1386         expression more complex.
1387
1388 2011-07-08  Ian Lance Taylor  <iant@google.com>
1389
1390         PR gold/11317
1391         * target-reloc.h (issue_undefined_symbol_error): New inline
1392         function, broken out of relocate_section.
1393         (relocate_section): Call issue_undefined_symbol_error.
1394         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1395         there is no TLS segment if we are about to issue an undefined
1396         symbol error.
1397         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1398
1399 2011-07-08  Ian Lance Taylor  <iant@google.com>
1400
1401         PR gold/12279
1402         * resolve.cc (Symbol_table::should_override): Add fromtype
1403         parameter.  Change all callers.  Give error when linking together
1404         TLS and non-TLS symbol.
1405         (Symbol_table::should_override_with_special): Add fromtype
1406         parameter.  Change all callers.
1407         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1408         there is no TLS segment if we have reported some errors.
1409         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1410
1411 2011-07-08  Ian Lance Taylor  <iant@google.com>
1412
1413         PR gold/12372
1414         * target.h (Target::plt_address_for_global): New function.
1415         (Target::plt_address_for_local): New function.
1416         (Target::plt_section_for_global): Remove.
1417         (Target::plt_section_for_local): Remove.
1418         (Target::do_plt_address_for_global): New virtual function.
1419         (Target::do_plt_address_for_local): New virtual function.
1420         (Target::do_plt_section_for_global): Remove.
1421         (Target::do_plt_section_for_local): Remove.
1422         (Target::register_global_plt_entry): Add Symbol_table and Layout
1423         parameters.
1424         * output.cc (Output_data_got::Got_entry::write): Use
1425         plt_address_for_global and plt_address_for_local.
1426         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1427         address of output section.
1428         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1429         got_irelative_, and irelative_count_ fields.  Update
1430         declarations.
1431         (Output_data_plt_i386::has_irelative_section): New function.
1432         (Output_data_plt_i386::entry_count): Add irelative_count_.
1433         (Output_data_plt_i386::set_final_data_size): Likewise.
1434         (class Target_i386): Add got_irelative_ and rel_irelative_
1435         fields.  Update declarations.
1436         (Target_i386::Target_i386): Initialize new fields.
1437         (Target_i386::do_plt_address_for_global): New function replacing
1438         do_plt_section_for_global.
1439         (Target_i386::do_plt_address_for_local): New function replacing
1440         do_plt_section_for_local.
1441         (Target_i386::got_section): Create got_irelative_.
1442         (Target_i386::rel_irelative_section): New function.
1443         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1444         fields.  Don't define __rel_iplt_{start,end}.
1445         (Output_data_plt_i386::add_entry): Add symtab and layout
1446         parameters.  Change all callers.  Use different PLT and GOT for
1447         IFUNC symbols.
1448         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1449         layout parameters.  Change all callers.  Use different PLT and
1450         GOT.
1451         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1452         (Output_data_plt_i386::rel_irelative): New function.
1453         (Output_data_plt_i386::address_for_global): New function.
1454         (Output_data_plt_i386::address_for_local): New function.
1455         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1456         IRELATIVE GOT when changing IFUNC GOT entries.
1457         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1458         reloc.
1459         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1460         if we didn't create an IRELATIVE GOT.
1461         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1462         plt_address_for_local.
1463         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1464         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1465         got_irelative_, and irelative_count_ fields.  Update
1466         declarations.
1467         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1468         Initialize new fields.  Remove symtab parameter.  Change all
1469         callers.
1470         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1471         irelative_count_.
1472         (Output_data_plt_x86_64::has_irelative_section): New function.
1473         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1474         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1475         fields.  Update declarations.
1476         (Target_x86_64::Target_x86_64): Initialize new fields.
1477         (Target_x86_64::do_plt_address_for_global): New function replacing
1478         do_plt_section_for_global.
1479         (Target_x86_64::do_plt_address_for_local): New function replacing
1480         do_plt_section_for_local.
1481         (Target_x86_64::got_section): Create got_irelative_.
1482         (Target_x86_64::rela_irelative_section): New function.
1483         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1484         all callers.  Don't create __rel_iplt_{start,end}.
1485         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1486         parameters.  Change all callers.  Use different PLT and GOT for
1487         IFUNC symbols.
1488         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1489         layout parameters.  Change all callers.  Use different PLT and
1490         GOT.
1491         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1492         parameters.  Change all callers.  Use different PLT and GOT for
1493         IFUNC symbols.
1494         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1495         (Output_data_plt_x86_64::rela_irelative): New function.
1496         (Output_data_plt_x86_64::address_for_global): New function.
1497         (Output_data_plt_x86_64::address_for_local): New function.
1498         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1499         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1500         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1501         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1502         parameters.
1503         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1504         reloc.
1505         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1506         symbols if we didn't create an IRELATIVE GOT.
1507         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1508         plt_address_for_local.
1509         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1510         * testsuite/ifuncvar1.c: New test file.
1511         * testsuite/ifuncvar2.c: New test file.
1512         * testsuite/ifuncvar3.c: New test file.
1513         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1514         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1515         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1516         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1517         * testsuite/Makefile.in: Rebuild.
1518
1519 2011-07-07  Cary Coutant  <ccoutant@google.com>
1520
1521         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1522         (two_file_test_1_ndebug.o): Likewise.
1523         (two_file_test_1b_ndebug.o): Likewise.
1524         (two_file_test_2_ndebug.o): Likewise.
1525         (two_file_test_main_ndebug.o): Likewise.
1526         (incremental_test_2): Link with no-debug versions.
1527
1528 2011-07-06  Cary Coutant  <ccoutant@google.com>
1529
1530         * gold/incremental.cc
1531         (Output_section_incremental_inputs::write_info_blocks): Check for
1532         hidden and internal symbols.
1533
1534 2011-07-06  Cary Coutant  <ccoutant@google.com>
1535
1536         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1537         Check disposition for startup file.
1538         (Incremental_inputs::report_command_line): Ignore
1539         --incremental-startup-unchanged option.
1540         * options.cc (General_options::parse_incremental_startup_unchanged):
1541         New function.
1542         (General_options::General_options): Initialize new data member.
1543         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1544         (General_options): Add --incremental-startup-unchanged option.
1545         (General_options::incremental_startup_disposition): New function.
1546         (General_options::incremental_startup_disposition_): New data member.
1547
1548 2011-07-06  Cary Coutant  <ccoutant@google.com>
1549
1550         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1551         input file index to Script_info ctor.
1552         (Sized_incremental_binary::do_file_has_changed): Find the
1553         command-line argument for files named in scripts.
1554         * incremental.h (Script_info::Script_info): New ctor
1555         with input file index.
1556         (Script_info::input_file_index): New function.
1557         (Script_info::input_file_index_): New data member.
1558         (Incremental_binary::get_library): Add const.
1559         (Incremental_binary::get_script_info): Add const.
1560         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1561         * testsuite/Makefile.am (incremental_test_5): New test case.
1562         (incremental_test_6): New test case.
1563         * testsuite/Makefile.in: Regenerate.
1564
1565 2011-07-06  Cary Coutant  <ccoutant@google.com>
1566
1567         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1568         debug output when command lines differ.
1569
1570 2011-07-06  Cary Coutant  <ccoutant@google.com>
1571
1572         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1573         --incremental-patch option.
1574         * layout.cc (Free_list::allocate): Extend allocation beyond original
1575         end if enabled.
1576         (Layout::make_output_section): Mark sections that should get
1577         patch space.
1578         * options.cc (parse_percent): New function.
1579         * options.h (parse_percent): New function.
1580         (DEFINE_percent): New macro.
1581         (General_options): Add --incremental-patch option.
1582         * output.cc (Output_section::Output_section): Initialize new data
1583         members.
1584         (Output_section::add_input_section): Print section name when out
1585         of patch space.
1586         (Output_section::add_output_section_data): Likewise.
1587         (Output_section::set_final_data_size): Add patch space when
1588         doing --incremental-full.
1589         (Output_section::do_reset_address_and_file_offset): Remove patch
1590         space.
1591         (Output_segment::set_section_list_addresses): Print debug output
1592         only if --incremental-update.
1593         * output.h (Output_section::set_is_patch_space_allowed): New function.
1594         (Output_section::is_patch_space_allowed_): New data member.
1595         (Output_section::patch_space_): New data member.
1596         * parameters.cc (Parameters::incremental_full): New function.
1597         * parameters.h (Parameters::incremental_full): New function
1598         * testsuite/Makefile.am (incremental_test_2): Add test for
1599         --incremental-patch option.
1600         * testsuite/Makefile.in: Regenerate.
1601         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1602         (t18): Remove function body.
1603
1604 2011-07-05  Doug Kwan  <dougkwan@google.com>
1605
1606         PR gold/12771
1607         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1608         Arm_Address type for relocation result.
1609         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1610         overflow check.
1611         (Arm_relocate_functions::abs32): Use unaligned access.
1612         (Arm_relocate_functions::rel32): Ditto.
1613         (Arm_relocate_functions::prel31): Ditto.
1614         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1615         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1616         static data relocations.
1617         * testsuite/Makefile.in: Regnerate.
1618         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1619
1620 2011-07-05  Ian Lance Taylor  <iant@google.com>
1621
1622         PR gold/12392
1623         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1624         symbols if necessary.
1625         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1626
1627 2011-07-05  Ian Lance Taylor  <iant@google.com>
1628
1629         PR gold/12952
1630         * resolve.cc (Symbol::override_base_with_special): Simply override
1631         version with special symbol version, ignoring previous version.
1632
1633 2011-07-05  Ian Lance Taylor  <iant@google.com>
1634
1635         * object.cc (Sized_relobj_file::include_section_group): Add
1636         information to comment about signature location.
1637
1638 2011-07-02  Ian Lance Taylor  <iant@google.com>
1639
1640         PR gold/12957
1641         * options.h (class General_options): Add -f and -F.
1642         * options.cc (General_options::finalize): Fatal error if -f/-F
1643         are used without -shared.
1644         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1645
1646 2011-07-02  Ian Lance Taylor  <iant@google.com>
1647
1648         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1649
1650 2011-07-01  Ian Lance Taylor  <iant@google.com>
1651
1652         PR gold/12525
1653         PR gold/12952
1654         * resolve.cc (Symbol::override_base_with_special): Don't override
1655         the version if the overriding symbol has a different name.
1656         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1657         all callers.  If we give an error about an undefined version,
1658         define the base version if necessary.
1659         * dynobj.h (class Versions): Update declaration.
1660         * testsuite/weak_alias_test_5.cc: New file.
1661         * testsuite/weak_alias_test.script: New file.
1662         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1663         and versioned_alias have the right value, and call t2.
1664         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1665         weak_alias_test_5.so.
1666         (weak_alias_test_LDADD): Likewise.
1667         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1668         * testsuite/Makefile.in: Rebuild.
1669
1670 2011-07-01  Ian Lance Taylor  <iant@google.com>
1671
1672         PR gold/12525
1673         * options.h (class General_options): Support -z notext.
1674         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1675         -Wl,-z,notext.
1676         (two_file_shared_nonpic.so): Likewise.
1677         (two_file_shared_mixed.so): Likewise.
1678         (two_file_shared_mixed_1.so): Likewise.
1679         (weak_undef_lib_nonpic.so): Likewise.
1680         (alt/weak_undef_lib_nonpic.so): Likewise.
1681         (tls_test_shared_nonpic.so): Likewise.
1682         * testsuite/Makefile.in: Rebuild.
1683
1684 2011-07-01  Ian Lance Taylor  <iant@google.com>
1685
1686         PR gold/12525
1687         * configure.ac: Test whether static linking works, setting
1688         the automake conditional HAVE_STATIC.
1689         * testsuite/Makefile.am: Disable tests using -static if
1690         HAVE_STATIC is not true.
1691         * configure, testsuite/Makefile.in: Rebuild.
1692
1693 2011-07-01  Ian Lance Taylor  <iant@google.com>
1694
1695         PR gold/12525
1696         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1697         Assert if we see DW_EH_PE_indirect.
1698         * target.h (Target::ehframe_datarel_base): New function.
1699         (Target::do_ehframe_datarel_base): New target function.
1700         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1701         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1702         function.
1703
1704 2011-07-01  Ian Lance Taylor  <iant@google.com>
1705
1706         PR gold/12571
1707         * options.h (class General_options): Add
1708         --ld-generated-unwind-info.
1709         * ehframe.cc (Fde::write): Add address parameter.  Change all
1710         callers.  If associated with PLT, fill in address and size.
1711         (Cie::set_output_offset): Only add merge mapping if there is an
1712         object.
1713         (Cie::write): Add address parameter.  Change all callers.
1714         (Eh_frame::add_ehframe_for_plt): New function.
1715         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1716         input_offset_ fields into union u_, with new plt field.
1717         (Fde::Fde): Adjust for new union field.
1718         (Fde::Fde) [Output_data version]: New constructor.
1719         (Fde::add_mapping): Only add merge mapping if there is an object.
1720         (class Cie): Update declarations.
1721         (class Eh_frame): Declare add_ehframe_for_plt.
1722         * layout.cc (Layout::layout_eh_frame): Break out code into
1723         make_eh_frame_section, and call it.
1724         (Layout::make_eh_frame_section): New function.
1725         (Layout::add_eh_frame_for_plt): New function.
1726         * layout.h (class Layout): Update declarations.
1727         * merge.cc (Merge_map::add_mapping): Add assertion.
1728         * i386.cc: Include "dwarf.h".
1729         (class Output_data_plt_i386): Make first_plt_entry,
1730         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1731         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1732         and plt_eh_frame_fde.
1733         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1734         boundary.  Call add_eh_frame_for_plt if appropriate.
1735         * x86_64.cc: Include "dwarf.h".
1736         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1737         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1738         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1739         and plt_eh_frame_fde.
1740         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1741         appropriate.
1742
1743 2011-06-29  Ian Lance Taylor  <iant@google.com>
1744
1745         PR gold/12629
1746         * object.cc (Sized_relobj_file::layout_section): Change shdr
1747         parameter to be const.
1748         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1749         out of do_layout.
1750         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1751         appropriate.  Call layout_eh_frame_section.
1752         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1753         sections.
1754         * object.h (class Sized_relobj_file): Update declarations.
1755
1756 2011-06-29  Ian Lance Taylor  <iant@google.com>
1757
1758         PR gold/12652
1759         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1760         modifier.
1761         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1762
1763 2011-06-29  Ian Lance Taylor  <iant@google.com>
1764
1765         PR gold/12675
1766         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1767         SHT_X86_64_UNWIND.
1768         * layout.cc (Layout::layout_eh_frame): Likewise.
1769
1770 2011-06-29  Ian Lance Taylor  <iant@google.com>
1771
1772         PR gold/12695
1773         * layout.cc (Layout::symtab_section_shndx): New function.
1774         * layout.h (class Layout): Declare symtab_section_shndx.
1775         * output.cc (Output_section::write_header): Call it.
1776
1777 2011-06-29  Ian Lance Taylor  <iant@google.com>
1778
1779         PR gold/12818
1780         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1781         symbols which are not used in a relocation.
1782
1783 2011-06-28  Ian Lance Taylor  <iant@google.com>
1784
1785         PR gold/12898
1786         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1787         script create indistinguishable segments.
1788         (Layout::set_segment_offsets): Use stable_sort when sorting
1789         segments.  Pass this to Compare_segments constructor.
1790         * layout.h (class Layout): Make segment_precedes non-static.
1791         (class Compare_segments): Change from struct to class.  Add
1792         layout_ field.  Add constructor.
1793         * script-sections.cc
1794         (Script_sections::attach_sections_using_phdrs_clause): Rename
1795         local orphan to is_orphan.  Don't report failure to put empty
1796         section in segment.  On attachment failure, report name of
1797         section, and attach to first PT_LOAD segment.
1798
1799 2011-06-28  Ian Lance Taylor  <iant@google.com>
1800
1801         PR gold/12934
1802         * target-select.cc (Target_selector::Target_selector): Add
1803         emulation parameter.  Change all callers.
1804         (select_target_by_bfd_name): Rename from select_target_by_name.
1805         Change all callers.
1806         (select_target_by_emulation): New function.
1807         (supported_emulation_names): New function.
1808         * target-select.h (class Target_selector): Add emulation_ field.
1809         Update declarations.
1810         (Target_selector::recognize_by_bfd_name): Rename from
1811         recognize_by_name.  Change all callers.
1812         (Target_selector::supported_bfd_names): Rename from
1813         supported_names.  Change all callers.
1814         (Target_selector::recognize_by_emulation): New function.
1815         (Target_selector::supported_emulations): New function.
1816         (Target_selector::emulation): New function.
1817         (Target_selector::do_recognize_by_bfd_name): Rename from
1818         do_recognize_by_name.  Change all callers.
1819         (Target_selector::do_supported_bfd_names): Rename from
1820         do_supported_names.  Change all callers.
1821         (Target_selector::do_recognize_by_emulation): New function.
1822         (Target_selector::do_supported_emulations): New function.
1823         (select_target_by_bfd_name): Change name in declaration.
1824         (select_target_by_emulation): Declare.
1825         (supported_emulation_names): Declare.
1826         * parameters.cc (parameters_force_valid_target): Try to find
1827         target based on emulation from -m option.
1828         * options.h (class General_options): Change doc string for -m.
1829         * options.cc (help): Print emulations.
1830         (General_options::parse_V): Likewise.
1831         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
1832         Add emulation parameter.  Change all callers.
1833
1834 2011-06-28  Ian Lance Taylor  <iant@google.com>
1835
1836         * target.h (class Target): Add osabi_ field.
1837         (Target::osabi): New function.
1838         (Target::set_osabi): New function.
1839         (Target::Target): Initialize osabi_.
1840         (Target::do_adjust_elf_header): Make pure virtual.
1841         (Sized_target::do_adjust_elf_header): Declare.
1842         * target.cc (Sized_target::do_adjust_elf_header): New function.
1843         (class Sized_target): Instantiate all versions.
1844         * freebsd.h (class Target_freebsd): Remove.
1845         (Target_selector_freebsd::do_recognize): Call set_osabi on
1846         Target.
1847         (Target_selector_freebsd::do_recognize_by_name): Likewise.
1848         (Target_selector_freebsd::set_osabi): Remove.
1849         * i386.cc (class Target_i386): Inherit from Sized_target rather
1850         than Target_freebsd.
1851         * x86_64.cc (class Target_x86_64): Likewise.
1852
1853 2011-06-28  Ian Lance Taylor  <iant@google.com>
1854
1855         * target.h (Target::can_check_for_function_pointers): Rewrite.
1856         Make non-virtual.
1857         (Target::can_icf_inline_merge_sections): Likewise.
1858         (Target::section_may_have_icf_unsafe_poineters): Likewise.
1859         (Target::Target_info): Add can_icf_inline_merge_sections field.
1860         (Target::do_can_check_for_function_pointers): New virtual
1861         function.
1862         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
1863         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
1864         from can_check_for_function_pointers, move in file.
1865         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
1866         section_may_have_icf_unsafe_poineters, move in file.
1867         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
1868         * i386.cc (Target_i386::do_can_check_for_function_pointers):
1869         Rename from can_check_for_function_pointers, move in file.
1870         (Target_i386::can_icf_inline_merge_sections): Remove.
1871         (Target_i386::i386_info): Initialize
1872         can_icf_inline_merge_sections.
1873         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
1874         Initialize can_icf_inline_merge_sections.
1875         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
1876         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
1877         Rename from can_check_for_function_pointers, move in file.
1878         (Target_x86_64::can_icf_inline_merge_sections): Remove.
1879         (Target_x86_64::x86_64_info): Initialize
1880         can_icf_inline_merge_sections.
1881         * testsuite/testfile.cc (Target_test::test_target_info):
1882         Likewise.
1883         * icf.cc (get_section_contents): Correct formatting.
1884
1885 2011-06-27  Ian Lance Taylor  <iant@google.com>
1886
1887         * symtab.cc (Symbol::versioned_name): New function.
1888         (Symbol_table::add_to_final_symtab): Use versioned_name when
1889         appropriate.
1890         (Symbol_table::sized_write_symbol): Likewise.
1891         * symtab.h (class Symbol): Declare versioned_name.
1892         * stringpool.h (class Stringpool_template): Add variant of add
1893         which takes a std::basic_string.
1894         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
1895         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
1896         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
1897         (ver_test_12.o): New target.
1898         * testsuite/Makefile.in: Rebuild.
1899
1900 2011-06-27  Doug Kwan  <dougkwan@google.com>
1901
1902         * arm.cc (Arm_relocate_functions::thm_jump8,
1903         Arm_relocate_functions::thm_jump11): Use a wider signed
1904         type to compute offset.
1905         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
1906         arm_thm_jump8.
1907         * testsuite/Makefile.in: Regenerate.
1908         * testsuite/arm_branch_in_range.sh: Check test results of
1909         arm_thm_jump11 and arm_thm_jump8.
1910         * testsuite/arm_thm_jump11.s: New test source file.
1911         * testsuite/arm_thm_jump11.t: New linker script.
1912         * testsuite/arm_thm_jump8.s: New test source file.
1913         * testsuite/arm_thm_jump8.t: New linker script.
1914
1915 2011-06-24  Ian Lance Taylor  <iant@google.com>
1916
1917         * layout.cc: Include "object.h".
1918         (ctors_sections_in_init_array): New static variable.
1919         (Layout::is_ctors_in_init_array): New function.
1920         (Layout::layout): Add entry to ctors_sections_in_init_array if
1921         appropriate.
1922         * layout.h (class Layout): Declare is_ctors_in_init_array.
1923         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
1924         is_ctors_reverse_view is set.
1925         (Sized_relobj_file::write_sections): Add layout parameter.  Change
1926         all callers.  Set is_ctors_reverse_view field of View_size.
1927         (Sized_relobj_file::reverse_words): New function.
1928         * object.h (Sized_relobj_file::View_size): Add
1929         is_ctors_reverse_view field.
1930         (class Sized_relobj_file): Update declarations.
1931         * testsuite/initpri3.c: New test.
1932         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
1933         initpri3b.
1934         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
1935         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
1936         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
1937         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
1938         * testsuite/Makefile.in: Rebuild.
1939
1940 2011-06-24  Cary Coutant  <ccoutant@google.com>
1941
1942         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
1943         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
1944         (debug_msg_cdebug.err): New targets.
1945         * testsuite/Makefile.in: Regenerate.
1946         * testsuite/debug_msg.sh: Check output of link with compressed debug.
1947         Fix checks for link with shared library.
1948
1949 2011-06-24  Doug Kwan  <dougkwan@google.com>
1950
1951         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
1952         skip empty text sections.
1953         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
1954
1955 2011-06-22  Ian Lance Taylor  <iant@google.com>
1956
1957         PR gold/12910
1958         * options.h (class General_options): Add --ctors-in-init-array.
1959         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
1960         friends as SHT_PROGBITS for merging sections.
1961         (Layout::layout): Remove special handling of .init_array and
1962         friends.  Don't sort if doing relocatable link.  Sort for .ctors
1963         and .dtors if ctors_in_init_array.
1964         (Layout::make_output_section): Force correct section types for
1965         .init_array and friends.  Don't sort if doing relocatable link,
1966         Don't sort .ctors and .dtors if ctors_in_init_array.
1967         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
1968         (Layout::output_section_name): Add relobj parameter.  Change all
1969         callers.  Handle .ctors. and .dtors. in code rather than table.
1970         Handle .ctors and .dtors if ctors_in_init_array.
1971         (Layout::match_file_name): New function, moved from output.cc.
1972         * layout.h (class Layout): Update declarations.
1973         * output.cc: Include "layout.h".
1974         (Input_section_sort_entry::get_priority): New function.
1975         (Input_section_sort_entry::match_file_name): Just call
1976         Layout::match_file_name.
1977         (Output_section::Input_section_sort_init_fini_compare::operator()):
1978         Handle .ctors and .dtors.  Sort by explicit priority rather than
1979         by name.
1980         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
1981         * testsuite/initpri2.c: New test.
1982         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
1983         (check_PROGRAMS): Add initpri2.
1984         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
1985         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
1986         * configure, testsuite/Makefile.in: Rebuild.
1987
1988 2011-06-19  Ian Lance Taylor  <iant@google.com>
1989
1990         PR gold/12880
1991         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
1992         .interp section to a PT_INTERP segment even if we have seen a
1993         --dynamic-linker option.  Don't do it if we have seen a PHDRS
1994         clause in a linker script.
1995         (Layout::finalize): Don't create a .interp section if we've
1996         already create a PT_INTERP segment.
1997         (Layout::create_interp): Always call choose_output_section (revert
1998         patch of 2011-06-17).  Don't create PT_INTERP segment.
1999         * script-sections.cc
2000         (Script_sections::create_note_and_tls_segments): Add a .interp
2001         section to a PT_INTERP segment even if we have seen a
2002         --dynamic-linker option.
2003
2004 2011-06-18  Ian Lance Taylor  <iant@google.com>
2005
2006         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2007         merely because a non-PT_LOAD segment has a dynamic reloc.
2008
2009 2011-06-18  Ian Lance Taylor  <iant@google.com>
2010
2011         * layout.cc (Layout::finish_dynamic_section): Don't create
2012         DT_FLAGS entry if not needed.
2013
2014 2011-06-18  Ian Lance Taylor  <iant@google.com>
2015
2016         PR gold/12745
2017         * layout.cc (Layout::layout_eh_frame): Correct handling of
2018         writable .eh_frame section.
2019
2020 2011-06-17  Ian Lance Taylor  <iant@google.com>
2021
2022         PR gold/12893
2023         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2024         symbol is redefined with the exact same object and value.
2025
2026 2011-06-17  Ian Lance Taylor  <iant@google.com>
2027
2028         PR gold/12880
2029         * layout.h (class Layout): Add interp_segment_ field.
2030         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2031         (Layout::attach_allocated_section_to_segment): If making shared
2032         library, put .interp section in PT_INTERP segment.
2033         (Layout::finalize): Also call create_interp if -dynamic-linker
2034         option was used.
2035         (Layout::create_interp): Assert that there is no PT_INTERP
2036         segment.  If not using a SECTIONS clause, use make_output_section.
2037         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2038         * script-sections.cc
2039         (Script_sections::create_note_and_tls_segments): If making shared
2040         library, put .interp section in PT_INTERP segment.
2041
2042 2011-06-17  Ian Lance Taylor  <iant@google.com>
2043
2044         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2045         when making a shared library.
2046
2047 2011-06-17  Ian Lance Taylor  <iant@google.com>
2048
2049         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2050         parameter.  Change all callers.  Don't issue warning about PC32
2051         against locally defined symbol.
2052
2053 2011-06-16  Ian Lance Taylor  <iant@google.com>
2054
2055         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2056         occurs in same object.
2057
2058 2011-06-14  Alan Modra  <amodra@gmail.com>
2059
2060         * po/POTFILES.in: Regenerate.
2061
2062 2011-06-09  Ian Lance Taylor  <iant@google.com>
2063
2064         * script-sections.cc
2065         (Orphan_output_section::set_section_addresses): For a relocatable
2066         link set address to 0.
2067
2068 2011-06-09  Cary Coutant  <ccoutant@google.com>
2069
2070         PR gold/12804
2071         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2072         used with --compress-debug-sections.
2073         * gold/object.cc (Sized_relobj_file::do_layout): Report
2074         uncompressed size of compressed input sections.
2075
2076 2011-06-08  Cary Coutant  <ccoutant@google.com>
2077
2078         PR gold/12804
2079         * testsuite/two_file_test_2_v1.cc: Change initialization of
2080         v2 to keep it in .data.
2081
2082 2011-06-07  Cary Coutant  <ccoutant@google.com>
2083
2084         * common.cc (Symbol_table::do_allocate_commons_list): Call
2085         gold_fallback.
2086         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2087         (Errors::fallback): New function.
2088         (gold_fallback): New function.
2089         * errors.h (Errors::fallback): New function.
2090         * gold.cc (gold_exit): Change status parameter to enum; adjust
2091         all callers.
2092         (queue_initial_tasks): Call gold_fallback.
2093         * gold.h: Include cstdlib.
2094         (Exit_status): New enum type.
2095         (gold_exit): Change status parameter to enum.
2096         (gold_fallback): New function.
2097         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2098         (Layout::create_symtab_sections): Likewise.
2099         (Layout::create_shdrs): Likewise.
2100         * main.cc (main): Adjust call to gold_exit.
2101         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2102         (Output_data_got::add_got_entry_pair): Likewise.
2103         (Output_section::add_input_section): Likewise.
2104         (Output_section::add_output_section_data): Likewise.
2105         (Output_segment::set_section_list_addresses): Likewise.
2106         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2107
2108 2011-06-07  Cary Coutant  <ccoutant@google.com>
2109
2110         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2111         for incremental links.
2112         * output.cc (Output_segment::set_section_list_addresses): Remove
2113         FIXME and test for TLS or BSS.
2114
2115 2011-06-07  Cary Coutant  <ccoutant@google.com>
2116
2117         * testsuite/Makefile.am: Add incremental_copy_test,
2118         incremental_common_test_1.
2119         * testsuite/Makefile.in: Regenerate.
2120         * testsuite/common_test_1_v1.c: New source file.
2121         * testsuite/common_test_1_v2.c: New source file.
2122         * testsuite/copy_test_v1.cc: New source file.
2123
2124 2011-06-07  Cary Coutant  <ccoutant@google.com>
2125
2126         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2127         update, allocate common from bss section's free list.
2128         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2129         linker-defined symbols.
2130         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2131         Skip GOT and PLT entries that are no longer referenced.
2132         (Output_section_incremental_inputs::write_info_blocks): Mark
2133         linker-defined symbols.
2134         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2135         * output.cc (Output_section::allocate): New function.
2136         * output.h (Output_section::allocate): New function.
2137         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2138         linker-defined symbols.
2139         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2140         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2141         (Symbol::init_base_output_data): Likewise.
2142         (Symbol::init_base_output_segment): Likewise.
2143         (Symbol::init_base_constant): Likewise.
2144         (Sized_symbol::init_output_data): Likewise.
2145         (Sized_symbol::init_output_segment): Likewise.
2146         (Sized_symbol::init_constant): Likewise.
2147         (Symbol_table::do_define_in_output_data): Likewise.
2148         (Symbol_table::do_define_in_output_segment): Likewise.
2149         (Symbol_table::do_define_as_constant): Likewise.
2150         * symtab.h (Symbol::is_predefined): New function.
2151         (Symbol::init_base_output_data): Add is_predefined parameter.
2152         (Symbol::init_base_output_segment): Likewise.
2153         (Symbol::init_base_constant): Likewise.
2154         (Symbol::is_predefined_): New data member.
2155         (Sized_symbol::init_output_data): Add is_predefined parameter.
2156         (Sized_symbol::init_output_segment): Likewise.
2157         (Sized_symbol::init_constant): Likewise.
2158         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2159
2160 2011-06-07  Cary Coutant  <ccoutant@google.com>
2161
2162         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2163         instead of emit_copy_reloc.
2164         (Copy_relocs::emit_copy_reloc): Refactor.
2165         (Copy_relocs::make_copy_reloc): New function.
2166         (Copy_relocs::add_copy_reloc): Remove.
2167         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2168         section.
2169         (Copy_relocs::make_copy_reloc): New function.
2170         (Copy_relocs::add_copy_reloc): Remove.
2171         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2172         unchanged input files.
2173         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2174         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2175         Reserve BSS space for COPY relocations.
2176         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2177         (Output_section_incremental_inputs::write_info_blocks): Record
2178         whether a symbol is copied from a shared object.
2179         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2180         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2181         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2182         (Incremental_input_entry_reader::get_output_symbol_index): Add
2183         is_copy parameter.
2184         (Incremental_binary::emit_copy_relocs): New function.
2185         (Incremental_binary::do_emit_copy_relocs): New function.
2186         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2187         new data member.
2188         (Sized_incremental_binary::add_copy_reloc): New function.
2189         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2190         (Sized_incremental_binary::Copy_reloc): New struct.
2191         (Sized_incremental_binary::Copy_relocs): New typedef.
2192         (Sized_incremental_binary::copy_relocs_): New data member.
2193         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2194         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2195         * target.h (Sized_target::emit_copy_reloc): New function.
2196         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2197
2198 2011-06-02  Cary Coutant  <ccoutant@google.com>
2199
2200         PR gold/12163
2201         * gold/archive.cc (Archive::Archive): Initialize new data member.
2202         (Archive::include_all_members): Return if archive has already been
2203         included.
2204         * gold/archive.h (Archive::include_all_members_): New data member.
2205
2206 2011-06-02  Nick Clifton  <nickc@redhat.com>
2207
2208         * dynobj.h: Fix spelling mistake in comment.
2209         * output.cc: Likewise.
2210
2211 2011-05-31  Doug Kwan  <dougkwan@google.com>
2212             Asier Llano
2213
2214         PR gold/12826
2215         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2216         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2217         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2218         redundant arm_exidx_test.so.
2219         * testsuite/Makefile.in: Regenerate.
2220         (check_SCRIPTS): Add pr12826.sh
2221         (check_DATA): Add pr12826.stdout
2222         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2223         * testsuite/pr12826.sh: New file.
2224         * testsuite/pr12826_1.s: Ditto.
2225         * testsuite/pr12826_1.s: Ditto.
2226
2227 2011-05-30  Ian Lance Taylor  <iant@google.com>
2228
2229         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2230         sections.
2231
2232 2011-05-29  Ian Lance Taylor  <iant@google.com>
2233
2234         PR gold/12804
2235         * testsuite/Makefile.am: Use different file name for two_file_test
2236         temporary file for each incremental test.
2237         * testsuite/Makefile.in: Rebuild.
2238
2239 2011-05-29  Ian Lance Taylor  <iant@google.com>
2240
2241         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2242         binary input file is empty.
2243
2244 2011-05-27  Ian Lance Taylor  <iant@google.com>
2245
2246         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2247         (ver_test_9.so): Likewise.
2248         * testsuite/Makefile.in: Rebuild.
2249
2250 2011-05-26 Cary Coutant  <ccoutant@google.com>
2251
2252         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2253         * incremental.cc (Incremental_inputs::report_input_section): Fix
2254         comment, indentation.
2255         (Incremental_inputs::report_comdat_group): New function.
2256         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2257         of data for incremental input file entry.
2258         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2259         group count, COMDAT group signatures.
2260         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2261         an unchanged input file.
2262         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2263         Initialize new data member.
2264         (Incremental_object_entry::add_comdat_group): New function.
2265         (Incremental_object_entry::get_comdat_group_count): New function.
2266         (Incremental_object_entry::get_comdat_signature_key): New function.
2267         (Incremental_object_entry::groups_): New data member.
2268         (Incremental_inputs::report_comdat_group): New function.
2269         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2270         data for incremental input file entry.
2271         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2272         (Incremental_input_entry_reader::get_input_section): Adjust size of
2273         data for incremental input file entry.
2274         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2275         (Incremental_input_entry_reader::get_comdat_group_signature): New
2276         function.
2277         * object.cc (Sized_relobj::include_section_group): Report kept
2278         COMDAT groups for incremental links.
2279
2280 2011-05-24  David Meyer  <pdox@google.com>
2281
2282         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2283         with name parameter.  Add found_name parameter.
2284         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2285         * dirsearch.h (class Dirsearch): Update declaration.
2286
2287 2011-05-24  Ian Lance Taylor  <iant@google.com>
2288
2289         * archive.cc (Library_base::should_include_member): Pull in object
2290         from archive if it defines the entry symbol.
2291         * parameters.cc (Parameters::entry): New function.
2292         * parameters.h (class Parameters): Declare entry.
2293         * output.h (class Output_file_header): Remove entry_ field.
2294         * output.cc (Output_file_header::Output_file_header): Remove entry
2295         parameter.  Change all callers.
2296         (Output_file_header::entry): Use parameters->entry.
2297         * gold.cc (queue_middle_tasks): Likewise.
2298         * plugin.cc (Plugin_hook::run): Likewise.
2299
2300 2011-05-24 Cary Coutant  <ccoutant@google.com>
2301
2302         * gold.cc (queue_initial_tasks): Pass incremental base filename
2303         to Output_file::open_base_file; don't print error message.
2304         * incremental-dump.cc (main): Adjust call to
2305         Output_file::open_for_modification.
2306         * incremental-dump.cc (main): Likewise.
2307         * incremental.cc (Incremental_inputs::report_command_line):
2308         Ignore --incremental-base option when comparing command lines.
2309         Ignore parameter when given as separate argument.
2310         * options.h (class General_options): Add --incremental-base.
2311         * output.cc (Output_file::Output_file):
2312         (Output_file::open_base_file): Add base_name and writable parameters;
2313         read base file into new file; print error message here.
2314         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2315         callers.
2316         * output.h (Output_file::open_for_modification): Rename to...
2317         (Output_file::open_base_file): ...this; add base_name and
2318         writable parameters; adjust all callers.
2319         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2320         callers.
2321         * testsuite/Makefile.am (incremental_test_4): Test
2322         --incremental-base.
2323         * testsuite/Makefile.in: Regenerate.
2324
2325 2011-05-24 Cary Coutant  <ccoutant@google.com>
2326
2327         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2328         incremental_test_4.
2329         * testsuite/Makefile.in: Regenerate.
2330         * testsuite/two_file_test_1_v1.cc: New test source file.
2331         * testsuite/two_file_test_1b_v1.cc: New test source file.
2332         * testsuite/two_file_test_2_v1.cc: New test source file.
2333
2334 2011-05-24 Cary Coutant  <ccoutant@google.com>
2335
2336         * dynobj.h (Dynobj::do_dynobj): New function.
2337         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2338         flag and soname for shared objects.
2339         * incremental.cc (Incremental_inputs::report_object): Make
2340         either Incremental_object_entry or Incremental_dynobj_entry; add
2341         soname to string table.
2342         (Incremental_inputs::report_input_section): Add assertion.
2343         (Output_section_incremental_inputs::set_final_data_size): Adjust
2344         type of input file entry for shared libraries; adjust size of
2345         shared library info entry.
2346         (Output_section_incremental_inputs::write_input_files): Write
2347         as_needed flag for shared libraries.
2348         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2349         of input file entry for shared libraries; write soname.
2350         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2351         soname from incremental info.
2352         * incremental.h (enum Incremental_input_flags): Add
2353         INCREMENTAL_INPUT_AS_NEEDED.
2354         (Incremental_input_entry::Incremental_input_entry): Initialize new
2355         data member.
2356         (Incremental_input_entry::set_as_needed): New function.
2357         (Incremental_input_entry::as_needed): New function.
2358         (Incremental_input_entry::do_dynobj_entry): New function.
2359         (Incremental_input_entry::as_needed_): New data member.
2360         (Incremental_object_entry::Incremental_object_entry): Don't check
2361         for shared library.
2362         (Incremental_object_entry::do_type): Likewise.
2363         (class Incremental_dynobj_entry): New class.
2364         (Incremental_input_entry_reader::as_needed): New function.
2365         (Incremental_input_entry_reader::get_soname): New function.
2366         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2367         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2368         size of shared library info entry.
2369         * layout.cc (Layout::finish_dynamic_section): Don't test for
2370         incremental link when adding DT_NEEDED entries.
2371         * object.h (Object::Object): Initialize new data member.
2372         (Object::dynobj): New function.
2373         (Object::set_as_needed): New function.
2374         (Object::as_needed): New function.
2375         (Object::do_dynobj): New function.
2376         (Object::as_needed_): New data member.
2377
2378 2011-05-24 Cary Coutant  <ccoutant@google.com>
2379
2380         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2381         info; adjust display of GOT entries.
2382         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2383         vector of input objects; remove file_status_.
2384         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2385         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2386         got_plt reader; call target hooks to reserve GOT entries.
2387         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2388         of input file info header and GOT info entry.
2389         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2390         relocation info.
2391         (Got_plt_view_info::got_descriptor): Remove.
2392         (Got_plt_view_info::sym_index): New data member.
2393         (Got_plt_view_info::input_index): New data member.
2394         (Local_got_offset_visitor::visit): Write input file index.
2395         (Global_got_offset_visitor::visit): Write 0 for input file index.
2396         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2397         with sym_index and input_index.
2398         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2399         incremental info GOT entry; replace got_descriptor with input_index.
2400         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2401         map from input file index to object.
2402         (Sized_relobj_incr::do_layout): Replace direct data member reference
2403         with accessor function.
2404         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2405         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2406         Adjust size of input file info header.
2407         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2408         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2409         (Incremental_input_entry_reader::get_input_section): Adjust size of
2410         input file info header.
2411         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2412         of incremental info GOT entry.
2413         (Incremental_got_plt_reader::get_got_desc): Remove.
2414         (Incremental_got_plt_reader::get_got_symndx): New function.
2415         (Incremental_got_plt_reader::get_got_input_index): New function.
2416         (Sized_incremental_binary::Sized_incremental_binary): Remove
2417         file_status_; add input_objects_.
2418         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2419         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2420         (Sized_incremental_binary::file_is_unchanged): Remove.
2421         (Sized_incremental_binary::set_input_object): New function.
2422         (Sized_incremental_binary::input_object): New function.
2423         (Sized_incremental_binary::file_status_): Remove.
2424         (Sized_incremental_binary::input_objects_): New data member.
2425         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2426         references.
2427         (Sized_relobj_incr::invalid_address): Move to base class.
2428         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2429         class.
2430         (Sized_relobj_incr::do_output_section_offset): Likewise.
2431         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2432         (Sized_relobj_incr::section_offsets_): Likewise.
2433         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2434         function.
2435         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2436         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2437         with accessor function.
2438         (Sized_relobj_file::do_layout): Likewise.
2439         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2440         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2441         (Sized_relobj_file::compute_final_local_value): Replace refs to
2442         section_offsets_ with accessor function.
2443         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2444         * object.h (Relobj::Relobj): Initialize new data members.
2445         (Relobj::add_dyn_reloc): New function.
2446         (Relobj::first_dyn_reloc): New function.
2447         (Relobj::dyn_reloc_count): New function.
2448         (Relobj::first_dyn_reloc_): New data member.
2449         (Relobj::dyn_reloc_count_): New data member.
2450         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2451         references.
2452         (Sized_relobj::Address): New typedef.
2453         (Sized_relobj::invalid_address): Move here from child class.
2454         (Sized_relobj::Sized_relobj): Initialize new data members.
2455         (Sized_relobj::sized_relobj): New function.
2456         (Sized_relobj::is_output_section_offset_invalid): Move here from
2457         child class.
2458         (Sized_relobj::get_output_section_offset): Likewise.
2459         (Sized_relobj::local_has_got_offset): Likewise.
2460         (Sized_relobj::local_got_offset): Likewise.
2461         (Sized_relobj::set_local_got_offset): Likewise.
2462         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2463         (Sized_relobj::clear_got_offsets): New function.
2464         (Sized_relobj::section_offsets): Move here from child class.
2465         (Sized_relobj::do_output_section_offset): Likewise.
2466         (Sized_relobj::do_set_section_offset): Likewise.
2467         (Sized_relobj::Local_got_offsets): Likewise.
2468         (Sized_relobj::local_got_offsets_): Likewise.
2469         (Sized_relobj::section_offsets_): Likewise.
2470         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2471         references.
2472         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2473         class.
2474         (Sized_relobj_file::sized_relobj): New function
2475         (Sized_relobj_file::local_has_got_offset): Move to base class.
2476         (Sized_relobj_file::local_got_offset): Likewise.
2477         (Sized_relobj_file::set_local_got_offset): Likewise.
2478         (Sized_relobj_file::get_output_section_offset): Likewise.
2479         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2480         (Sized_relobj_file::do_output_section_offset): Likewise.
2481         (Sized_relobj_file::do_set_section_offset): Likewise.
2482         (Sized_relobj_file::Local_got_offsets): Likewise.
2483         (Sized_relobj_file::local_got_offsets_): Likewise.
2484         (Sized_relobj_file::section_offsets_): Likewise.
2485         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2486         (all constructors).
2487         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2488         (Output_reloc::get_symbol_index): Likewise.
2489         (Output_reloc::local_section_offset): Likewise.
2490         (Output_reloc::get_address): Likewise.
2491         (Output_reloc::symbol_value): Likewise.
2492         (Output_data_got::reserve_slot): Move to class definition.
2493         (Output_data_got::reserve_local): New function.
2494         (Output_data_got::reserve_slot_for_global): Remove.
2495         (Output_data_got::reserve_global): New function.
2496         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2497         (all constructors, two instantiations).
2498         (Output_reloc::get_relobj): New function (two instantiations).
2499         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2500         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2501         (Output_data_reloc::add_global): Adjust type of relobj.
2502         (Output_data_reloc::add_global_relative): Likewise.
2503         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2504         (Output_data_reloc::add_local): Likewise.
2505         (Output_data_reloc::add_local_relative): Likewise.
2506         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2507         (Output_data_reloc::add_local_section): Likewise.
2508         (Output_data_reloc::add_output_section): Likewise.
2509         (Output_data_reloc::add_absolute): Likewise.
2510         (Output_data_reloc::add_target_specific): Likewise.
2511         (Output_data_got::reserve_slot): Move definition here.
2512         (Output_data_got::reserve_local): New function.
2513         (Output_data_got::reserve_global): New function.
2514         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2515         section_offsets_ with accessor function.
2516         (Sized_relobj_file::write_sections): Likewise.
2517         (Sized_relobj_file::do_relocate_sections): Likewise.
2518         * target.h (Sized_target::reserve_local_got_entry): New function.
2519         (Sized_target::reserve_global_got_entry): New function.
2520         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2521         (Target_x86_64::reserve_global_got_entry): New function.
2522         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2523
2524 2011-05-23 Cary Coutant  <ccoutant@google.com>
2525
2526         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2527         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2528         bit when checking got_type.
2529         * incremental.cc (Sized_incremental_binary::setup_readers):
2530         Store symbol table and string table locations; initialize bit vector
2531         of file status flags.
2532         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2533         unchanged files.
2534         (Sized_incremental_binary::do_process_got_plt): New function.
2535         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2536         (Output_section_incremental_inputs::set_final_data_size): Record
2537         file index for each input file.
2538         (Output_section_incremental_inputs::write_got_plt): Store file index
2539         instead of input entry offset for each GOT entry.
2540         * incremental.h
2541         (Incremental_input_entry::Incremental_input_entry): Initialize new
2542         data member.
2543         (Incremental_input_entry::set_offset): Store file index.
2544         (Incremental_input_entry::get_file_index): New function.
2545         (Incremental_input_entry::file_index_): New data member.
2546         (Incremental_binary::process_got_plt): New function.
2547         (Incremental_binary::do_process_got_plt): New function.
2548         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2549         data members.
2550         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2551         (Sized_incremental_binary::set_file_is_unchanged): New function.
2552         (Sized_incremental_binary::file_is_unchanged): New function.
2553         (Sized_incremental_binary::do_process_got_plt): New function.
2554         (Sized_incremental_binary::file_status_): New data member.
2555         (Sized_incremental_binary::main_symtab_loc_): New data member.
2556         (Sized_incremental_binary::main_strtab_loc_): New data member.
2557         * output.cc (Output_data_got::Got_entry::write): Add case
2558         RESERVED_CODE.
2559         (Output_data_got::add_global): Call add_got_entry.
2560         (Output_data_got::add_global_plt): Likewise.
2561         (Output_data_got::add_global_with_rel): Likewise.
2562         (Output_data_got::add_global_with_rela): Likewise.
2563         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2564         (Output_data_got::add_global_pair_with_rela): Likewise.
2565         (Output_data_got::add_local): Call add_got_entry.
2566         (Output_data_got::add_local_plt): Likewise.
2567         (Output_data_got::add_local_with_rel): Likewise.
2568         (Output_data_got::add_local_with_rela): Likewise.
2569         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2570         (Output_data_got::add_local_pair_with_rela): Likewise.
2571         (Output_data_got::reserve_slot): New function.
2572         (Output_data_got::reserve_slot_for_global): New function.
2573         (Output_data_got::add_got_entry): New function.
2574         (Output_data_got::add_got_entry_pair): New function.
2575         (Output_section::add_output_section_data): Edit FIXME.
2576         * output.h
2577         (Output_section_data_build::Output_section_data_build): New
2578         constructor with size parameter.
2579         (Output_data_space::Output_data_space): Likewise.
2580         (Output_data_got::Output_data_got): Initialize new data member; new
2581         constructor with size parameter.
2582         (Output_data_got::add_constant): Call add_got_entry.
2583         (Output_data_got::reserve_slot): New function.
2584         (Output_data_got::reserve_slot_for_global): New function.
2585         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2586         (Output_data_got::add_got_entry): New function.
2587         (Output_data_got::add_got_entry_pair): New function.
2588         (Output_data_got::free_list_): New data member.
2589         * target.h (Sized_target::init_got_plt_for_update): New function.
2590         (Sized_target::register_global_plt_entry): New function.
2591         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2592         Initialize new data member; call init; add constructor with PLT count.
2593         (Output_data_plt_x86_64::init): New function.
2594         (Output_data_plt_x86_64::add_relocation): New function.
2595         (Output_data_plt_x86_64::reserve_slot): New function.
2596         (Output_data_plt_x86_64::free_list_): New data member.
2597         (Target_x86_64::init_got_plt_for_update): New function.
2598         (Target_x86_64::register_global_plt_entry): New function.
2599         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2600         incremental updates.
2601         (Output_data_plt_x86_64::add_relocation): New function.
2602         * testsuite/object_unittest.cc (Object_test): Set default options.
2603
2604 2011-05-16  Ian Lance Taylor  <iant@google.com>
2605
2606         * options.h (class General_options): Make -i a synonym for -r.
2607
2608 2011-05-16  Ian Lance Taylor  <iant@google.com>
2609
2610         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2611
2612 2011-05-10 Cary Coutant  <ccoutant@google.com>
2613
2614         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2615         strip_all (-s).
2616
2617 2011-05-06  Ian Lance Taylor  <iant@google.com>
2618
2619         * layout.cc (Layout::layout): If the output section flags change,
2620         update the ordering.
2621
2622 2011-04-25 Cary Coutant  <ccoutant@google.com>
2623
2624         * incremental-dump.cc (dump_incremental_inputs): Print local
2625         symbol info for each input file.
2626         * incremental.cc
2627         (Output_section_incremental_inputs::set_final_data_size): Add local
2628         symbol info to input file entries in incremental info.
2629         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2630         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2631         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2632         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2633         implementation.
2634         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2635         (Sized_incr_relobj::do_relocate): Write the local symbols.
2636         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2637         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2638         Adjust size of input file header.
2639         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2640         (Incremental_inputs_reader::get_local_symbol_count): New function.
2641         (Incremental_inputs_reader::get_input_section): Adjust size of input
2642         file header.
2643         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2644         (Sized_incr_relobj::This): New typedef.
2645         (Sized_incr_relobj::sym_size): New const data member.
2646         (Sized_incr_relobj::Local_symbol): New struct.
2647         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2648         (Sized_incr_relobj::do_local_symbol_offset): New function.
2649         (Sized_incr_relobj::local_symbol_count_): New data member.
2650         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2651         (Sized_incr_relobj::local_symbol_index_): New data member.
2652         (Sized_incr_relobj::local_symbol_offset_): New data member.
2653         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2654         (Sized_incr_relobj::local_symbols_): New data member.
2655         * object.h (Relobj::output_local_symbol_count): New function.
2656         (Relobj::local_symbol_offset): New function.
2657         (Relobj::do_output_local_symbol_count): New function.
2658         (Relobj::do_local_symbol_offset): New function.
2659         (Sized_relobj::do_output_local_symbol_count): New function.
2660         (Sized_relobj::do_local_symbol_offset): New function.
2661
2662 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2663
2664         * descriptors.cc (set_close_on_exec): New function.
2665         (Descriptors::open): Use set_close_on_exec.
2666         * output.cc (S_ISLNK): Define if not defined.
2667
2668 2011-04-22 Cary Coutant  <ccoutant@google.com>
2669
2670         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2671         global symbol map.
2672         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2673         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2674         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2675         relocations.
2676         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2677         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2678         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2679         * incremental.h
2680         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2681         function.
2682         (Incremental_binary::apply_incremental_relocs): New function.
2683         (Incremental_binary::do_apply_incremental_relocs): New function.
2684         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2685         data member.
2686         (Sized_incremental_binary::add_global_symbol): New function.
2687         (Sized_incremental_binary::global_symbol): New function.
2688         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2689         (Sized_incremental_binary::symbol_map_): New data member.
2690         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2691         * target.h (Sized_target::apply_relocation): New function.
2692         * target-reloc.h (apply_relocation): New function.
2693         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2694
2695 2011-04-22  Doug Kwan  <dougkwan@google.com>
2696
2697         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2698         flag of a SHT_ARM_EXIDX section.
2699         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2700         * testsuite/Makefile.in: Regenerate.
2701         * testsuite/arm_exidx_test.s: New file.
2702         * testsuite/arm_exidx_test.sh: Same.
2703
2704 2011-04-20 Cary Coutant  <ccoutant@google.com>
2705
2706         PR gold/12689
2707         * archive.h (Incremental_archive_entry::Archive_member):
2708         Initialize arg_serial_ (second constructor).
2709
2710 2011-04-17  Ian Lance Taylor  <iant@google.com>
2711
2712         * object.cc (Relocate_info::location): Simplify location string.
2713         * errors.cc (Errors::error_at_location): Don't print program
2714         name.
2715         (Errors::warning_at_location): Likewise.
2716         (Errors::undefined_symbol): Likewise.
2717         * testsuite/debug_msg.sh: Update accordingly.
2718
2719 2011-04-14 Cary Coutant  <ccoutant@google.com>
2720
2721         * gold/layout.cc (Layout::symtab_section_offset): New function.
2722         * gold/layout.h (Layout::symtab_section_offset): New function.
2723         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2724
2725 2011-04-12  Ian Lance Taylor  <iant@google.com>
2726
2727         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2728         with MREMAP_MAYMOVE.
2729         * output.h (class Output_file): Add map_is_allocated_ field.
2730         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2731         not available, provide stubs.  If mremap is not available, #define
2732         it to gold_mremap.
2733         (MREMAP_MAYMOVE): Define if not defined.
2734         (Output_file::Output_file): Initialize map_is_allocated_.
2735         (Output_file::resize): Check map_is_allocated_.
2736         (Output_file::map_anonymous): If mmap fails, use malloc.
2737         (Output_file::unmap): Don't do anything for an anonymous map.
2738         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2739         is not available, provide stubs.
2740         (File_read::View::~View): Use free rather than delete[].
2741         (File_read::make_view): Use malloc rather than new[].  If mmap
2742         fails, use malloc.
2743         (File_read::find_or_make_view): Use malloc rather than new[].
2744         * gold.h: Remove HAVE_REMAP code.
2745         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2746         exists.  Rename mremap to gold_mremap.  If mmap is not available
2747         don't do anything.
2748         * configure, config.in: Rebuild.
2749
2750 2011-04-11  Ian Lance Taylor  <iant@google.com>
2751
2752         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2753         initialize local variable v.
2754
2755 2011-04-11  Cary Coutant  <ccoutant@google.com>
2756
2757         * archive.cc (Archive::include_member): Adjust call to
2758         report_object.
2759         (Add_archive_symbols::run): Track argument serial numbers.
2760         (Lib_group::include_member): Likewise.
2761         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2762         * archive.h (Incremental_archive_entry::Archive_member):
2763         Initialize arg_serial_.
2764         (Archive_member::arg_serial_): New data member.
2765         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2766         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2767         incremental link.
2768         (Sized_dynobj::do_for_all_local_got_entries): New function.
2769         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2770         function.
2771         * fileread.cc (get_mtime): New function.
2772         * fileread.h (get_mtime): New function.
2773         * gold.cc (queue_initial_tasks): Check for incremental update.
2774         (process_incremental_input): New function.
2775         (queue_middle_tasks): Don't force valid target for incremental
2776         update.
2777         * incremental-dump.cc (find_input_containing_global): Adjust
2778         size of symbol info entry.
2779         (dump_incremental_inputs): Dump argument serial number and
2780         in_system_directory flag; bias shndx by 1; print symbol names
2781         when dumping per-file symbol lists; use new symbol info readers.
2782         * incremental.cc
2783         (Output_section_incremental_inputs:update_data_size): New function.
2784         (Sized_incremental_binary::setup_readers): Setup input readers
2785         for each input file; build maps for files added from libraries
2786         and scripts.
2787         (Sized_incremental_binary::check_input_args): New function.
2788         (Sized_incremental_binary::do_check_inputs): Build map of argument
2789         serial numbers to input arguments.
2790         (Sized_incremental_binary::do_file_has_changed): Rename
2791         do_file_is_unchanged to this; compare file modification times.
2792         (Sized_incremental_binary::do_init_layout): New function.
2793         (Sized_incremental_binary::do_reserve_layout): New function.
2794         (Sized_incremental_binary::do_get_input_reader): Remove.
2795         (Sized_incremental_binary::get_symtab_view): New function.
2796         (Incremental_checker::can_incrementally_link_output_file): Remove.
2797         (Incremental_inputs::report_command_line): Exclude --debug options.
2798         (Incremental_inputs::report_archive_begin): Add parameter; track
2799         argument serial numbers; don't put input file entry for archive
2800         before archive members.
2801         (Incremental_inputs::report_archive_end): Put input file entry
2802         for archive after archive members.
2803         (Incremental_inputs::report_object): Add parameter; track argument
2804         serial numbers and in_system_directory flag.
2805         (Incremental_inputs::report_script): Add parameter; track argument
2806         serial numbers.
2807         (Output_section_incremental_inputs::set_final_data_size): Adjust
2808         size of symbol info entry; check for forwarding symbols.
2809         (Output_section_incremental_inputs::write_input_files): Write
2810         in_system_directory flag and argument serial number.
2811         (Output_section_incremental_inputs::write_info_blocks): Map section
2812         indices between incremental info and original input file; store
2813         input section index for each symbol.
2814         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
2815         change operator() to visit().
2816         (class Global_got_offset_visitor): Likewise.
2817         (class Global_symbol_visitor_got_plt):
2818         (Output_section_incremental_inputs::write_got_plt): Use new visitor
2819         classes.
2820         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
2821         (Sized_incr_relobj::do_read_symbols): New function.
2822         (Sized_incr_relobj::do_layout): New function.
2823         (Sized_incr_relobj::do_layout_deferred_sections): New function.
2824         (Sized_incr_relobj::do_add_symbols): New function.
2825         (Sized_incr_relobj::do_should_include_member): New function.
2826         (Sized_incr_relobj::do_for_all_global_symbols): New function.
2827         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
2828         (Sized_incr_relobj::do_section_size): New function.
2829         (Sized_incr_relobj::do_section_name): New function.
2830         (Sized_incr_relobj::do_section_contents): New function.
2831         (Sized_incr_relobj::do_section_flags): New function.
2832         (Sized_incr_relobj::do_section_entsize): New function.
2833         (Sized_incr_relobj::do_section_address): New function.
2834         (Sized_incr_relobj::do_section_type): New function.
2835         (Sized_incr_relobj::do_section_link): New function.
2836         (Sized_incr_relobj::do_section_info): New function.
2837         (Sized_incr_relobj::do_section_addralign): New function.
2838         (Sized_incr_relobj::do_initialize_xindex): New function.
2839         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
2840         (Sized_incr_relobj::do_read_relocs): New function.
2841         (Sized_incr_relobj::do_gc_process_relocs): New function.
2842         (Sized_incr_relobj::do_scan_relocs): New function.
2843         (Sized_incr_relobj::do_count_local_symbols): New function.
2844         (Sized_incr_relobj::do_finalize_local_symbols): New function.
2845         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
2846         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
2847         (Sized_incr_relobj::do_relocate): New function.
2848         (Sized_incr_relobj::do_set_section_offset): New function.
2849         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
2850         (Sized_incr_dynobj::do_read_symbols): New function.
2851         (Sized_incr_dynobj::do_layout): New function.
2852         (Sized_incr_dynobj::do_add_symbols): New function.
2853         (Sized_incr_dynobj::do_should_include_member): New function.
2854         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
2855         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
2856         (Sized_incr_dynobj::do_section_size): New function.
2857         (Sized_incr_dynobj::do_section_name): New function.
2858         (Sized_incr_dynobj::do_section_contents): New function.
2859         (Sized_incr_dynobj::do_section_flags): New function.
2860         (Sized_incr_dynobj::do_section_entsize): New function.
2861         (Sized_incr_dynobj::do_section_address): New function.
2862         (Sized_incr_dynobj::do_section_type): New function.
2863         (Sized_incr_dynobj::do_section_link): New function.
2864         (Sized_incr_dynobj::do_section_info): New function.
2865         (Sized_incr_dynobj::do_section_addralign): New function.
2866         (Sized_incr_dynobj::do_initialize_xindex): New function.
2867         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
2868         (make_sized_incremental_object): New function.
2869         (Incremental_library::copy_unused_symbols): New function.
2870         (Incremental_library::do_for_all_unused_symbols): New function.
2871         * incremental.h (enum Incremental_input_flags): New type.
2872         (class Incremental_checker): Remove.
2873         (Incremental_input_entry::Incremental_input_entry): Add argument
2874         serial number.
2875         (Incremental_input_entry::arg_serial): New function.
2876         (Incremental_input_entry::set_is_in_system_directory): New function.
2877         (Incremental_input_entry::is_in_system_directory): New function.
2878         (Incremental_input_entry::arg_serial_): New data member.
2879         (Incremental_input_entry::is_in_system_directory_): New data member.
2880         (class Script_info): Move here from script.h.
2881         (Script_info::Script_info): Add filename parameter.
2882         (Script_info::filename): New function.
2883         (Script_info::filename_): New data member.
2884         (Incremental_script_entry::Incremental_script_entry): Add argument
2885         serial number.
2886         (Incremental_object_entry::Incremental_object_entry): Likewise.
2887         (Incremental_object_entry::add_input_section): Build list of input
2888         sections with map to original shndx.
2889         (Incremental_object_entry::get_input_section_index): New function.
2890         (Incremental_object_entry::shndx_): New data member.
2891         (Incremental_object_entry::name_key_): Rename; adjust all refs.
2892         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
2893         (Incremental_archive_entry::Incremental_archive_entry): Add argument
2894         serial number.
2895         (Incremental_inputs::report_archive_begin): Likewise.
2896         (Incremental_inputs::report_object): Likewise.
2897         (Incremental_inputs::report_script): Likewise.
2898         (class Incremental_global_symbol_reader): New class.
2899         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
2900         and store flags and input file type.
2901         (Incremental_input_entry_reader::arg_serial): New function.
2902         (Incremental_input_entry_reader::type): Extract type from flags.
2903         (Incremental_input_entry_reader::is_in_system_directory): New function.
2904         (Incremental_input_entry_reader::get_input_section_count): Call
2905         accessor function for type.
2906         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
2907         function for type; adjust size of global symbol entry.
2908         (Incremental_input_entry_reader::get_global_symbol_count): Call
2909         accessor function for type.
2910         (Incremental_input_entry_reader::get_object_count): Likewise.
2911         (Incremental_input_entry_reader::get_object_offset): Likewise.
2912         (Incremental_input_entry_reader::get_member_count): Likewise.
2913         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
2914         (Incremental_input_entry_reader::get_member_offset): Likewise.
2915         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
2916         (Incremental_input_entry_reader::Global_symbol_info): Remove.
2917         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
2918         (Incremental_input_entry_reader::get_global_symbol_reader): New
2919         function.
2920         (Incremental_input_entry_reader::get_output_symbol_index): New
2921         function.
2922         (Incremental_input_entry_reader::type_): Remove.
2923         (Incremental_input_entry_reader::flags_): New data member.
2924         (Incremental_inputs_reader::input_file_offset): New function.
2925         (Incremental_inputs_reader::input_file_index): New function.
2926         (Incremental_inputs_reader::input_file): Call input_file_offset.
2927         (Incremental_inputs_reader::input_file_at_offset): New function.
2928         (Incremental_relocs_reader::get_r_type): Reformat.
2929         (Incremental_relocs_reader::get_r_shndx): Reformat.
2930         (Incremental_relocs_reader::get_r_offset): Reformat.
2931         (Incremental_relocs_reader::data): New function.
2932         (Incremental_binary::Incremental_binary): Initialize new data members.
2933         (Incremental_binary::check_inputs): Add cmdline parameter.
2934         (Incremental_binary::file_is_unchanged): Remove.
2935         (Input_reader::arg_serial): New function.
2936         (Input_reader::get_unused_symbol_count): New function.
2937         (Input_reader::get_unused_symbol): New function.
2938         (Input_reader::do_arg_serial): New function.
2939         (Input_reader::do_get_unused_symbol_count): New function.
2940         (Input_reader::do_get_unused_symbol): New function.
2941         (Incremental_binary::input_file_count): New function.
2942         (Incremental_binary::get_input_reader): Change signature to use
2943         index instead of filename.
2944         (Incremental_binary::file_has_changed): New function.
2945         (Incremental_binary::get_input_argument): New function.
2946         (Incremental_binary::get_library): New function.
2947         (Incremental_binary::get_script_info): New function.
2948         (Incremental_binary::init_layout): New function.
2949         (Incremental_binary::reserve_layout): New function.
2950         (Incremental_binary::output_file): New function.
2951         (Incremental_binary::do_check_inputs): New function.
2952         (Incremental_binary::do_file_is_unchanged): Remove.
2953         (Incremental_binary::do_file_has_changed): New function.
2954         (Incremental_binary::do_init_layout): New function.
2955         (Incremental_binary::do_reserve_layout): New function.
2956         (Incremental_binary::do_input_file_count): New function.
2957         (Incremental_binary::do_get_input_reader): Change signature.
2958         (Incremental_binary::input_args_map_): New data member.
2959         (Incremental_binary::library_map_): New data member.
2960         (Incremental_binary::script_map_): New data member.
2961         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2962         new data members.
2963         (Sized_incremental_binary::output_section): New function.
2964         (Sized_incremental_binary::inputs_reader): Add const.
2965         (Sized_incremental_binary::symtab_reader): Add const.
2966         (Sized_incremental_binary::relocs_reader): Add const.
2967         (Sized_incremental_binary::got_plt_reader): Add const.
2968         (Sized_incremental_binary::get_symtab_view): New function.
2969         (Sized_incremental_binary::Inputs_reader): New typedef.
2970         (Sized_incremental_binary::Input_entry_reader): New typedef.
2971         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
2972         (Sized_incremental_binary::do_file_is_unchanged): Remove.
2973         (Sized_incremental_binary::do_file_has_changed): New function.
2974         (Sized_incremental_binary::do_init_layout): New function.
2975         (Sized_incremental_binary::do_reserve_layout): New function.
2976         (Sized_input_reader::Inputs_reader): Remove.
2977         (Sized_input_reader::Input_entry_reader): Remove.
2978         (Sized_input_reader::do_arg_serial): New function.
2979         (Sized_input_reader::do_get_unused_symbol_count): New function.
2980         (Sized_input_reader::do_get_unused_symbol): New function.
2981         (Sized_incremental_binary::do_input_file_count): New function.
2982         (Sized_incremental_binary::do_get_input_reader): Change signature;
2983         use index instead of filename.
2984         (Sized_incremental_binary::section_map_): New data member.
2985         (Sized_incremental_binary::input_entry_readers_): New data member.
2986         (class Sized_incr_relobj): New class.
2987         (class Sized_incr_dynobj): New class.
2988         (make_sized_incremental_object): New function.
2989         (class Incremental_library): New class.
2990         * layout.cc (Free_list::num_lists): New static data member.
2991         (Free_list::num_nodes): New static data member.
2992         (Free_list::num_removes): New static data member.
2993         (Free_list::num_remove_visits): New static data member.
2994         (Free_list::num_allocates): New static data member.
2995         (Free_list::num_allocate_visits): New static data member.
2996         (Free_list::init): New function.
2997         (Free_list::remove): New function.
2998         (Free_list::allocate): New function.
2999         (Free_list::dump): New function.
3000         (Free_list::print_stats): New function.
3001         (Layout_task_runner::run): Resize output file for incremental updates.
3002         (Layout::Layout): Initialize new data members.
3003         (Layout::set_incremental_base): New function.
3004         (Layout::init_fixed_output_section): New function.
3005         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3006         incremental updates.
3007         (Layout::create_gold_note): Do not create gold note section for
3008         incremental updates.
3009         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3010         for incremental updates.
3011         (Layout::set_section_offsets): For incremental updates, allocate space
3012         from free list.
3013         (Layout::create_symtab_sections): Layout with offsets relative to
3014         start of section; for incremental updates, allocate space from free
3015         list.
3016         (Layout::create_shdrs): For incremental updates, allocate space from
3017         free list.
3018         (Layout::finish_dynamic_section): For incremental updates, do not
3019         check --as-needed (fixed in subsequent patch).
3020         * layout.h (class Free_list): New class.
3021         (Layout::set_incremental_base): New function.
3022         (Layout::incremental_base): New function.
3023         (Layout::init_fixed_output_section): New function.
3024         (Layout::allocate): New function.
3025         (Layout::incremental_base_): New data member.
3026         (Layout::free_list_): New data member.
3027         * main.cc (main): Print Free_list statistics.
3028         * object.cc (Relobj::finalize_incremental_relocs): Add
3029         clear_counts parameter; clear counts only when clear_counts is set.
3030         (Sized_relobj::Sized_relobj): Initialize new base class.
3031         (Sized_relobj::do_layout): Don't report special sections.
3032         (Sized_relobj::do_for_all_local_got_entries): New function.
3033         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3034         symtab_off to all symbol table offsets.
3035         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3036         * object.h (class Got_offset_list): Move to top of file.
3037         (Object::Object): Allow case where input_file == NULL.
3038         (Object::~Object): Likewise.
3039         (Object::input_file): Assert that input_file != NULL.
3040         (Object::lock): Allow case where input_file == NULL.
3041         (Object::unlock): Likewise.
3042         (Object::is_locked): Likewise.
3043         (Object::token): Likewise.
3044         (Object::release): Likewise.
3045         (Object::is_incremental): New function.
3046         (Object::get_mtime): New function.
3047         (Object::for_all_local_got_entries): New function.
3048         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3049         (Object::set_is_in_system_directory): New function.
3050         (Object::is_in_system_directory): New function.
3051         (Object::do_is_incremental): New function.
3052         (Object::do_get_mtime): New function.
3053         (Object::do_for_all_local_got_entries): New function.
3054         (Object::is_in_system_directory_): New data member.
3055         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3056         (class Sized_relobj_base): New class.
3057         (class Sized_relobj): Derive from Sized_relobj_base.
3058         (class Sized_relobj::Symbols): Redeclare from base class.
3059         (class Sized_relobj::local_got_offset_list): Remove.
3060         (class Sized_relobj::Output_sections): Redeclare from base class.
3061         (class Sized_relobj::do_for_all_local_got_entries): New function.
3062         (class Sized_relobj::write_local_symbols): Add offset parameter.
3063         (class Sized_relobj::local_symbol_offset_): Update comment.
3064         (class Sized_relobj::local_dynsym_offset_): Update comment.
3065         * options.cc (Input_arguments::add_file): Remove const.
3066         * options.h (Input_file_argument::Input_file_argument):
3067         Initialize arg_serial_ (all constructors).
3068         (Input_file_argument::set_arg_serial): New function.
3069         (Input_file_argument::arg_serial): New function.
3070         (Input_file_argument::arg_serial_): New data member.
3071         (Input_arguments::Input_arguments): Initialize file_count_.
3072         (Input_arguments::add_file): Remove const.
3073         (Input_arguments::number_of_input_files): New function.
3074         (Input_arguments::file_count_): New data member.
3075         (Command_line::number_of_input_files): Call
3076         Input_arguments::number_of_input_files.
3077         * output.cc (Output_segment_headers::Output_segment_headers):
3078         Set current size.
3079         (Output_section::Input_section::current_data_size): New function.
3080         (Output_section::Output_section): Initialize new data members.
3081         (Output_section::add_input_section): Don't do merge sections for
3082         an incremental link; allocate space from free list for an
3083         incremental update.
3084         (Output_section::add_output_section_data): Allocate space from
3085         free list for an incremental update.
3086         (Output_section::update_data_size): New function.
3087         (Output_section::set_fixed_layout): New function.
3088         (Output_section::reserve): New function.
3089         (Output_segment::set_section_addresses): Remove const.
3090         (Output_segment::set_section_list_addresses): Remove const; allocate
3091         space from free list for an incremental update.
3092         (Output_segment::set_offset): Adjust size of RELRO segment for an
3093         incremental update.
3094         * output.h (Output_data::current_data_size): Move here from
3095         child classes.
3096         (Output_data::pre_finalize_data_size): New function.
3097         (Output_data::update_data_size): New function.
3098         (Output_section_headers::update_data_size): new function.
3099         (Output_section_data_build::current_data_size): Move to Output_data.
3100         (Output_data_strtab::update_data_size): New function.
3101         (Output_section::current_data_size): Move to Output_data.
3102         (Output_section::set_fixed_layout): New function.
3103         (Output_section::has_fixed_layout): New function.
3104         (Output_section::reserve): New function.
3105         (Output_section::update_data_size): New function.
3106         (Output_section::has_fixed_layout_): New data member.
3107         (Output_section::free_list_): New data member.
3108         (Output_segment::set_section_addresses): Remove const.
3109         (Output_segment::set_section_list_addresses): Remove const.
3110         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3111         New function.
3112         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3113         New function.
3114         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3115         parameter when calling Add_symbols constructor; store argument
3116         serial number for members of a lib group.
3117         (Add_symbols::locks): Allow case where token == NULL.
3118         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3119         (Read_member::~Read_member): New function.
3120         (Read_member::is_runnable): New function.
3121         (Read_member::locks): New function.
3122         (Read_member::run): New function.
3123         (Check_script::~Check_script): New function.
3124         (Check_script::is_runnable): New function.
3125         (Check_script::locks): New function.
3126         (Check_script::run): New function.
3127         (Check_library::~Check_library): New function.
3128         (Check_library::is_runnable): New function.
3129         (Check_library::locks): New function.
3130         (Check_library::run): New function.
3131         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3132         (Add_symbols::library_): New data member.
3133         (class Read_member): New class.
3134         (class Check_script): New class.
3135         (class Check_library): New class.
3136         * reloc.cc (Read_relocs::is_runnable): Allow case where
3137         token == NULL.
3138         (Read_relocs::locks): Likewise.
3139         (Scan_relocs::locks): Likewise.
3140         (Relocate_task::locks): Likewise.
3141         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3142         to clear counters.
3143         (Sized_relobj::incremental_relocs_scan): Fix comment.
3144         (Sized_relobj::do_relocate): Pass output file offset to
3145         write_local_symbols.
3146         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3147         from class declaration.
3148         * script.cc (read_input_script): Allocate Script_info; pass
3149         argument serial number to report_script.
3150         * script.h (class Script_info): Move to incremental.h.
3151         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3152         * symtab.h (Symbol_table::add_from_incrobj): New function.
3153         (Symbol_table::set_file_offset): New function.
3154
3155 2011-04-05  Cary Coutant  <ccoutant@google.com>
3156
3157         * incremental-dump.cc (dump_incremental_inputs): Change signature
3158         to take a Sized_incremental_binary; change caller.  Use readers
3159         in Sized_incremental_binary.
3160         * incremental.cc
3161         (Sized_incremental_binary::find_incremental_inputs_sections):
3162         Rename do_find_incremental_inputs_sections to this.
3163         (Sized_incremental_binary::setup_readers): New function.
3164         (Sized_incremental_binary::do_check_inputs): Check
3165         has_incremental_info_ flag; move setup code to setup_readers;
3166         use input readers.
3167         (Sized_incremental_binary::do_file_is_unchanged): New function.
3168         (Sized_incremental_binary::do_get_input_reader): New function.
3169         * incremental.h (class Incremental_binary): Move to end of file.
3170         (Incremental_binary::file_is_unchanged): New function.
3171         (Incremental_binary::do_file_is_unchanged): New function.
3172         (Incremental_binary::Input_reader): New class.
3173         (Incremental_binary::get_input_reader): New function.
3174         (class Sized_incremental_binary): Move to end of file.
3175         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3176         input section reader classes.
3177         (Sized_incremental_binary::has_incremental_info): New function.
3178         (Sized_incremental_binary::inputs_reader): New function.
3179         (Sized_incremental_binary::symtab_reader): New function.
3180         (Sized_incremental_binary::relocs_reader): New function.
3181         (Sized_incremental_binary::got_plt_reader): New function.
3182         (Sized_incremental_binary::do_file_is_unchanged): New function.
3183         (Sized_incremental_binary::Sized_input_reader): New class.
3184         (Sized_incremental_binary::get_input_reader): New function.
3185         (Sized_incremental_binary::find_incremental_inputs_sections):
3186         Rename do_find_incremental_inputs_sections to this.
3187         (Sized_incremental_binary::setup_readers): New function.
3188         (Sized_incremental_binary::has_incremental_info_): New data member.
3189         (Sized_incremental_binary::inputs_reader_): New data member.
3190         (Sized_incremental_binary::symtab_reader_): New data member.
3191         (Sized_incremental_binary::relocs_reader_): New data member.
3192         (Sized_incremental_binary::got_plt_reader_): New data member.
3193         (Sized_incremental_binary::current_input_file_): New data member.
3194
3195 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3196
3197         PR gold/12640
3198         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3199         violation.
3200
3201 2011-03-30  Cary Coutant  <ccoutant@google.com>
3202
3203         * archive.cc (Archive::include_member): Adjust call to report_object.
3204         (Add_archive_symbols::run): Add script_info to call to
3205         report_archive_begin.
3206         (Lib_group::include_member): Adjust call to report_object.
3207         (Add_lib_group_symbols::run): Adjust call to report_object.
3208         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3209         blocks.  Add object count for script input files.
3210         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3211         script_info parameter; change all callers.
3212         (Incremental_inputs::report_object): Add script_info parameter;
3213         change all callers.
3214         (Incremental_inputs::report_script): Store backpointer to
3215         incremental info entry.
3216         (Output_section_incremental_inputs::set_final_data_size): Record
3217         additional information for scripts.
3218         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3219         * incremental.h (Incremental_script_entry::add_object): New function.
3220         (Incremental_script_entry::get_object_count): New function.
3221         (Incremental_script_entry::get_object): New function.
3222         (Incremental_script_entry::objects_): New data member; adjust
3223         constructor.
3224         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3225         (Incremental_inputs::report_object): Add script_info parameter.
3226         (Incremental_inputs_reader::get_object_count): New function.
3227         (Incremental_inputs_reader::get_object_offset): New function.
3228         * options.cc (Input_arguments::add_file): Return reference to
3229         new input argument.
3230         * options.h (Input_argument::set_script_info): New function.
3231         (Input_argument::script_info): New function.
3232         (Input_argument::script_info_): New data member; adjust all
3233         constructors.
3234         (Input_file_group::add_file): Return reference to new input argument.
3235         (Input_file_lib::add_file): Likewise.
3236         (Input_arguments::add_file): Likewise.
3237         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3238         * script.cc (Parser_closure::Parser_closure): Add script_info
3239         parameter; adjust all callers.
3240         (Parser_closure::script_info): New function.
3241         (Parser_closure::script_info_): New data member.
3242         (read_input_script): Report scripts earlier to incremental info.
3243         (script_add_file): Set script_info in Input_argument.
3244         (script_add_library): Likewise.
3245         * script.h (Script_options::Script_info): Rewrite class.
3246
3247 2011-03-29  Cary Coutant  <ccoutant@google.com>
3248
3249         * archive.cc (Library_base::should_include_member): Move
3250         method here from class Archive.
3251         (Archive::Archive): Initialize base class.
3252         (Archive::should_include_member): Move to base class.
3253         (Archive::do_for_all_unused_symbols): New function.
3254         (Add_archive_symbols::run): Remove redundant access to
3255         incremental_inputs.
3256         (Lib_group::Lib_group): Initialize base class.
3257         (Lib_group::do_filename): New function.
3258         (Lib_group::include_member): Pass pointer to Lib_group to
3259         report_object.
3260         (Lib_group::do_for_all_unused_symbols): New function.
3261         (Add_lib_group_symbols::run): Report archive information for
3262         incremental links.
3263         * archive.h (class Library_base): New base class.
3264         (class Archive): Derive from Library_base.
3265         (Archive::filename): Move to base class.
3266         (Archive::set_incremental_info): Likewise.
3267         (Archive::incremental_info): Likewise.
3268         (Archive::Should_include): Likewise.
3269         (Archive::should_include_member): Likewise.
3270         (Archive::Armap_entry): Remove.
3271         (Archive::Unused_symbol_iterator): Remove.
3272         (Archive::unused_symbols_begin): Remove.
3273         (Archive::unused_symbols_end): Remove.
3274         (Archive::do_filename): New function.
3275         (Archive::do_get_mtime): New function.
3276         (Archive::do_for_all_unused_symbols): New function.
3277         (Archive::task_): Move to base class.
3278         (Archive::incremental_info_): Likewise.
3279         (class Lib_group): Derive from Library_base.
3280         (Lib_group::do_filename): New function.
3281         (Lib_group::do_get_mtime): New function.
3282         (Lib_group::do_for_all_unused_symbols): New function.
3283         (Lib_group::task_): Move to base class.
3284         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3285         function.
3286         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3287         function.
3288         * incremental.cc (Incremental_inputs::report_archive_begin):
3289         Use Library_base; call library's get_mtime; add incremental inputs
3290         entry before members.
3291         (class Unused_symbol_visitor): New class.
3292         (Incremental_inputs::report_archive_end): Use Library_base; use
3293         visitor class to record unused symbols; don't add incremental inputs
3294         entry after members.
3295         (Incremental_inputs::report_object): Use Library_base.
3296         * incremental.h
3297         (Incremental_archive_entry::Incremental_archive_entry): Remove
3298         unused Archive parameter.
3299         (Incremental_inputs::report_archive_begin): Use Library_base.
3300         (Incremental_inputs::report_archive_end): Likewise.
3301         (Incremental_inputs::report_object): Likewise.
3302         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3303         function.
3304         * object.h (Object::for_all_global_symbols): New function.
3305         (Object::do_for_all_global_symbols): New function.
3306         (Sized_relobj::do_for_all_global_symbols): New function.
3307         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3308         function.
3309         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3310         function.
3311
3312 2011-03-27  Ian Lance Taylor  <iant@google.com>
3313
3314         * archive.cc (Archive::interpret_header): Return -1 if something
3315         goes wrong.  Change callers accordingly.
3316
3317 2011-03-25  Cary Coutant  <ccoutant@google.com>
3318
3319         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3320         * testsuite/Makefile.in: Regenerate.
3321
3322 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3323
3324         * plugin.cc (get_view): New.
3325         (Plugin::load): Pass get_view to the plugin.
3326         (Plugin_manager::get_view): New.
3327
3328 2011-03-21  Ian Lance Taylor  <iant@google.com>
3329
3330         * testsuite/final_layout.sh: Rewrite to not use dc.
3331         * testsuite/relro_test.sh: Fail if dc is not present.
3332
3333 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3334
3335         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3336         Change == to -eq.
3337         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3338         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3339         Change == to -eq.
3340         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3341         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3342
3343 2011-03-14  Ian Lance Taylor  <iant@google.com>
3344
3345         * script-sections.cc (Sort_output_sections::script_compare):
3346         Rename from is_before, change return type.
3347         (Sort_output_sections::operator()): Adjust accordingly.
3348
3349 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3350
3351         PR gold/12572
3352         * testsuite/odr_violation2.cc: Add comment to make all error line
3353         numbers double digits.
3354         * testsuite/debug_msg.sh: Adjust expected errors.
3355
3356 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3357
3358         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3359         but mark earlier ones as non-canonical
3360         (offset_to_iterator): Update search target and example
3361         (do_addr2line): Return extra lines in a vector*
3362         (format_file_lineno): Extract from do_addr2line
3363         (one_addr2line): Add vector* out-param
3364         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3365         when a lineno entry appeared last for its instruction
3366         (Dwarf_line_info): Add vector* out-param
3367         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3368         * symtab.cc (Odr_violation_compare): Include the lineno in the
3369         comparison again.
3370         (linenos_from_loc): New. Combine the canonical line for an
3371         address with its other lines.
3372         (True_if_intersect): New. Helper functor to make
3373         std::set_intersection a query.
3374         (detect_odr_violations): Compare sets of lines instead of just
3375         one line for each function. This became less deterministic, but
3376         has fewer false positives.
3377         * symtab.h: Declarations.
3378         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3379         mix an optimized and non-optimized object in the same binary
3380         (odr_violation2.so): Same.
3381         * testsuite/Makefile.in: Regenerate from Makefile.am.
3382         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3383         * testsuite/debug_msg.sh: Update line numbers and add
3384         assertions.
3385         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3386         non-optimized context.
3387         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3388         isn't inlined, and use OdrDerived in an optimized context.
3389         * testsuite/odr_header1.h: Defines OdrDerived, where
3390         optimization will change the
3391         first-instruction-in-the-destructor's file and line number.
3392         * testsuite/odr_header2.h: Defines OdrBase.
3393
3394 2011-03-09  Ian Lance Taylor  <iant@google.com>
3395
3396         * fileread.cc (File_read::clear_views): Don't delete the whole
3397         file view.
3398
3399 2011-03-08  Ian Lance Taylor  <iant@google.com>
3400
3401         PR gold/12525
3402         * fileread.cc: #include <climits>.
3403         (GOLD_IOV_MAX): Define.
3404         (File_read::read_multiple): Limit number of entries by iov_max.
3405         * fileread.h (class File_read): Always set max_readv_entries to
3406         128.
3407
3408 2011-03-07  Ian Lance Taylor  <iant@google.com>
3409
3410         PR gold/12525
3411         * options.h (class General_options): Add -dy and -dn.
3412
3413 2011-03-02  Cary Coutant  <ccoutant@google.com>
3414
3415         * testsuite/script_test_9.t: Add TLS segment.
3416
3417 2011-03-02  Simon Baldwin  <simonb@google.com>
3418
3419         * configure.ac: Add check for gnu_indirect_function support in
3420         the toolchain building binutils.
3421         * configure: Rebuild.
3422
3423 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3424
3425         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3426         plugin only symbols.
3427         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3428         in plugin files as not needed in the symbol table.
3429
3430 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3431
3432         * output.cc (Output_section::add_input_section): Delay fill
3433         generation for section ordering.
3434
3435 2011-02-09  Ian Lance Taylor  <iant@google.com>
3436
3437         PR gold/12316
3438         * object.h (class Sized_relobj): Remove clear_local_symbols.
3439         * reloc.cc (Sized_relobj::do_relocate): Don't call
3440         clear_local_symbols.
3441
3442 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3443
3444         * plugin.cc (is_visible_from_outside): Return true for symbols
3445         in the -u option.
3446
3447 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3448
3449         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3450         filename.
3451
3452 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3453
3454         * icf.h (is_section_foldable_candidate): Change type of parameter
3455         to std::string.
3456         * icf.cc (Icf::find_identical_sections): Change type of local variable
3457         section_name to be std::string.
3458         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3459
3460 2011-01-25  Ian Lance Taylor  <iant@google.com>
3461
3462         * script.cc (script_add_extern): Rewrite to use
3463         add_symbol_reference.
3464
3465 2011-01-25  Doug Kwan  <dougkwan@google.com>
3466
3467         * icf.cc (get_section_contents): Always lock section's object.
3468
3469 2011-01-24  Ian Lance Taylor  <iant@google.com>
3470
3471         * options.h (class General_options): Accept
3472         --no-detect-odr-violations.
3473
3474 2011-01-24  Ian Lance Taylor  <iant@google.com>
3475
3476         * version.cc (version_string): Bump to 1.11.
3477
3478 2011-01-24  Ian Lance Taylor  <iant@google.com>
3479
3480         * plugin.cc (class Plugin_rescan): Define new class.
3481         (Plugin_manager::claim_file): Set any_claimed_.
3482         (Plugin_manager::save_archive): New function.
3483         (Plugin_manager::save_input_group): New function.
3484         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3485         necessary.
3486         (Plugin_manager::new_undefined_symbol): New function.
3487         (Plugin_manager::rescan): New function.
3488         (Plugin_manager::rescannable_defines): New function.
3489         (Plugin_manager::add_input_file): Set any_added_.
3490         * plugin.h (class Plugin_manager): define new fields rescannable_,
3491         undefined_symbols_, any_claimed_, and any_added_.  Declare
3492         Plugin_rescan as friend.  Declare new functions.
3493         (Plugin_manager::Rescannable): Define type.
3494         (Plugin_manager::Rescannable_list): Define type.
3495         (Plugin_manager::Undefined_symbol_list): Define type.
3496         (Plugin_manager::Plugin_manager): Initialize new fields.
3497         * archive.cc (Archive::defines_symbol): New function.
3498         (Add_archive_symbols::run): Pass archive to plugins if any.
3499         * archive.h (class Archive): Declare defines_symbol.
3500         * readsyms.cc (Input_group::~Input_group): New function.
3501         (Finish_group::run): Pass input_group to plugins if any.
3502         * readsyms.h (class Input_group): Declare destructor.
3503         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3504         any.
3505
3506 2011-01-10  Ian Lance Taylor  <iant@google.com>
3507
3508         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3509         section as relro.
3510         (Layout::set_segment_offsets): Reset increase_relro before calling
3511         set_section_addresses a second time.
3512
3513 2011-01-04  Cary Coutant  <ccoutant@google.com>
3514
3515         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3516         sections before NOBITS sections.
3517
3518 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3519
3520         * version.cc (print_version): Update copyright to 2011.
3521
3522 2010-12-23  Cary Coutant  <ccoutant@google.com>
3523
3524         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3525         of OS to this->add.  Add OD parameter to second form of the function.
3526
3527 2010-12-20  Ian Lance Taylor  <iant@google.com>
3528
3529         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3530         second of two consecutive entries with same offset.
3531
3532 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3533
3534         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3535         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3536         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3537         to avoid unneeded links against $(LDADD).
3538         * testsuite/Makefile.in: Regenerate.
3539
3540 2010-12-15  Ian Lance Taylor  <iant@google.com>
3541
3542         PR gold/12324
3543         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3544         for R_X86_64_32 and R_X86_64_PC32.
3545         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3546         ver_matching_def_pic.o.
3547         (ver_matching_def_pic.o): New target.
3548
3549 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3550
3551         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3552         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3553         Move definition before File_read::View member definitions.
3554         (File_read::View::~View): Initialize and hold lock before
3555         updating current_mapped_bytes.
3556
3557 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3558
3559         * dwarf_reader.cc: Remove outdated comment.
3560         * gold-threads.cc: Fix typo in error message.
3561         * archive.cc: Fix typos in comments.
3562         * archive.h: Likewise.
3563         * arm-reloc-property.cc: Likewise.
3564         * arm-reloc-property.h: Likewise.
3565         * arm-reloc.def: Likewise.
3566         * arm.cc: Likewise.
3567         * attributes.h: Likewise.
3568         * cref.cc: Likewise.
3569         * ehframe.cc: Likewise.
3570         * fileread.h: Likewise.
3571         * gold.h: Likewise.
3572         * i386.cc: Likewise.
3573         * icf.cc: Likewise.
3574         * incremental.h: Likewise.
3575         * int_encoding.cc: Likewise.
3576         * layout.h: Likewise.
3577         * main.cc: Likewise.
3578         * merge.h: Likewise.
3579         * object.cc: Likewise.
3580         * object.h: Likewise.
3581         * options.cc: Likewise.
3582         * readsyms.cc: Likewise.
3583         * reduced_debug_output.cc: Likewise.
3584         * reloc.cc: Likewise.
3585         * script-sections.cc: Likewise.
3586         * sparc.cc: Likewise.
3587         * symtab.h: Likewise.
3588         * target-reloc.h: Likewise.
3589         * target.cc: Likewise.
3590         * target.h: Likewise.
3591         * timer.cc: Likewise.
3592         * timer.h: Likewise.
3593         * x86_64.cc: Likewise.
3594
3595 2010-12-09  Cary Coutant  <ccoutant@google.com>
3596
3597         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3598         stack.
3599         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3600         parameter; change all callers.
3601         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3602         * options.h (warn_execstack): New option.
3603
3604 2010-12-07  Doug Kwan  <dougkwan@google.com>
3605
3606         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3607         like function call relocations.
3608
3609 2010-12-07  Ian Lance Taylor  <iant@google.com>
3610
3611         * archive.cc (Archive::get_elf_object_for_member): Permit
3612         punconfigured to be NULL.
3613         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3614         (Archive::include_member): Pass NULL to get_elf_object_for_member
3615         if we searched for the archive and this is the first included
3616         object.
3617
3618 2010-12-01  Ian Lance Taylor  <iant@google.com>
3619
3620         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3621         track_relocs_type_ field.
3622         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3623         Set track_relocs_type_.
3624         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3625         contents when using RELA relocs.
3626         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3627         reloc_map_.
3628         * reloc.cc (Track_relocs::next_addend): New function.
3629         * reloc.h (class Track_relocs): Declare next_addend.
3630
3631 2010-12-01  Ian Lance Taylor  <iant@google.com>
3632
3633         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3634         virtual destructor.
3635
3636 2010-12-01  Ian Lance Taylor  <iant@google.com>
3637
3638         * README: Update compilers known to work and fail.
3639
3640 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3641
3642         * configure.in: For --enable-gold, handle value `default' instead of
3643         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3644         not the default.
3645         * configure: Regenerate.
3646
3647 2010-11-18  Doug Kwan  <dougkwan@google.com>
3648
3649         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3650         and right_alignment to be zero.  Store result alignment only if it is
3651         greater than existing alignment.
3652
3653 2010-11-16  Cary Coutant  <ccoutant@google.com>
3654
3655         PR gold/12220
3656         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3657         Check for ".zdebug_line".
3658
3659 2010-11-16  Doug Kwan  <dougkwan@google.com>
3660             Cary Coutant  <ccoutant@google.com>
3661
3662         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3663         by reference; adjust all callers.
3664         * output.cc (Output_segment::set_section_addresses): Adjust references
3665         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3666         list is empty.
3667         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3668         end at page boundary.
3669
3670 2010-11-16  Cary Coutant  <ccoutant@google.com>
3671
3672         PR gold/12220
3673         * layout.cc (Layout::choose_output_section): Transform names of
3674         compressed sections even when using a script with a SECTIONS clause.
3675         (Layout::output_section_name): Remove code to transform
3676         compressed debug section names.
3677         * output.cc (Output_section::add_input_section): Use uncompressed
3678         section size when tracking input sections.
3679
3680 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3681
3682         * symtab.h (Symbol::NON_PIC_REF): Remove.
3683         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3684         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3685         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3686         (Symbol::use_plt_offset): Take a flags argument and pass it
3687         directly to needs_dynamic_reloc.  Restrict check for undefined
3688         weak symbols to function calls.
3689         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3690         (Target_arm::Scan::global): Use it.
3691         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3692         (Target_arm::Relocate::relocate): Likewise.
3693         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3694         parameter with an r_type parameter.  Use get_reference_flags
3695         to get the flags.
3696         (Target_arm::Relocate::relocate): Update accordingly.
3697         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3698         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3699         (Target_i386::Scan::global): Likewise.
3700         (Target_i386::Relocate::relocate): Likewise.
3701         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3702         parameter with an r_type parameter.  Use get_reference_flags
3703         to get the flags.
3704         (Target_i386::Relocate::relocate): Update accordingly.
3705         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3706         (Target_powerpc::Scan::global): Use it.
3707         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3708         (Target_powerpc::Relocate::relocate): Likewise.
3709         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3710         (Target_sparc::Scan::global): Use it.
3711         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3712         (Target_sparc::Relocate::relocate): Likewise.
3713         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3714         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3715         (Target_x86_64::Scan::global): Likewise.
3716         (Target_x86_64::Relocate::relocate): Likewise.
3717
3718 2010-11-08  Doug Kwan  <dougkwan@google.com>
3719             Cary Coutant  <ccoutant@google.com>
3720
3721         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3722         (Arm_exidx_merge_section::section_contents_): New data member.
3723         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3724         (Arm_input_section::~Arm_input_section): De-allocate memory.
3725         (Arm_input_section::original_contents_): New data member.
3726         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3727         in parameters instead of calling Object::section_contents without
3728         locking.
3729         (Arm_output_section::group_section): New parameter TASK.  Pass it
3730         to callees that need locking objects.
3731         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3732         to lock EXIDX input sections.  Fix a formatting issue.  Call
3733         Arm_exidx_merged_section::build_contents to create merged section
3734         contents.
3735         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3736         to lock object of stub table owner.
3737         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3738         TEXT_SIZE to initialize data member TEXT_SIZE_.
3739         (Arm_exidx_input_section::addralign): Fix typo in comment.
3740         (Arm_exidx_input_section::text_size): New method.
3741         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3742         that require locking objects.  Lock objects before scanning for stubs
3743         and updating local symbols.
3744         (Arm_input_section<big_endian>::init): Copy contents of original
3745         input section.
3746         (Arm_input_section<big_endian>::do_write): Use saved contents of
3747         original input section instead of calling Object::section_contents
3748         without locking.
3749         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3750         size without calling Object::section_size().
3751         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3752         for size.  Allocate a buffer for merged EXIDX entries.
3753         (Arm_exidx_merged_section::build_contents): New method.
3754         (Arm_exidx_merged_section::do_write): Move merge section contents
3755         building code to Arm_exidx_merged_section::build_contetns.  Write
3756         out contetns in buffer instead of building it on the fly.
3757         (Arm_relobj::make_exidx_input_section): Also pass text section size
3758         to Arm_exidx_input_section constructor.
3759         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3760         (Arm_dynobj::do_read_symbols): Fix memory leak.
3761         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3762         * target.h: (class Task): Add forward declaration.
3763         (Target::relax): Add new parameter TASK and pass it to
3764         Target::do_relax().
3765         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3766
3767 2010-11-05  Cary Coutant  <ccoutant@google.com>
3768
3769         PR gold/10708
3770         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3771         object when reading from the file.
3772         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3773         second layout pass.
3774         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3775         when reading section contents.
3776         (get_section_contents): Likewise.
3777         (icf::find_identical_sections): Likewise.
3778         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3779         object when reading from the file.
3780         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3781         the object when doing deferred section layout.
3782
3783 2010-11-03  Nick Clifton  <nickc@redhat.com>
3784
3785         PR gold/12001
3786         * script.h (class Symbol_assignment: name): New member.  Returns
3787         the name of the symbol.
3788         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3789         Returns true if the given symbol name is on the list of
3790         assignments wating to be processed.
3791         * archive.cc (should_incldue_member): If the symbol is undefined,
3792         check to see if it is on the list of symbols pending assignment.
3793
3794 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
3795
3796         * script-sections.cc (Script_sections::find_memory_region): Check
3797         for a NULL output section pointer.
3798
3799 2010-10-29  Doug Kwan  <dougkwan@google.com>
3800
3801         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
3802         Output_section::add_relaxed_input_section.
3803         * output.cc (Output_section::add_relaxed_input_section): Add new
3804         arguments LAYOUT and NAME.  Set section order index.
3805         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
3806         Copy section order index.
3807         * output.h (Output_section::add_relaxed_input_section): Add new
3808         arguments LAYOUT and NAME.
3809
3810 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3811
3812         * testsuite/Makefile.am: Move gcctestdir/ld rule to
3813         NATIVE_OR_CROSS_LINKER.
3814         * testsuite/Makefile.in: Regenerate.
3815
3816 2010-10-20  Doug Kwan  <dougkwan@google.com>
3817
3818         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
3819         without SHF_LINK_ORDER flags.
3820         * layout.cc (Layout::choose_output_section): Do not filter
3821         SHF_LINK_ORDER flag in a relocatable link.
3822
3823 2010-10-17  Cary Coutant  <ccoutant@google.com>
3824
3825         * output.h (Output_segment::set_section_addresses): Change function
3826         signature.  Update all callers.
3827         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
3828         sections.
3829         (Output_segment::set_section_addresses): Align after last TLS
3830         section.  Add padding before last relro section instead of after.
3831
3832 2010-10-17  Doug Kwan  <dougkwan@google.com>
3833
3834         * gold/arm.cc (Target_arm::got_section): Use correct order and set
3835         GOT output section to be writable.
3836
3837 2010-10-14  Cary Coutant  <ccoutant@google.com>
3838
3839         * debug.h (DEBUG_INCREMENTAL): New flag.
3840         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
3841         * gold.cc (queue_initial_tasks): Check parameters for incremental link
3842         mode.
3843         * incremental.cc (report_command_line): Ignore all forms of
3844         --incremental.
3845         * layout.cc (Layout::Layout): Check parameters for incremental link
3846         mode.
3847         * options.cc (General_options::parse_incremental): New function.
3848         (General_options::parse_no_incremental): New function.
3849         (General_options::parse_incremental_full): New function.
3850         (General_options::parse_incremental_update): New function.
3851         (General_options::incremental_mode_): New data member.
3852         (General_options::finalize): Check incremental_mode_.
3853         * options.h (General_options): Update help text for --incremental.
3854         Add --no-incremental, --incremental-full, --incremental-update.
3855         (General_options::Incremental_mode): New enum type.
3856         (General_options::incremental_mode): New function.
3857         (General_options::incremental_mode_): New data member.
3858         * parameters.cc (Parameters::incremental_mode_): New data member.
3859         (Parameters::set_options): Set incremental_mode_.
3860         (Parameters::set_incremental_full): New function.
3861         (Parameters::incremental): New function.
3862         (Parameters::incremental_update): New function.
3863         (set_parameters_incremental_full): New function.
3864         * parameters.h (Parameters::set_incremental_full): New function.
3865         (Parameters::incremental): New function.
3866         (Parameters::incremental_update): New function.
3867         (Parameters::incremental_mode_): New data member.
3868         (set_parameters_incremental_full): New function.
3869         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
3870         incremental link mode.
3871         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
3872         (Sized_relobj::do_relocate_sections): Likewise.
3873         * testsuite/Makefile.am (incremental_test): Use --incremental-full
3874         option.
3875         * testsuite/Makefile.in: Regenerate.
3876         * testsuite/incremental_test.sh: Filter all forms of --incremental.
3877
3878 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3879
3880         * script-sections.h (class Script_sections): Make
3881         Sections_elements typedef public.
3882         * script-sections.cc (class Sort_output_sections): Add elements_
3883         field.  Add constructor which sets it; change all callers.
3884         (Sort_output_sections::is_before): New function.
3885         (Sort_output_sections::operator()): Call is_before.
3886         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
3887         conditional.
3888         * testsuite/script_test_10.sh: New test. Test script section
3889         order.
3890         * testsuite/script_test_10.t: Likewise.
3891         * testsuite/script_test_10.s: Likewise.
3892         * testsuite/Makefile.am: Wrap the cross linker tests and the
3893         common tests into NATIVE_OR_CROSS_LINKER.
3894         (check_SCRIPTS): Add script_test_10.sh.
3895         (check_DATA): Add script_test_10.stdout.
3896         (script_test_10.o, script_test_10): New targets.
3897         (script_test_10.stdout): New target.
3898         * configure, testsuite/Makefile.in: Regenerate.
3899
3900 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3901
3902         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
3903         error for the deprecated relocations.
3904         (Target_arm::Scan::global): Likewise.
3905         (Target_arm::Relocate::relocate): Likewise.
3906
3907 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
3908
3909         * fileread.cc (Input_file::find_file): Initialize *found_name
3910         and *namep when using the fallback search for case 4.
3911
3912 2010-10-11  Cary Coutant  <ccoutant@google.com>
3913
3914         * options.h (class General_options): Redefine -z lazy as an alias for
3915         the negation of -z now.
3916
3917 2010-10-11  Ian Lance Taylor  <iant@google.com>
3918
3919         * resolve.cc (symbol_to_bits): Report the value of the unsupported
3920         binding.
3921
3922 2010-10-06  Nick Clifton  <nickc@redhat.com>
3923
3924         * script-sections.cc(class Memory_region): Remove
3925         current_lma_offset_ field.  Rename current_vma_offset_ to
3926         current_offset_.  Add last_section_ field.
3927         (Memory_region::get_current_vma_address): Rename to
3928         get_current_address.
3929         (Memory_region::get_current_lma_address): Delete.
3930         (Memory_region::increment_vma_offset): Rename to
3931         increment_offset.
3932         (Memory_region::increment_lma_offset): Delete.
3933         (Memory_region::attributes_compatible): New method.  Returns
3934         true if the provided section is compatible with the region.
3935         (Memory_region::get_last_section): New method.  Returns the last
3936         section to use the region.
3937         (Memory_region::set_last_section): New method.  Stores the last
3938         section to use the region.
3939         (Script_sections::block_in_region): New method.  Returns true if
3940         a block of memory is contained within a region.
3941         (Script_sections::find_memory_region): New method.  Locates a
3942         memory region to be used to set a VMA or LMA address.
3943         (Output_section_definition::set_section_addresses): Add code to
3944         check for addresses set by memory regions.
3945         (Output_segment::set_section_addresses): Remove memory region
3946         walking code.
3947         (Script_sections::create_segment): Add a warning if a header
3948         segment is created outside of any region.
3949         * script-sections.h (class Script_sections): Add prototypes for
3950         find_memory_region and block_in_region methods.
3951         * testsuite/memory_test.s: Use .long instead of .word.
3952         * testsuite/memory_test.t: Add some more output sections.
3953         * testsuite/memory_test.sh: Update expected output.
3954
3955 2010-10-02  Doug Kwan  <dougkwan@google.com>
3956
3957         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
3958         defintion to symtab.h
3959         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
3960         declaration to defintion.
3961
3962 2010-10-01  Nick Clifton  <nickc@redhat.com>
3963
3964         * expression.cc (eval): Replace dummy argument with NULL.
3965         (eval_maybe_dot): Check for a NULL result section pointer.
3966         (Symbol_expression::value): Likewise.
3967         (Dot_expression::value): Likewise.
3968         (BINARY_EXPRESSION): Likewise.
3969         (Max_expression::value): Likewise.
3970         (Min_expression::value): Likewise.
3971         (Absolute_expression::value): Likewise.
3972         (Addr_expression::value_from_output_section): Likewise.
3973         (Loaddddr_expression::value_from_output_section): Likewise.
3974         (Segment_start_expression::value): Likewise.
3975         * script-sections.cc
3976         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
3977         argument with NULL.
3978         (Sections_elememt_dot_assignment::set_section_addresses):
3979         Likewise.
3980         (Output_data_expression::do_write_to_buffer): Likewise.
3981         (Output_section_definition::finalize_symbols): Likewise.
3982         (Output_section_definition::set_section_addresses): Likewise.
3983
3984 2010-09-30  Doug Kwan  <dougkwan@google.com>
3985
3986         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
3987
3988 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
3989
3990         * target.h (Target::can_icf_inline_merge_sections): New virtual
3991         function.
3992         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
3993         virtual function.
3994         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
3995         virtual function.
3996         * icf.cc (get_section_contents): Inline merge sections only when
3997         target allows it.
3998
3999 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4000
4001         * configure: Regenerate.
4002
4003 2010-09-17  Ian Lance Taylor  <iant@google.com>
4004
4005         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4006         * testsuite/Makefile.am (memory_test.o): New target.
4007         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4008         memory_test.t.
4009         * testsuite/Makefile.in: Rebuild.
4010
4011 2010-09-17  Doug Kwan  <dougkwan@google.com>
4012
4013         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4014         defintion if relocation uses GOT entries of the symbol.
4015         * testsuite/icf_safe_test.sh: Fix test.
4016         * testsuite/icf_safe_so_test.sh: Fix test.
4017
4018 2010-09-16  Cary Coutant  <ccoutant@google.com>
4019
4020         * script_sections.cc (class Memory_region): Remove "NULL" from
4021         vector initializations.
4022
4023 2010-09-15  Cary Coutant  <ccoutant@google.com>
4024
4025         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4026         Resolve forwarding symbols.
4027
4028 2010-09-15  Doug Kwan  <dougkwan@google.com>
4029
4030         * gold/testsuite/script_test_3.t: Add ARM special sections.
4031         * gold/testsuite/script_test_4.t: Same.
4032         * gold/testsuite/script_test_5.t: Same.
4033         * gold/testsuite/script_test_6.t: Same.
4034         * gold/testsuite/script_test_7.t: Same.
4035         * gold/testsuite/script_test_7.t: Same.
4036         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4037
4038 2010-09-14  Cary Coutant  <ccoutant@google.com>
4039
4040         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4041         (Target_x86_64::Relocate::relocate_tls): Replace check for
4042         saw_tls_block_reloc_ with test for executable section.
4043
4044 2010-09-12  Cary Coutant  <ccoutant@google.com>
4045
4046         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4047         position-independent executables to shared libraries need dynamic
4048         relocations.
4049         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4050         position-independent executables.
4051         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4052         * testsuite/Makefile.in: Regenerate.
4053
4054 2010-09-10  Nick Clifton  <nickc@redhat.com>
4055
4056         PR gold/11997
4057         * testsuite/memory_test.t: Discard any sections that are not
4058         needed.
4059
4060 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4061
4062         PR gold/11996
4063         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4064         "This::" to work around a bug in gcc 4.2.
4065
4066         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4067
4068 2010-09-09  Rafael Espindola  <espindola@google.com>
4069
4070         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4071         sections with different PF_X flags in the same segment.
4072         (Layout::find_first_load_seg): Search all segments to find the first
4073         one.
4074         * options.h (rosegment): New.
4075
4076 2010-09-08  Rafael Espindola  <espindola@google.com>
4077
4078         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4079
4080 2010-09-08  Doug Kwan  <dougkwan@google.com>
4081
4082         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4083         (Arm_relobj::do_relocate_sections): Add new parameter for output
4084         file to match the parent.
4085         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4086         of local symbols instead of input values.  Update code to track
4087         changes in gold::relocate_section.
4088         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4089         (Sized_relobj::compute_final_local_value_internal): New methods.
4090         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4091         body into private version of Sized_relobj::compute_final_local_value.
4092         Call the inline method.
4093         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4094         merged symbol value if there is one.
4095         (Symbol_value::has_output_value): New method defintiion.
4096         (Sized_relobj::Compute_final_local_value_status): New enum type.
4097         (Sized_relobj::compute_final_local_value): New methods.
4098         (Sized_relobj::compute_final_local_value_internal): New methods.
4099         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4100         and arm_cortex_a8.sh.
4101         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4102         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4103         New tests.
4104         * Makefile.in: Regenerate.
4105         * testsuite/arm_bl_out_of_range.s: Update test.
4106         * testsuite/thumb_bl_out_of_range.s: Ditto.
4107         * testsuite/thumb_blx_out_of_range.s: Ditto.
4108         * testsuite/arm_branch_out_of_range.sh: New file.
4109         * testsuite/arm_cortex_a8.sh: Ditto.
4110         * testsuite/arm_cortex_a8_b.s: Ditto.
4111         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4112         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4113         * testsuite/arm_cortex_a8_bl.s: Ditto.
4114         * testsuite/arm_cortex_a8_blx.s: Ditto.
4115         * testsuite/arm_cortex_a8_local.s: Ditto.
4116         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4117         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4118
4119 2010-09-08  Rafael Espindola  <espindola@google.com>
4120
4121         * Makefile.am (memory_test.stdout): Run readelf with -W.
4122         * Makefile.in: Regenerate.
4123         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4124         64 bit output.
4125
4126 2010-09-08  Rafael Espindola  <espindola@google.com>
4127
4128         * script-sections.cc (Script_sections::add_memory_region): Convert
4129         field precision to int.
4130         * script.cc (script_set_section_region, script_set_section_region):
4131         Convert field precision to int.
4132
4133 2010-09-08  Rafael Espindola  <espindola@google.com>
4134
4135         * arm.cc (do_finalize_sections): Create the __exidx_start and
4136         __exdix_end symbols even when the section is missing.
4137
4138 2010-09-08  Nick Clifton  <nickc@redhat.com>
4139
4140         * README: Remove claim that MEMORY is not supported.
4141         * expression.cc (script_exp_function_origin)
4142         (script_exp_function_length): Move from here to ...
4143         * script.cc: ... here.
4144         (script_set_section_region, script_add_memory)
4145         (script_parse_memory_attr, script_include_directive): New
4146         functions.
4147         * script-sections.cc
4148         (class Memory_region): New class.
4149         (class Output_section_definition): Add set_memory_region,
4150         set_section_vma, set_section_lma and get_section_name methods.
4151         (class Script_Sections): Add add_memory_region,
4152         find_memory_region, find_memory_region_origin,
4153         find_memory_region_length and set_memory_region methods.
4154         Have set_section_addresses method walk the list of set memory
4155         regions.
4156         Extend the print methos to display memory regions.
4157         * script-sections.h: Add prototypes for new methods.
4158         Add enum for MEMORY region attributes.
4159         * yyscript.y: Add support for parsing MEMORY regions.
4160         * script-c.h: Add prototypes for new functions.
4161         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4162         * testsuite/Makefile.in: Regenerate.
4163         * testsuite/memory_test.sh: New script.
4164         * testsuite/memory_test.s: New assembler source file.
4165         * testsuite/memory_test.t: New linker script.
4166
4167 2010-08-27  Doug Kwan  <dougkwan@google.com>
4168
4169         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4170         reference override an existing dynamic weak reference.
4171         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4172         * testsuite/Makefile.in: Regenerate.
4173         * testsuite/dyn_weak_ref.sh: New file.
4174         * testsuite/dyn_weak_ref_1.c: Ditto.
4175         * testsuite/dyn_weak_ref_2.c: Ditto.
4176
4177 2010-08-27  Ian Lance Taylor  <iant@google.com>
4178
4179         * incremental.h (class Incremental_input_entry): Add virtual
4180         destructor.
4181
4182 2010-08-27  Ian Lance Taylor  <iant@google.com>
4183
4184         * testsuite/start_lib_test_3.c: Mark t3 as used.
4185
4186 2010-08-27  Nick Clifton  <nickc@redhat.com>
4187
4188         * options.cc (version_script): Fix small typo in previous
4189         whitespace tidyup.
4190
4191 2010-08-25  Nick Clifton  <nickc@redhat.com>
4192
4193         * archive.cc: Formatting fixes: Remove whitespace between
4194         typename and following asterisk.  Remove whitespace between
4195         function name and opening parenthesis.
4196         * archive.h: Likewise.
4197         * arm.cc: Likewise.
4198         * attributes.cc: Likewise.
4199         * attributes.h: Likewise.
4200         * common.cc: Likewise.
4201         * copy-relocs.cc: Likewise.
4202         * dirsearch.h: Likewise.
4203         * dynobj.cc: Likewise.
4204         * ehframe.cc: Likewise.
4205         * ehframe.h: Likewise.
4206         * expression.cc: Likewise.
4207         * fileread.cc: Likewise.
4208         * fileread.h: Likewise.
4209         * gc.h: Likewise.
4210         * gold-threads.cc: Likewise.
4211         * gold.cc: Likewise.
4212         * i386.cc: Likewise.
4213         * icf.h: Likewise.
4214         * incremental-dump.cc: Likewise.
4215         * incremental.cc: Likewise.
4216         * layout.cc: Likewise.
4217         * layout.h: Likewise.
4218         * main.cc: Likewise.
4219         * merge.cc: Likewise.
4220         * merge.h: Likewise.
4221         * object.cc: Likewise.
4222         * object.h: Likewise.
4223         * options.cc: Likewise.
4224         * options.h: Likewise.
4225         * output.cc: Likewise.
4226         * output.h: Likewise.
4227         * plugin.cc: Likewise.
4228         * plugin.h: Likewise.
4229         * powerpc.cc: Likewise.
4230         * reloc.cc: Likewise.
4231         * script-c.h: Likewise.
4232         * script-sections.cc: Likewise.
4233         * script.cc: Likewise.
4234         * stringpool.cc: Likewise.
4235         * symtab.cc: Likewise.
4236         * symtab.h: Likewise.
4237         * target.cc: Likewise.
4238         * timer.cc: Likewise.
4239         * timer.h: Likewise.
4240         * version.cc: Likewise.
4241         * x86_64.cc: Likewise.
4242
4243 2010-08-24  Nick Clifton  <nickc@redhat.com>
4244
4245         PR 11899
4246         * layout.cc (segment_precedes): Sort segments by their physical
4247         addresses, if they have been set.
4248
4249 2010-08-23  Cary Coutant  <ccoutant@google.com>
4250
4251         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4252         symbols data.
4253         (Lib_group::include_member): Unlock object after deleting its
4254         symbols data.
4255         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4256         the bug fixed here.
4257
4258 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4259             Cary Coutant  <ccoutant@google.com>
4260
4261         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4262         constructor, and set_blocker.
4263         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4264         readsyms_blocker_.
4265         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4266         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4267         * testsuite/Makefile.am (start_lib_test): New test case.
4268         * testsuite/Makefile.in: Regenerate.
4269         * testsuite/start_lib_test_main.c: New file.
4270         * testsuite/start_lib_test_1.c: New file.
4271         * testsuite/start_lib_test_2.c: New file.
4272         * testsuite/start_lib_test_3.c: New file.
4273
4274 2010-08-19  Ian Lance Taylor  <iant@google.com>
4275
4276         * Makefile.in: Rebuild with automake 1.11.1.
4277         * aclocal.m4: Likewise.
4278         * testsuite/Makefile.in: Likewise.
4279
4280 2010-08-19  Ian Lance Taylor  <iant@google.com>
4281
4282         PR 10893
4283         * i386.cc (class Output_data_plt_i386): Update declarations.
4284         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4285         local_ifuncs_ fields.
4286         (Target_i386::do_plt_section_for_global): New function.
4287         (Target_i386::do_plt_section_for_local): New function.
4288         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4289         parameter; change all callers.  Initialize global_ifuncs_ and
4290         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4291         __rel_iplt_end.
4292         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4293         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4294         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4295         symbols.
4296         (Target_i386::make_plt_section): New function, broken out of
4297         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4298         (Target_i386::make_plt_entry): Call make_plt_section.
4299         (Target_i386::make_local_ifunc_plt_entry): New function.
4300         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4301         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4302         R_386_IRELATIVE to switch.
4303         (Target_i386::Scan::global): Likewise.
4304         (Target_i386::Relocate::relocate): Likewise.
4305         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4306         switch.
4307         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4308         (Target_x86_64::do_plt_section_for_global): New function.
4309         (Target_x86_64::do_plt_section_for_local): New function.
4310         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4311         parameter; change all callers.  If doing a static link define
4312         __rela_iplt_start and __rela_iplt_end.
4313         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4314         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4315         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4316         to point to .plt.
4317         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4318         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4319         switch.
4320         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4321         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4322         R_X86_64_IRELATIVE to switch.
4323         (Target_x86_64::Scan::global): Likewise.
4324         (Target_x86_64::Relocate::relocate): Likewise.
4325         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4326         switch.
4327         * target.h (class Target): Add plt_section_for_global and
4328         plt_section_for_local functions.  Add do_plt_section_for_global
4329         and do_plt_section_for_local virtual functions.
4330         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4331         clarifying comments.
4332         (Symbol::use_plt_offset): Handle IFUNC symbol.
4333         * object.cc (Sized_relobj::Sized_relobj): Initialize
4334         local_plt_offsets_.
4335         (Sized_relobj::local_has_plt_offset): New function.
4336         (Sized_relobj::local_plt_offset): New function.
4337         (Sized_relobj::set_local_plt_offset): New function.
4338         (Sized_relobj::do_count): Handle IFUNC symbol.
4339         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4340         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4341         is_ifunc_symbol functions.
4342         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4343         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4344         local_plt_offsets_ field.
4345         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4346         * output.h (class Output_section_data): Add non-const
4347         output_section function.
4348         (class Output_data_got): Update declarations.
4349         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4350         Add use_plt_offset parameter to global and local constructors.
4351         Change all callers.  Change local_sym_index_ field to 31 bits.
4352         Change GSYM_CODE and CONSTANT_CODE accordingly.
4353         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4354         doing a static link don't set sh_link field.
4355         (Output_data_got::Got_entry::write): Use PLT offset if
4356         appropriate.
4357         (Output_data_got::add_global_plt): New function.
4358         (Output_data_got::add_local_plt): New function.
4359         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4360         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4361         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4362         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4363         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4364         IFUNC conditional.
4365         * testsuite/ifunc-sel.h: New file.
4366         * testsuite/ifuncmain1.c: New file.
4367         * testsuite/ifuncmain1vis.c: New file.
4368         * testsuite/ifuncmod1.c: New file.
4369         * testsuite/ifuncdep2.c: New file.
4370         * testsuite/ifuncmain2.c: New file.
4371         * testsuite/ifuncmain3.c: New file.
4372         * testsuite/ifuncmod3.c: New file.
4373         * testsuite/ifuncmain4.c: New file.
4374         * testsuite/ifuncmain5.c: New file.
4375         * testsuite/ifuncmod5.c: New file.
4376         * testsuite/ifuncmain6pie.c: New file.
4377         * testsuite/ifuncmod6.c: New file.
4378         * testsuite/ifuncmain7.c: New file.
4379         * configure, testsuite/Makefile.in: Rebuild.
4380
4381 2010-08-18  Ian Lance Taylor  <iant@google.com>
4382
4383         * incremental.cc
4384         (Output_section_incremental_inputs::write_input_files): Add cast
4385         to avoid signed/unsigned comparison warning.
4386         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4387
4388 2010-08-12  Cary Coutant  <ccoutant@google.com>
4389
4390         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4391
4392 2010-08-13  Ian Lance Taylor  <iant@google.com>
4393
4394         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4395
4396 2010-08-12  Cary Coutant  <ccoutant@google.com>
4397             Doug Kwan  <dougkwan@google.com>
4398
4399         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4400         defintion overrides non-weak undef, remember that the original undef
4401         is not weak.
4402         * symtab.cc (Symbol_table::sized_write_global): For undef without
4403         an original weak binding, set binding to global in output.
4404         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4405         * testsuite/Makefile.in: Regenerate.
4406         * testsuite/strong_ref_weak_def.sh: New file.
4407         * testsuite/strong_ref_weak_def_1.c: Ditto.
4408         * testsuite/strong_ref_weak_def_2.c: Ditto.
4409
4410 2010-08-12  Cary Coutant  <ccoutant@google.com>
4411
4412         * testsuite/incremental_test.sh: Rewrite.
4413         * testsuite/incremental_test_1.c: Rewrite.
4414         * testsuite/incremental_test_2.c: Rewrite.
4415
4416 2010-08-12  Cary Coutant  <ccoutant@google.com>
4417
4418         * arm.cc (Target_arm::got_size): Add const.
4419         (Target_arm::got_entry_count): New function.
4420         (Target_arm::plt_entry_count): New function.
4421         (Target_arm::first_plt_entry_offset): New function.
4422         (Target_arm::plt_entry_size): New function.
4423         (Output_data_plt_arm::entry_count): New function.
4424         (Output_data_plt_arm::first_plt_entry_offset): New function.
4425         (Output_data_plt_arm::get_plt_entry_size): New function.
4426         * i386.cc (Target_i386::got_size): Add const.
4427         (Target_i386::got_entry_count): New function.
4428         (Target_i386::plt_entry_count): New function.
4429         (Target_i386::first_plt_entry_offset): New function.
4430         (Target_i386::plt_entry_size): New function.
4431         (Output_data_plt_i386::entry_count): New function.
4432         (Output_data_plt_i386::first_plt_entry_offset): New function.
4433         (Output_data_plt_i386::get_plt_entry_size): New function.
4434         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4435         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4436         * incremental.cc: Include target.h.
4437         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4438         parameter.  Adjust all callers.  Find incremental_got_plt section.
4439         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4440         section.
4441         (Output_section_incremental_inputs::set_final_data_size): Calculate
4442         size of incremental_got_plt section.
4443         (Output_section_incremental_inputs::do_write): Write the
4444         incremental_got_plt section.
4445         (Got_plt_view_info): New struct.
4446         (Local_got_offset_visitor): New class.
4447         (Global_got_offset_visitor): New class.
4448         (Global_symbol_visitor_got_plt): New class.
4449         (Output_section_incremental_inputs::write_got_plt): New function.
4450         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4451         Add parameter.  Adjust all callers.
4452         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4453         (Incremental_inputs::got_plt_section): New function.
4454         (Incremental_inputs::got_plt_section_): New data member.
4455         (Incremental_got_plt_reader): New class.
4456         * layout.cc (Layout::create_incremental_info_sections): Add the
4457         incremental_got_plt section.
4458         * object.h (Got_offset_list::get_list): New function.
4459         (Got offset_list::for_all_got_offsets): New function.
4460         (Sized_relobj::local_got_offset_list): New function.
4461         * powerpc.cc (Target_powerpc::got_size): Add const.
4462         (Target_powerpc::got_entry_count): New function.
4463         (Target_powerpc::plt_entry_count): New function.
4464         (Target_powerpc::first_plt_entry_offset): New function.
4465         (Target_powerpc::plt_entry_size): New function.
4466         (Output_data_plt_powerpc::entry_count): New function.
4467         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4468         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4469         * sparc.cc (Target_sparc::got_size): Add const.
4470         (Target_sparc::got_entry_count): New function.
4471         (Target_sparc::plt_entry_count): New function.
4472         (Target_sparc::first_plt_entry_offset): New function.
4473         (Target_sparc::plt_entry_size): New function.
4474         (Output_data_plt_sparc::entry_count): New function.
4475         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4476         (Output_data_plt_sparc::get_plt_entry_size): New function.
4477         * symtab.h (Symbol::got_offset_list): New function.
4478         (Symbol_table::for_all_symbols): New function.
4479         * target.h (Sized_target::got_entry_count): New function.
4480         (Sized_target::plt_entry_count): New function.
4481         (Sized_target::plt_entry_size): New function.
4482         * x86_64.cc (Target_x86_64::got_size): Add const.
4483         (Target_x86_64::got_entry_count): New function.
4484         (Target_x86_64::plt_entry_count): New function.
4485         (Target_x86_64::first_plt_entry_offset): New function.
4486         (Target_x86_64::plt_entry_size): New function.
4487         (Output_data_plt_x86_64::entry_count): New function.
4488         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4489         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4490
4491 2010-08-12  Cary Coutant  <ccoutant@google.com>
4492
4493         * archive.cc: Include incremental.h.
4494         (Archive::Archive): Initialize incremental_info_.
4495         (Archive::include_member): Record archive members in incremental info.
4496         (Add_archive_symbols::run): Record begin and end of an archive in
4497         incremental info.
4498         (Lib_group::include_member): Record objects in incremental info.
4499         * archive.h (Incremental_archive_entry): Forward declaration.
4500         (Archive::set_incremental_info): New member function.
4501         (Archive::incremental_info): New member function.
4502         (Archive::Unused_symbol_iterator): New class.
4503         (Archive::unused_symbols_begin): New member function.
4504         (Archive::unused_symbols_end): New member function.
4505         (Archive::incremental_info_): New data member.
4506         * incremental-dump.cc (find_input_containing_global): New function.
4507         (dump_incremental_inputs): Dump new incremental info sections.
4508         * incremental.cc: Include symtab.h.
4509         (Output_section_incremental_inputs): New class.
4510         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4511         new incremental info sections.
4512         (Sized_incremental_binary::do_check_inputs): Likewise.
4513         (Incremental_inputs::report_archive): Remove.
4514         (Incremental_inputs::report_archive_begin): New function.
4515         (Incremental_inputs::report_archive_end): New function.
4516         (Incremental_inputs::report_object): New function.
4517         (Incremental_inputs::finalize_inputs): Remove.
4518         (Incremental_inputs::report_input_section): New function.
4519         (Incremental_inputs::report_script): Rewrite.
4520         (Incremental_inputs::finalize): Do nothing but finalize string table.
4521         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4522         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4523         (Incremental_inputs::create_data_sections): New function.
4524         (Incremental_inputs::relocs_entsize): New function.
4525         (Output_section_incremental_inputs::set_final_data_size): New function.
4526         (Output_section_incremental_inputs::do_write): New function.
4527         (Output_section_incremental_inputs::write_header): New function.
4528         (Output_section_incremental_inputs::write_input_files): New function.
4529         (Output_section_incremental_inputs::write_info_blocks): New function.
4530         (Output_section_incremental_inputs::write_symtab): New function.
4531         * incremental.h (Incremental_script_entry): Forward declaration.
4532         (Incremental_object_entry): Forward declaration.
4533         (Incremental_archive_entry): Forward declaration.
4534         (Incremental_inputs): Forward declaration.
4535         (Incremental_inputs_header_data): Remove.
4536         (Incremental_inputs_header): Remove.
4537         (Incremental_inputs_header_write): Remove.
4538         (Incremental_inputs_entry_data): Remove.
4539         (Incremental_inputs_entry): Remove.
4540         (Incremental_inputs_entry_write): Remove.
4541         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4542         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4543         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4544         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4545         Likewise.
4546         (Incremental_input_entry): New class.
4547         (Incremental_script_entry): New class.
4548         (Incremental_object_entry): New class.
4549         (Incremental_archive_entry): New class.
4550         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4551         (Incremental_inputs::report_inputs): Remove.
4552         (Incremental_inputs::report_archive): Remove.
4553         (Incremental_inputs::report_archive_begin): New function.
4554         (Incremental_inputs::report_archive_end): New function.
4555         (Incremental_inputs::report_object): Change prototype.
4556         (Incremental_inputs::report_input_section): New function.
4557         (Incremental_inputs::report_script): Change prototype.
4558         (Incremental_inputs::get_reloc_count): New function.
4559         (Incremental_inputs::set_reloc_count): New function.
4560         (Incremental_inputs::create_data_sections): New function.
4561         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4562         (Incremental_inputs::inputs_section): New function.
4563         (Incremental_inputs::symtab_section): New function.
4564         (Incremental_inputs::relocs_section): New function.
4565         (Incremental_inputs::get_stringpool): Add const.
4566         (Incremental_inputs::command_line): Add const.
4567         (Incremental_inputs::inputs): Remove.
4568         (Incremental_inputs::command_line_key): New function.
4569         (Incremental_inputs::input_file_count): New function.
4570         (Incremental_inputs::input_files): New function.
4571         (Incremental_inputs::relocs_entsize): New function.
4572         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4573         (Incremental_inputs::finalize_inputs): Remove.
4574         (Incremental_inputs::Input_info): Remove.
4575         (Incremental_inputs::lock_): Remove.
4576         (Incremental_inputs::inputs_): Change type.
4577         (Incremental_inputs::inputs_map_): Remove.
4578         (Incremental_inputs::current_object_entry_): New data member.
4579         (Incremental_inputs::inputs_section_): New data member.
4580         (Incremental_inputs::symtab_section_): New data member.
4581         (Incremental_inputs::relocs_section_): New data member.
4582         (Incremental_inputs::reloc_count_): New data member.
4583         (Incremental_inputs_reader): New class.
4584         (Incremental_symtab_reader): New class.
4585         (Incremental_relocs_reader): New class.
4586         * layout.cc (Layout::finalize): Move finalization of incremental info
4587         and creation of incremental info sections to follow finalization of
4588         symbol table.  Set offsets for postprocessing sections.
4589         (Layout::create_incremental_info_sections): Call
4590         Incremental_inputs::create_data_sections.  Add incremental symtab
4591         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4592         sections to layout after input sections.
4593         * layout.h (struct Timespec): Forward declaration.
4594         (Layout::incremental_inputs): Add const.
4595         (Layout::create_incremental_info_sections): Add parameter.
4596         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4597         * object.cc: Include incremental.h.
4598         (Relobj::finalize_incremental_relocs): New function.
4599         (Sized_relobj::do_layout): Record input sections in incremental info.
4600         * object.h (Object::output_section): New function.
4601         (Object::output_section_offset): Moved from Relobj.
4602         (Object::get_incremental_reloc_base): New function.
4603         (Object::get_incremental_reloc_count): New function.
4604         (Object::do_output_section): New function.
4605         (Object::do_output_section_offset): Moved from Relobj.
4606         (Object::do_get_incremental_reloc_base): New function.
4607         (Object::do_get_incremental_reloc_count): New function.
4608         (Object::Object): Initialize new data members.
4609         (Relobj::output_section): Renamed do_output_section and moved to
4610         protected.
4611         (Relobj::output_section_offset): Moved to Object.
4612         (Relobj::do_get_incremental_reloc_base): New function.
4613         (Relobj::do_get_incremental_reloc_count): New function.
4614         (Relobj::allocate_incremental_reloc_counts): New function.
4615         (Relobj::count_incremental_reloc): New function.
4616         (Relobj::finalize_incremental_relocs): New function.
4617         (Relobj::next_incremental_reloc_index): New function.
4618         (Relobj::reloc_counts_): New data member.
4619         (Relobj::reloc_bases_): New data member.
4620         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4621         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4622         (Sized_relobj::incremental_relocs_scan): New function.
4623         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4624         (Sized_relobj::incremental_relocs_write): New function.
4625         (Sized_relobj::incremental_relocs_write_reltype): New function.
4626         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4627         incremental link.
4628         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4629         archives and object files elsewhere.
4630         (Add_symbols::run): Report object files here.
4631         (Finish_group::run): Report end of archive at end of group.
4632         * reloc.cc: Include layout.h, incremental.h.
4633         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4634         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4635         (Sized_relobj::incremental_relocs_scan): New function.
4636         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4637         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4638         (Sized_relobj::incremental_relocs_write): New function.
4639         (Sized_relobj::incremental_relocs_write_reltype): New function.
4640         * script.cc (read_input_script): Rewrite test for incremental link.
4641         Change call to Incremental_inputs::report_script.
4642         * symtab.h (Symbol_table::first_global_index): New function.
4643         (Symbol_table::output_count): New function.
4644
4645 2010-08-12  Doug Kwan  <dougkwan@google.com>
4646
4647         * arm.cc (Target_arm::merge_object_attributes): Check command line
4648         options --no-wchar-size-warning and --no-enum-size-warning.
4649         * options.h (General_options): Add ld-compatible options
4650         --no-enum-size-warning and --no-wchar-size-warning.
4651
4652 2010-08-04  Ian Lance Taylor  <iant@google.com>
4653
4654         * x86_64.cc (Target_x86_64::Scan::local): Use
4655         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4656         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4657         (Target_x86_64::Scan::global): Likewise.
4658         (Target_x86_64::Relocate::relocate): Likewise.
4659         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4660         Likewise.
4661
4662 2010-08-03  Cary Coutant  <ccoutant@google.com>
4663
4664         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4665         to reserve space in merged_strings vector. Keep total input size
4666         for stats.
4667         (Output_merge_string::do_print_merge_stats): Print total input size.
4668         * merge.h (Output_merge_string): Add input_size_ field.
4669         * stringpool.cc (Stringpool_template::string_length): Move
4670         implementations out of Stringpool_template class and place in
4671         stringpool.h.
4672         * stringpool.h (string_length): Move out of Stringpool_template.
4673
4674 2010-08-03  Ian Lance Taylor  <iant@google.com>
4675
4676         PR 11712
4677         * layout.cc (relaxation_loop_body): If address of load segment is
4678         set, adjust address to include headers if possible.
4679
4680 2010-08-03  Ian Lance Taylor  <iant@google.com>
4681
4682         * version.cc (version_string): Bump to 1.10.
4683
4684 2010-08-03  Ian Lance Taylor  <iant@google.com>
4685
4686         PR 11805
4687         * layout.h (enum Output_section_order): Define.
4688         (class Layout): Update declarations.
4689         * layout.cc (Layout::get_output_section): Add order parameter.
4690         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4691         is_first_non_relro parameters.  Change all callers.
4692         (Layout::choose_output_section): Likewise.
4693         (Layout::add_output_section_data): Likewise.
4694         (Layout::make_output_section): Likewise.  Set order.
4695         (Layout::default_section_order): New function.
4696         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4697         * output.cc (Output_section::Output_section): Initialize order_.
4698         Don't initialize deleted fields.
4699         (Output_segment::Output_segment): Don't initialize deleted
4700         fields.
4701         (Output_segment::add_output_section_to_load): New function
4702         replacing add_output_section.  Change all callers to call this or
4703         add_output_section_to_nonload.
4704         (Output_segment::add_output_section_to_nonload): New function.
4705         (Output_segment::remove_output_section): Rewrite.
4706         (Output_segment::add_initial_output_data): Likewise.
4707         (Output_segment::has_any_data_sections): Likewise.
4708         (Output_segment::is_first_section_relro): Likewise.
4709         (Output_segment::maximum_alignment): Likewise.
4710         (Output_segment::has_dynamic_reloc): New function replacing
4711         dynamic_reloc_count.  Change all callers.
4712         (Output_segment::has_dynamic_reloc_list): New function replacing
4713         dynamic_reloc_count_list.  Change all callers.
4714         (Output_segment::set_section_addresses): Rewrite.
4715         (Output_segment::set_offset): Rewrite.
4716         (Output_segment::find_first_and_last_list): Remove.
4717         (Output_segment::set_tls_offsets): Rewrite.
4718         (Output_segment::first_section_load_address): Likewise.
4719         (Output_segment::output_section_count): Likewise.
4720         (Output_segment::section_with_lowest_load_address): Likewise.
4721         (Output_segment::write_section_headers): Likewise.
4722         (Output_segment::print_sections_to_map): Likewise.
4723         * output.h (class Output_data): Remove dynamic_reloc_count_
4724         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4725         (Output_data::add_dynamic_reloc): Rewrite.
4726         (Output_data::has_dynamic_reloc): New function.
4727         (Output_data::dynamic_reloc_count): Remove.
4728         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4729         is_last_relro_, is_first_non_relro_, is_interp_,
4730         is_dynamic_linker_section_ fields.  Add order and set_order
4731         functions.  Remove is_relro_local, set_is_relro_local,
4732         is_last_relro, set_is_last_relro, is_first_non_relro,
4733         set_is_first_non_relro functions, is_interp, set_is_interp,
4734         is_dynamic_linker_section, and set_is_dynamic_linker_section
4735         functions.
4736         (class Output_segment): Change Output_data_list from std::list to
4737         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4738         output_bss_ fields.  Update declarations.
4739
4740 2010-08-02  Ian Lance Taylor  <iant@google.com>
4741
4742         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4743         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4744         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4745
4746 2010-08-02  Ian Lance Taylor  <iant@google.com>
4747
4748         PR 11855
4749         * script.cc (Script_options::Script_options): Initialize
4750         symbol_definitions_ and symbol_references_.
4751         (Script_options::add_symbol_assignment): Update
4752         symbol_definitions_ and symbol_references_.
4753         (Script_options::add_symbol_reference): New function.
4754         (script_symbol): New function.
4755         * script.h (class Script_options): Add symbol_definitions_ and
4756         symbol_references_ fields.
4757         (Script_options::referenced_const_iterator): New type.
4758         (Script_options::referenced_begin): New function.
4759         (Script_options::referenced_end): New function.
4760         (Script_options::is_referenced): New function.
4761         (Script_options::any_unreferenced): New function.
4762         * script-c.h (script_symbol): Declare.
4763         * yyscript.y (exp): Call script_symbol.
4764         * symtab.cc: Include "script.h".
4765         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4766         Change all callers.  Check symbols referenced by scripts.
4767         (Symbol_table::add_undefined_symbols_from_command_line): Add
4768         layout parameter.  Change all callers.
4769         (Symbol_table::do_add_undefined_symbols_from_command_line):
4770         Likewise.  Break out loop body.  Check symbols referenced by
4771         scripts.
4772         (Symbol_table::add_undefined_symbol_from_command_line): New
4773         function broken out of
4774         do_add_undefined_symbols_from_command_line.
4775         * symtab.h (class Symbol_table): Update declarations.
4776         * archive.cc: Include "layout.h".
4777         (Archive::should_include_member): Add layout parameter.  Change
4778         all callers.  Check for symbol mentioned in expression.
4779         * archive.h (class Archive): Update declaration.
4780         * object.cc (Sized_relobj::do_should_include_member): Add layout
4781         parameter.
4782         * object.h (Object::should_include_member): Add layout parameter.
4783         Change all callers.
4784         (Object::do_should_include_member): Add layout parameter.
4785         (class Sized_relobj): Update declaration.
4786         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4787         parameter.
4788         * dynobj.h (class Sized_dynobj): Update declaration.
4789         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
4790         layout parameter.
4791         * plugin.h (class Sized_pluginobj): Update declaration.
4792
4793 2010-08-02  Ian Lance Taylor  <iant@google.com>
4794
4795         PR 11866
4796         * output.cc (Output_segment::set_offset): Search for the first and
4797         last sections rather than assuming that the list is in order.
4798         (Output_segment::find_first_and_last_list): New function.
4799         * output.h (class Output_segment): Update declarations.
4800         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
4801         (relro_strip_test_SOURCES): New variable.
4802         (relro_strip_test_DEPENDENCIES): New variable.
4803         (relro_strip_test_LDFLAGS): New variable.
4804         (relro_strip_test_LDADD): New variable.
4805         (relro_strip_test.so): New target.
4806
4807 2010-08-02  Ian Lance Taylor  <iant@google.com>
4808
4809         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
4810         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
4811         (Target_i386::got_tlsdesc_section): New function.
4812         (Target_i386::got_section): Create space for GOT entries for
4813         TLSDESC relocations.
4814         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
4815         R_386_TLS_GOTDESC.
4816         (Target_i386::Scan::global): Likewise.
4817         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
4818         using TLSDESC GOT.
4819         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
4820         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
4821         (Target_x86_64::got_tlsdesc_section): New function.
4822         (Target_x86_64::got_section): Create space for GOT entries for
4823         TLSDESC relocations.
4824         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
4825         R_386_TLS_GOTDESC.
4826         (Target_x86_64::Scan::global): Likewise.
4827         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
4828         using TLSDESC GOT.
4829
4830 2010-08-02  Ian Lance Taylor  <iant@google.com>
4831
4832         * testsuite/final_layout.sh: Use dc to convert from hex to
4833         decimal.
4834
4835 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
4836
4837         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
4838         paramter to the call to gold::gc_process_relocs.
4839         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
4840         paramter to the call to gold::gc_process_relocs.
4841         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
4842         parameter to the call to gold::gc_process_relocs.
4843         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
4844         template parameter to the call to gold::gc_process_relocs.
4845         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
4846         paramter to the call to gold::gc_process_relocs.
4847         * gc.h (get_embedded_addend_size): New function.
4848         (gc_process_relocs): Save the size of the reloc for use by ICF.
4849         * icf.cc (get_section_contents): Get the addend from the text section
4850         for SHT_REL relocation sections.
4851         * icf.h (Icf::Reloc_addend_size_info): New typedef.
4852         (Icf::Reloc_info): Add new member reloc_addend_size_info.
4853         * int_encoding.h (read_from_pointer): New overloaded function.
4854         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
4855         * testsuite/icf_sht_rel_addend_test.sh: New file.
4856         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
4857         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
4858
4859 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4860
4861         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
4862         * Makefile.in: Regenerate.
4863         * testsuite/Makefile.in: Regenerate.
4864
4865 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
4866
4867         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
4868         * gold/testsuite/debug_msg.cc: Likewise.
4869         * gold/testsuite/odr_violation1.cc
4870         * gold/testsuite/odr_violation2.cc
4871
4872 2010-07-21  Cary Coutant  <ccoutant@google.com>
4873
4874         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
4875         string, and length fields.
4876         (Output_merge_string::Merged_strings_list): New type.
4877         (Output_merge_string::Merged_strings_lists): New typedef.
4878         (Output_merge_string): Replace merged_strings_ with
4879         merged_strings_lists_.
4880         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
4881         Merged_strings_list per input object and section.  Don't store pointer
4882         to the string.  Don't store length with each merged string entry.
4883         (Output_merge_string::finalize_merged_data): Loop over list of merged
4884         strings lists.  Recompute length of each merged string.
4885
4886 2010-07-15  Cary Coutant  <ccoutant@google.com>
4887
4888         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
4889         here.
4890
4891 2010-07-14  Ian Lance Taylor  <iant@google.com>
4892
4893         * descriptors.cc (Descriptors::open): Report correct name in error
4894         message.
4895
4896 2010-07-13  Doug Kwan  <dougkwan@google.com>
4897
4898         * arm.cc (Arm_input_section::Arm_input_section): For a
4899         SHT_ARM_EXIDX section, always keeps the input sections.
4900         (Arm_input_section::set_exidx_section_link): New method.
4901         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
4902         has_errors_ to false.
4903         (Arm_exidx_input_section::has_errors,
4904         Arm_exidx_input_section::set_has_errors): New methods.
4905         (Arm_exidx_input_section::has_errors_): New data member.
4906         (Arm_relobj::get_exidx_shndx_list): New method.
4907         (Arm_output_section::append_text_sections_to_list): Do not skip
4908         section without SHF_EXECINSTR.
4909         (Arm_output_section::fix_exidx_coverage): Skip input sections with
4910         errors.
4911         (Arm_relobj::make_exidx_input_section): Add new parameter for text
4912         section header.  Make error messages more verbose.  Check for
4913         a non-executable section linked to an EXIDX section.
4914         (Arm_relobj::do_read_symbols): Remove error checking, which has been
4915         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
4916         check that there is no deferred EXIDX section if we exit early.
4917         Instead of not making an EXIDX section in case of an error, make one
4918         and set the has_errors flag of it.
4919         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
4920         in a relocatable link.
4921         (Target_arm::do_relax): Look for the EXIDX output section instead of
4922         assuming that it is called .ARM.exidx.
4923         (Target_arm::fix_exidx_coverage): Add a new parameter for input
4924         section list.  Do not check for SHF_EXECINSTR section flags but
4925         skip any input section with errors.
4926         * output.cc (Output_section::Output_section): Initialize
4927         always_keeps_input_sections_ to false.
4928         (Output_section::add_input_section): Check for
4929         always_keeps_input_sections_.
4930         *  output.h (Output_section::always_keeps_input_sections,
4931         Output_section::set_always_keeps_input_sections): New methods.
4932         (Output_section::always_keeps_input_sections): New data member.
4933
4934 2010-07-13  Rafael Espindola  <espindola@google.com>
4935
4936         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
4937         * fileread.h (Input_file): Add try_extra_search_path and find_file.
4938
4939 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
4940             Ian Lance Taylor  <iant@google.com>
4941
4942         * output.h (Output_section_lookup_maps::add_merge_section):
4943         Correct check of whether value was inserted.
4944         (Output_section_lookup_maps::add_merge_input_section): Likewise.
4945         (Output_section_lookup_maps::add_relaxed_input_section):
4946         Likewise.
4947         * arm.cc (Target_arm::got_section): Remove used local os.
4948         * i386.cc (Target_i386::got_section): Likewise.
4949         * x86_64.cc (Target_x86_64::got_section): Likewise.
4950         * sparc.cc (Target_sparc::got_section): Likewise.
4951         (Target_sparc::relocate): Remove unused local have_got_offset.
4952         * powerpc.cc (Target_powerpc::relocate): Likewise.
4953
4954 2010-07-13  Ian Lance Taylor  <iant@google.com>
4955
4956         * compressed_output.cc (zlib_decompress): Fix signature in
4957         !HAVE_ZLIB_H case.
4958
4959         * archive.cc (Archive::include_member): Unlock an external member
4960         of a thin archive.  Don't bother to delete an object we know is
4961         NULL.
4962
4963 2010-07-12  Cary Coutant  <ccoutant@google.com>
4964
4965         * compressed_output.cc (zlib_decompress): New function.
4966         (get_uncompressed_size): New function.
4967         (decompress_input_section): New function.
4968         * compressed_output.h (get_uncompressed_size): New function.
4969         (decompress_input_section): New function.
4970         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
4971         Handle compressed debug sections.
4972         * layout.cc (is_compressed_debug_section): New function.
4973         (Layout::output_section_name): Map compressed section names to
4974         canonical names.
4975         * layout.h (is_compressed_debug_section): New function.
4976         (is_debug_info_section): Recognize compressed debug sections.
4977         * merge.cc: Include compressed_output.h.
4978         (Output_merge_data::do_add_input_section): Handle compressed
4979         debug sections.
4980         (Output_merge_string::do_add_input_section): Handle compressed
4981         debug sections.
4982         * object.cc: Include compressed_output.h.
4983         (Sized_relobj::Sized_relobj): Initialize new data members.
4984         (build_compressed_section_map): New function.
4985         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
4986         * object.h (Object::section_is_compressed): New method.
4987         (Object::do_section_is_compressed): New method.
4988         (Sized_relobj::Compressed_section_map): New type.
4989         (Sized_relobj::do_section_is_compressed): New method.
4990         (Sized_relobj::compressed_sections_): New data member.
4991         * output.cc (Output_section::add_input_section): Handle compressed
4992         debug sections.
4993         * reloc.cc: Include compressed_output.h.
4994         (Sized_relobj::write_sections): Handle compressed debug sections.
4995
4996 2010-07-08  Cary Coutant  <ccoutant@google.com>
4997
4998         * resolve.cc (Symbol_table::resolve): Remember whether undef was
4999         weak when resolving to a dynamic def.
5000         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5001         for weak undef/dynamic def cases. Adjust callers.
5002         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5003         undef_binding_weak_.
5004         (Symbol_table::sized_write_globals): Adjust symbol binding.
5005         (Symbol_table::sized_write_symbol): Add binding parameter.
5006         * symtab.h (Symbol::set_undef_binding): New method.
5007         (Symbol::is_undef_binding_weak): New method.
5008         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5009         (Symbol_table::should_override): Add new parameter.
5010         (Symbol_table::sized_write_symbol): Add new parameter.
5011
5012         * testsuite/weak_undef_file1.cc: Add new test case.
5013         * testsuite/weak_undef_file2.cc: Fix header comment.
5014         * testsuite/weak_undef_test.cc: Add new test case.
5015
5016 2010-06-29  Doug Kwan  <dougkwan@google.com>
5017
5018         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5019         Initialize USE_SYMBOL_.
5020         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5021         definition.
5022         (Arm_reloc_property::uses_symbol_): New data member declaration.
5023         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5024         uses symbol value and symbol is undefined but not weakly undefined.
5025
5026 2010-06-28  Rafael Espindola  <espindola@google.com>
5027
5028         * plugin.cc (Plugin::load): Use dlerror.
5029
5030 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5031
5032         * symtab.cc (detect_odr_violations): When reporting an ODR
5033         violation, report an object where the symbol is defined.
5034
5035 2010-06-25  Doug Kwan  <dougkwan@google.com>
5036
5037         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5038         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5039         definition.
5040         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5041         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5042         target hook to detect function points.
5043         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5044         * icf.h (Icf::check_section_for_function_pointers): Change type of
5045         parameter SECTION_NAME to const reference to std::string.  Use
5046         target hook to determine if section may have unsafe pointers.
5047         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5048         method definition.
5049
5050 2010-06-21  Rafael Espindola  <espindola@google.com>
5051
5052         * fileread.cc (Input_file::find_fie): New
5053         (Input_file::open): Use Input_file::find_fie.
5054         * fileread.h (Input_file::find_fie): New
5055         * plugin.cc (set_extra_library_path): New.
5056         (Plugin::load): Add set_extra_library_path to the transfer vector.
5057         (Plugin_manager::set_extra_library_path): New.
5058         (Plugin_manager::add_input_file): Use the extra search path if set.
5059         (set_extra_library_path(): New.
5060         * plugin.h (Plugin_manager): Add set_extra_library_path and
5061         extra_search_path_.
5062
5063 2010-06-19  Cary Coutant  <ccoutant@google.com>
5064
5065         * layout.cc (gdb_sections): Add .debug_types.
5066         (lines_only_debug_sections): Likewise.
5067
5068 2010-06-18  Rafael Espindola  <espindola@google.com>
5069
5070         * plugin.cc (add_input_file,add_input_library)
5071         (Plugin_manager::add_input_file): Make filename arguments const.
5072         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5073         const.
5074
5075 2010-06-16  Doug Kwan  <dougkwan@google.com>
5076
5077         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5078         .ARM.attributes section if we have not merged any input
5079         attributes sections.
5080
5081 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5082
5083         * arm.cc: Allow combining objects with no EABI version
5084         information.
5085
5086 2010-06-15  Rafael Espindola  <espindola@google.com>
5087
5088         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5089
5090 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5091
5092         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5093         (struct iovec): Correct !HAVE_READV definition.
5094
5095 2010-06-10  Cary Coutant  <ccoutant@google.com>
5096
5097         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5098         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5099         reloc sections.
5100         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5101
5102         PR 11683
5103         * symtab.h (Symbol::is_placeholder): New member function.
5104         * target-reloc.h (relocate_section): Check for placeholder symbols.
5105
5106         * testsuite/Makefile.am (plugin_test_8): New test.
5107         (plugin_test_9): New test.
5108         * testsuite/Makefile.in: Regenerate.
5109
5110 2010-06-09  Nick Clifton  <nickc@redhat.com>
5111
5112         * yyscript.y (input_list_element): Allow strings prefixed with
5113         the '-' character.  Treat these as libraries.
5114         * script.cc (script_add_library): New function.  Adds a library
5115         specified by "-l<name>" found in an input script.
5116         * script-c.h: Add prototype for script_add_library.
5117
5118 2010-06-07  Doug Kwan  <dougkwan@google.com>
5119
5120         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5121         Restrict stub-group size to be within long conditional branch
5122         range when working around cortex-A8 erratum.
5123
5124 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5125
5126         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5127         #ifdef typo.
5128
5129 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5130
5131         PR gold/11658
5132         * output.cc
5133         (Output_section::Input_section_sort_entry::compare_section_ordering):
5134         Change to return non-zero correctly.
5135         (Output_section::Input_section_sort_section_order_index_compare
5136         ::operator()): Change to fix ambiguity in comparisons.
5137
5138 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5139
5140         * gold.h (is_wildcard_string): New function.
5141         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5142         (Layout::layout_eh_frame): Ditto.
5143         (Layout::find_section_order_index): New method.
5144         (Layout::read_layout_from_file): New method.
5145         * layout.h (Layout::find_section_order_index): New method.
5146         (Layout::read_layout_from_file): New method.
5147         (Layout::input_section_position_): New private member.
5148         (Layout::input_section_glob_): New private member.
5149         * main.cc (main): Call read_layout_from_file here.
5150         * options.h (--section-ordering-file): New option.
5151         * output.cc (Output_section::input_section_order_specified_): New
5152         member.
5153         (Output_section::Output_section): Initialize new member.
5154         (Output_section::add_input_section): Add new parameter.
5155         Keep input sections when --section-ordering-file is used.
5156         (Output_section::set_final_data_size): Sort input sections when
5157         section ordering file is specified.
5158         (Output_section::Input_section_sort_entry): Add new parameter.
5159         Check sorting type.
5160         (Output_section::Input_section_sort_entry::compare_section_ordering):
5161         New method.
5162         (Output_section::Input_section_sort_compare::operator()): Change to
5163         consider section_order_index.
5164         (Output_section::Input_section_sort_init_fini_compare::operator()):
5165         Change to consider section_order_index.
5166         (Output_section::Input_section_sort_section_order_index_compare
5167         ::operator()): New method.
5168         (Output_section::sort_attached_input_sections): Change to sort
5169         according to section order when specified.
5170         (Output_section::add_input_section<32, true>): Add new parameter.
5171         (Output_section::add_input_section<64, true>): Add new parameter.
5172         (Output_section::add_input_section<32, false>): Add new parameter.
5173         (Output_section::add_input_section<64, false>): Add new parameter.
5174         * output.h (Output_section::add_input_section): Add new parameter.
5175         (Output_section::input_section_order_specified): New
5176         method.
5177         (Output_section::set_input_section_order_specified): New method.
5178         (Input_section::Input_section): Initialize section_order_index_.
5179         (Input_section::section_order_index): New method.
5180         (Input_section::set_section_order_index): New method.
5181         (Input_section::section_order_index_): New member.
5182         (Input_section::Input_section_sort_section_order_index_compare): New
5183         struct.
5184         (Output_section::input_section_order_specified_): New member.
5185         * script-sections.cc (is_wildcard_string): Delete and move modified
5186         method to gold.h.
5187         (Output_section_element_input::Output_section_element_input): Modify
5188         call to is_wildcard_string.
5189         (Output_section_element_input::Input_section_pattern
5190         ::Input_section_pattern): Ditto.
5191         (Output_section_element_input::Output_section_element_input): Ditto.
5192         * testsuite/Makefile.am (final_layout): New test case.
5193         * testsuite/Makefile.in: Regenerate.
5194         * testsuite/final_layout.cc: New file.
5195         * testsuite/final_layout.sh: New file.
5196
5197 2010-06-01  Rafael Espindola  <espindola@google.com>
5198
5199         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5200
5201 2010-06-01  Rafael Espindola  <espindola@google.com>
5202
5203         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5204         visibility of symbols.
5205
5206 2010-05-27  Doug Kwan  <dougkwan@google.com>
5207
5208         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5209         from start of output section instead of address for a local symbol
5210         in a merged or relaxed section when doing a relocatable link.
5211
5212 2010-05-26  Rafael Espindola  <espindola@google.com>
5213
5214        PR 11604
5215         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5216         adding sections the garbage collector removed.
5217         * gold/testsuite/Makefile.am: Add test.
5218         * gold/testsuite/Makefile.in: Regenerate.
5219         * gold/testsuite/plugin_test_7.sh: New.
5220         * gold/testsuite/plugin_test_7_1.c: New.
5221         * gold/testsuite/plugin_test_7_2.c: New.
5222
5223 2010-05-26  Rafael Espindola  <espindola@google.com>
5224
5225         * script-sections.cc (Output_section_definition::set_section_addresses):
5226         Check for --section-start.
5227
5228 2010-05-26  Doug Kwan  <dougkwan@google.com>
5229
5230         * arm.cc (Arm_scan_relocatable_relocs): New class.
5231         (Target_arm::relocate_special_relocatable): New method.
5232         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5233         (Arm_relocate_functions::thumb_branch_common): Same.
5234         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5235         instead of Default_scan_relocatable_relocs.
5236         * target-reloc.h (relocate_for_relocatable): Let target handle
5237         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5238         * target.h (Sized_target::relocate_special_relocatable): New method.
5239
5240 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5241
5242         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5243
5244 2010-05-23  Doug Kwan  <dougkwan@google.com>
5245
5246         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5247         instead of a cast.
5248         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5249         with a direct branch, not a conditional branch, to a stub.
5250         * merge.cc (Output_merge_base::record_input_section): New method
5251         defintion.
5252         (Output_merge_data::do_add_input_section): Record input section if
5253         keeps-input-sections flag is set.
5254         (Output_merge_string::do_add_input_section): Ditto.
5255         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5256         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5257         INPUT_SECTIONS_.
5258         (Output_merge_base::keeps_input_sections,
5259         Output_merge_base::set_keeps_input_sections,
5260         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5261         method definitions.
5262         (Output_merge_base::Input_sections): New type declaration.
5263         (Output_merge_base::input_sections_begin,
5264         Output_merge_base::input_sections_end,
5265         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5266         (Output_merge_base::bool keeps_input_sections_,
5267         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5268         Output_merge_base::input_sections_): New data members.
5269         (Output_merge_data::do_set_keeps_input_sections): New method
5270         defintion.
5271         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5272         * output.cc (Output_section::Input_section::relobj): Move method
5273         defintion from class declaration to here and handle merge sections.
5274         (Output_section::Input_section::shndx): Ditto.
5275         (Output_section::Output_section): Remove initializations of removed
5276         data members and initialize new data member LOOKUP_MAPS_.
5277         (Output_section::add_input_section): Set keeps-input-sections flag
5278         for a newly created merge output section as appropriate.  Adjust code
5279         to use Output_section_lookup_maps class.
5280         (Output_section::add_relaxed_input_section): Adjst code for lookup
5281         maps code refactoring.
5282         (Output_section::add_merge_input_section): Add a new parameter
5283         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5284         class.  If adding input section to a newly created merge output
5285         section fails, remove the new merge section.
5286         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5287         Adjust code for use of the Output_section_lookup_maps class.
5288         (Output_section::find_merge_section): Ditto.
5289         (Output_section::build_lookup_maps): New method defintion.
5290         (Output_section::find_relaxed_input_section): Adjust code to use
5291         Output_section_lookup_maps class.
5292         (Output_section::get_input_sections): Export merge sections.  Adjust
5293         code to use Output_section_lookup_maps class.
5294         (Output_section:::add_script_input_section): Adjust code to use
5295         Output_section_lookup_maps class.  Update lookup maps for merge
5296         sections also.
5297         (Output_section::discard_states): Use Output_section_lookup_maps.
5298         (Output_section::restore_states): Same.
5299         * output.h (Merge_section_properties): Move class defintion out of
5300         Output_section.
5301         (Output_section_lookup_maps): New class.
5302         (Output_section::Input_section::is_merge_section): New method
5303         defintion.
5304         (Output_section::Input_section::relobj): Move defintion out of class
5305         defintion.  Declare method only.
5306         (Output_section::Input_section::shndx): Ditto.
5307         (Output_section::Input_section::output_merge_base): New method defintion.
5308         (Output_section::Input_section::u2_.pomb): New union field.
5309         (Output_section::Merge_section_by_properties_map,
5310         Output_section::Output_section_data_by_input_section_map,
5311         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5312         Remove types.
5313         (Output_section::add_merge_input_section): Add new parameter
5314         KEEPS_INPUT_SECTIONS.
5315         (Output_section::build_lookup_maps): New method declaration.
5316         (Output_section::merge_section_map_,
5317         Output_section::merge_section_by_properties_map_,
5318         Output_section::relaxed_input_section_map_,
5319         Output_section::is_relaxed_input_section_map_valid_): Remove data
5320         members.
5321         (Output_section::lookup_maps_): New data member.
5322
5323 2010-05-21  Doug Kwan  <dougkwan@google.com>
5324
5325         PR gold/11619
5326         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5327         avoid a compilation error.
5328
5329 2010-05-19  Rafael Espindola  <espindola@google.com>
5330
5331         * script-sections.cc (Output_section_definition::allocate_to_segment):
5332         Update the phdrs_list even when the output section is NULL.
5333         * testsuite/Makefile.am: Add test.
5334         * testsuite/Makefile.in: Regenerate.
5335         * testsuite/script_test_9.cc: New.
5336         * testsuite/script_test_9.sh: New.
5337         * testsuite/script_test_9.t: New.
5338
5339 2010-05-19  Doug Kwan  <dougkwan@google.com>
5340
5341         * arm.cc (Arm_input_section::original_size): New method.
5342         (Arm_input_section::do_addralign): Add a cast.
5343         (Arm_input_section::do_output_offset): Remove static cast.
5344         (Arm_input_section::original_addralign,
5345          Arm_input_section::original_size_): Change type to uint32_t.
5346         (Arm_input_section::init): Add safe casts for section alignment
5347         and size.
5348         (Arm_input_section::set_final_data_size): Do not set address and
5349         offset of stub table.
5350         (Arm_output_section::fix_exidx_coverage): Change use of of
5351         Output_section::Simple_input_section to that of
5352         Output_section::Input_section.
5353         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5354         except for the first pass.
5355         * output.cc (Output_section::get_input_sections): Change type of
5356         input_sections to std::list<Input_section>.
5357         (Output_section::add_script_input_section): Rename from
5358         Output_section::add_simple_input_section.  Change type of SIS
5359         parameter from Simple_input_section to Input_section.
5360         * output.h (Output_section::Simple_input_section): Remove class.
5361         (Output_section::Input_section): Change class visibility to public.
5362         (Output_section::Input_section::addralign): Use stored alignments
5363         for special input sections if set.
5364         (Output_section::Input_section::set_addralign): New method.
5365         (Output_section::get_input_sections): Change parameter type from
5366         list of Simple_input_section to list of Input_section.
5367         (Output_section::add_script_input_section): Rename from
5368         Output_section::add_simple_input_section. Change first parameter's
5369         type from Simple_input_section to Input_section and remove the
5370         second and third parameters.
5371         * script-sections.cc (Input_section::Input_section_list): Change
5372         type to list of Output_section::Input_section/
5373         (Input_section_info::Input_section_info): Change parameter type of
5374         INPUT_SECTION to Output_section::Input_section.
5375         (Input_section_info::input_section): Change return type.
5376         (Input_section_info::input_section_): Change type to
5377         Output_section::Input_section.
5378         (Output_section_element_input::set_section_addresses): Adjust code
5379         to use Output_section::Input_section instead of
5380         Output_section::Simple_input_section.  Adjust code for renaming
5381         of Output_section::add_simple_input_section.
5382         (Orphan_output_section::set_section_addresses): Ditto.
5383
5384 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5385
5386         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5387         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5388
5389 2010-05-18  Rafael Espindola  <espindola@google.com>
5390
5391         * options.cc (General_options::finalize): Handle -nostdlib.
5392         * options.h (nostdlib): New option.
5393         * script.cc (script_add_search_dir): Handle -nostdlib.
5394
5395 2010-05-12  Doug Kwan  <dougkwan@google.com>
5396
5397         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5398         attributes section only if there no attributes section after merging.
5399         (Target_arm::merge_object_attributes): Move value of
5400         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5401         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5402         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5403         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5404         and arm_attr_merge_7.stdout.
5405         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5406         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5407         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5408         arm_attr_merge_7b.o): New rules.
5409         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5410         arm_attr_merge_7
5411         * testsuite/Makefile.in: Regenerate.
5412         * testsuite/arm_attr_merge.sh: New file.
5413         * testsuite/arm_attr_merge_[67][ab].s: Same.
5414
5415 2010-05-05  Nick Clifton  <nickc@redhat.com>
5416
5417         * po/es.po: Updated Spanish translation.
5418
5419 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5420
5421         * Makefile.am (install-exec-local): Properly install gold as
5422         default cross linker.
5423         * Makefile.in: Regenerated.
5424
5425 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5426             Nick Clifton  <nickc@redhat.com>
5427
5428         * configure.ac (install_as_default): Define and set to false
5429         unless --enable-gold or --enable-gold=both/gold has been
5430         specified.
5431         * configure: Regenerate.
5432
5433         * Makefile.am (install-exec-local): Install the executable as
5434         'ld.gold'.  If install_as_default is true then also install it as
5435         'ld'.
5436         * Makefile.in: Regenerated.
5437
5438 2010-04-24  Ian Lance Taylor  <iant@google.com>
5439
5440         * layout.cc (Layout::layout_reloc): In relocatable link don't
5441         combine reloc sections for grouped sections.
5442
5443 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5444
5445         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5446         sections that are not ordinary to icf.
5447         * icf.cc (get_section_contents): Handle relocation pointing to section
5448         with no object or shndx information.
5449         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5450         * testsuite/Makefile.in: Regenerate.
5451         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5452         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5453
5454 2010-04-22  Ian Lance Taylor  <iant@google.com>
5455
5456         * expression.cc (Expression::Expression_eval_info): Add
5457         result_alignment_pointer field.
5458         (Expression::eval_with_dot): Add result_alignment_pointer
5459         parameter.  Change all callers.
5460         (Expression::eval_maybe_dot): Likewise.
5461         (class Binary_expression): Add alignment_pointer parameter to
5462         left_value and right_value.  Change all callers.
5463         (BINARY_EXPRESSION): Set result alignment.
5464         (class Trinary_expression): Add alignment_pointer parameter to
5465         arg2_value and arg3_value.  Change all callers.
5466         (Trinary_cond::value): Set result alignment.
5467         (Max_expression::value, Min_expression::value): Likewise.
5468         (Align_expression::value): Likewise.
5469         * script-sections.cc (class Sections_element): Add dot_alignment
5470         parameter to set_section_addresses virtual function.  Update
5471         instantiations.
5472         (class Output_section_element): Likewise.
5473         (Script_sections::create_segments): Add dot_alignment parameter.
5474         Change all callers.
5475         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5476         (Script_sections::set_phdrs_clause_addresses): Likewise.
5477         * script-sections.h: Update declarations.
5478         * script.h: Update declarations.
5479         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5480         min_p_align.
5481         * testsuite/script_test_3.t: Set large alignment.
5482         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5483         segment has expected alignment.
5484
5485 2010-04-22  Nick Clifton  <nickc@redhat.com>
5486
5487         * po/gold.pot: Updated by the Translation project.
5488         * po/vi.po: Updated Vietnamese translation.
5489
5490 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5491
5492         * testsuite/Makefile.am (check_PROGRAMS): Add
5493         icf_virtual_function_folding_test.
5494         * testsuite/Makefile.in: Regenerated.
5495
5496 2010-04-15  Andrew Haley  <aph@redhat.com>
5497
5498         * options.h (merge_exidx_entries): New option.
5499         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5500         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5501         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5502         (Target_arm::merge_exidx_entries): New function.
5503         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5504         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5505         to Arm_exidx_fixup constructor.
5506         Add new arg, merge_exidx_entries.
5507         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5508         Arm_output_section::fix_exidx_coverage.
5509
5510 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5511
5512         * icf.cc (get_section_contents): Check for preemptible functions.
5513         Ignore addend when appropriate.
5514         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5515         section folded.
5516         (add_from_relobj): Check for section folded.
5517         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5518         * symtab.h (should_add_dynsym_entry): Add new parameter.
5519         * target-reloc.h (scan_relocs): Check for section folded.
5520         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5521         Check reloc types for function pointers in shared objects.
5522         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5523         case.
5524         (icf_preemptible_functions_test): New test case.
5525         (icf_string_merge_test): New test case.
5526         * testsuite.Makefile.in: Regenerate.
5527         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5528         bar_glob.  Refactor code.
5529         * testsuite/icf_preemptible_functions_test.cc: New file.
5530         * testsuite/icf_preemptible_functions_test.sh: New file.
5531         * testsuite/icf_string_merge_test.cc: New file.
5532         * testsuite/icf_string_merge_test.sh: New file.
5533         * testsuite/icf_virtual_function_folding_test.cc: New file.
5534         * testsuite/icf_virtual_function_folding_test.sh: New file.
5535
5536 2010-04-14  Doug Kwan  <dougkwan@google.com>
5537
5538         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5539         for local symbol recounting if we remove a section due to ICF.
5540         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5541         there are no regular objects in input.
5542
5543 2010-04-13  Doug Kwan  <dougkwan@google.com>
5544
5545         * arm.cc (Arm_input_section::set_final_data_size): Compute
5546         accurate final data size instead of using current data size.
5547
5548 2010-04-09  Doug Kwan  <dougkwan@google.com>
5549
5550         * layout.cc (Layout::choose_output_section): Handle script section
5551         types.
5552         (Layout::make_output_section_for_script): Add section type parameter.
5553         Handle script section types.
5554         * layout.h (Layout::make_output_section_for_script): Add section
5555         type parameter.
5556         * output.cc (Output_section::Output_section): Initialize data member
5557         is_noload_.
5558         (Output_section::do_reset_address_and_file_offset): Do not set address
5559         to 0 if section is a NOLOAD section.
5560         * output.h (Output_section::is_noload): New method.
5561         (Output_section::set_is_noload): Ditto.
5562         (Output_section::is_noload_): New data member.
5563         * script-c.h (Script_section_type): New enum type.
5564         (struct Parser_output_section_header): Add new file section_type.
5565         * script-sections.cc (Sections_element::output_section_name): Add
5566         parameter for returning script section type.
5567         (Output_section_definition::output_section_name): Ditto.
5568         (Output_section_definition::section_type)P; New method.
5569         (Output_section_definiton::script_section_type_name): Ditto.
5570         (Output_section_definition::script_section_type_): New data member.
5571         (Output_section_definition::Output_section_definition): Initialize
5572         data member Output_section_definition::script_section_type_.
5573         (Output_section_definition::create_sections): Pass script section type
5574         to Layout::make_output_section_for_script.
5575         (Output_section_definition::output_section_name): Return script
5576         section type to caller.
5577         (Output_section_definition::set_section_address): Do not advance
5578         dot value and load address if section type is NOLOAD.  Set address
5579         of NOLOAD sections regardless of section flags.
5580         (Output_section_definition::print): Print section type if it is
5581         not SCRIPT_SECTION_TYPE_NONE.
5582         (Output_section_definition::section_type): New method.
5583         (Output_section_definition::script_section_type_name): Ditto.
5584         (Script_sections::output_section_name): Add new parameter
5585         PSECTION_TYPE for returning script section type.  Pass it to
5586         section elements.  Handle discard sections.
5587         (Sort_output_sections::operator()): Handle NOLOAD sections.
5588         * script-sections.h (Script_sections::Section_type): New enum type.
5589         (Script_sections::output_section_name): Add a new parameter for
5590         returning script section type.
5591         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5592         INFO and NOLOAD.
5593         * yyscript.y (union): Add new field SECTION_TYPE.
5594         (COPY, DSECT, INFO, NOLOAD): New tokens.
5595         (opt_address_and_section_type): Change type to output_section_header.
5596         (section_type): New non-terminal
5597         (section_header): Handle section type.
5598         (opt_address_and_section_type): Return section type value.
5599
5600 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5601
5602         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5603         * testsuite/plugin_common_test_2.c (foo): Likewise.
5604
5605 2010-04-08  Doug Kwan  <dougkwan@google.com>
5606
5607         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5608         Output_merge_data.
5609         * output.cc (Output_section::add_merge_input_section): Simplify
5610         code and return status of Output_merge_base::add_input_section.
5611         Update merge section map only if Output_merge_base::add_input_section
5612         returns true.
5613
5614 2010-04-07  Doug Kwan  <dougkwan@google.com>
5615
5616         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5617         if section is marked as containing instructions but has no mapping
5618         symbols.
5619         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5620         correct section index.
5621         (Arm_relobj::find_linked_text_section): Ditto.
5622
5623 2010-04-07  Cary Coutant  <ccoutant@google.com>
5624
5625         * archive.cc (include_member): Destroy Read_symbols_data object before
5626         releasing file.
5627         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5628         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5629         (Read_symbols_data::~Read_symbols_data) New destructor.
5630         (Section_relocs::Section_relocs) New constructor.
5631         (Section_relocs::~Section_relocs) New destructor.
5632         (Read_relocs_data::Read_relocs_data) New constructor.
5633         (Read_relocs_data::~Read_relocs_data) New destructor.
5634         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5635         pointers to NULL after deleting.
5636
5637 2010-04-07  Doug Kwan  <dougkwan@google.com>
5638
5639         * arm.cc: Replace "endianity" with "endianness" in comments.
5640         (Arm_exidx_cantunwind): Ditto.
5641         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5642         (Arm_relobj::merge_flags_and_attributes): New method.
5643         (Arm_relobj::merge_flags_and_attributes_): New data member.
5644         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5645         (Arm_relobj::scan_sections_for_stubs): Ditto.
5646         (Arm_relobj::do_read_symbols): Check to see if we really want to
5647         merge processor-specific flags and attributes.  Exit early if
5648         an object is empty except for section names and the undefined symbol.
5649         (Target_arm::do_finalize_sections): Move check for ELF format to
5650         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5651         attributes from a regular object only when we have determined that
5652         it is aapropriate.  Do not create an .ARM.attributes section in
5653         output if there is no regular input object.
5654         (Target_arm::merge_processor_specific_flags): Check
5655         --warn-mismatch before printing any error.
5656         (Target_arm::merge_object_attributes): Ditto.
5657         * gold.cc (queue_middle_tasks): Handle the case in which there is
5658         no regular object in input.
5659         * options.cc (General_options::parse_EB): New method.
5660         (General_options::parse_EL): Same.
5661         (General_options::General_options): Initialize endianness_.
5662         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5663         New options.
5664         (General_options::Endianness): New enum.
5665         (General_options::endianness): New method.
5666         (General_options::endianness_): New data member.
5667         * parameters.cc (Parameters::set_options): Check target endianness.
5668         (Parameters::set_target_once): Ditto.
5669         (Parameters::check_target_endianness): New method.
5670         (parameters_force_valid_target): If either -EL or -EB is specified,
5671         use it to define endianness of default target.
5672         * parameters.h (Parameters::check_target_endianness): New method
5673         declaration.
5674         * target.h (class Target): Change "endianity" to "endianness"
5675         in comments.
5676
5677 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5678
5679         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5680         * configure: Regenerate.
5681         * Makefile.in: Regenerate.
5682         * testsuite/Makefile.in: Regenerate.
5683
5684 2010-04-06  Cary Coutant  <ccoutant@google.com>
5685
5686         gcc PR lto/42757
5687         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5688         prevailing definitions of common symbols.
5689         * testsuite/plugin_test_6.sh: New test case.
5690         * testsuite/plugin_common_test_1.c: New test case.
5691         * testsuite/plugin_common_test_2.c: New test case.
5692         * testsuite/Makefile.am (plugin_test_6): New test case.
5693         * testsuite/Makefile.in: Regenerate.
5694
5695 2010-04-06  Nick Clifton  <nickc@redhat.com>
5696
5697         * po/vi.po: New Vietnamese translation.
5698
5699 2010-03-30  Doug Kwan  <dougkwan@google.com>
5700
5701         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5702
5703 2010-03-25  Doug Kwan  <dougkwan@google.com>
5704
5705         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5706         to avoid a conversion warning on a 32-bit host.
5707
5708 2010-03-24  Ian Lance Taylor  <iant@google.com>
5709
5710         * testsuite/script_test_3.t: Add a TLS segment.
5711         * testsuite/Makefile.am (check_PROGRAMS): Add
5712         tls_phdrs_script_test.
5713         (tls_phdrs_script_test_SOURCES): Define.
5714         (tls_phdrs_script_test_DEPENDENCIES): Define.
5715         (tls_phdrs_script_test_LDFLAGS): Define.
5716         (tls_phdrs_script_test_LDADD): Define.
5717         * testsuite/Makefile.in: Rebuild.
5718
5719 2010-03-23  Cary Coutant  <ccoutant@google.com>
5720
5721         * fileread.cc (find_or_make_view): Fix comment.
5722
5723 2010-03-23  Ian Lance Taylor  <iant@google.com>
5724
5725         * script-sections.cc (class Orphan_section_placement): Define
5726         PLACE_TLS and PLACE_TLS_BSS.
5727         (Orphan_section_placement::Orphan_section_placement): Initialize
5728         new places.
5729         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5730         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5731         (tls_script_test_SOURCES): Define.
5732         (tls_script_test_DEPENDENCIES): Define.
5733         (tls_script_test_LDFLAGS): Define.
5734         (tls_script_test_LDADD): Define.
5735         * testsuite/Makefile.in: Rebuild.
5736
5737 2010-03-22  Doug Kwan  <dougkwan@google.com>
5738
5739         * arm.cc (Arm_relocate_functions::abs8,
5740         Arm_relocate_functions::abs16): Use correct check for overflow
5741         specified in the ARM ELF specs.
5742         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5743         target of a BLX instruction specially.
5744         (Reloc_stub::stub_type_for_reloc): Ditto.
5745         (Relocate::relocate): Use symbolic names instead of numeric relocation
5746         codes to report error.
5747         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5748         workaround.
5749         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5750         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5751         thumb2_blx_out_of_range.stdout
5752         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5753         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5754         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5755         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5756         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5757         thumb2_blx_in_range, thumb2_blx_in_range.o,
5758         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5759         thumb2_blx_out_of_range.o): New rules.
5760         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5761         thumb2_blx_in_range and thumb2_blx_out_of_range.
5762         * testsuite/Makefile.in: Regenerate.
5763         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5764         * testsuite/thumb_blx_in_range.s: New file.
5765         * testsuite/thumb_blx_out_of_range.s: New file.
5766
5767 2010-03-22  Rafael Espindola  <espindola@google.com>
5768
5769         * archive.cc (Should_include): Move to archive.h.
5770         (should_include_member): Make it a member of Archive.
5771         (Lib_group): New.
5772         (Add_lib_group_symbols): New.
5773         * archive.h: Include options.h.
5774         (Archive_member): Moved from Archive.
5775         (Should_include): Moved from archive.cc.
5776         (Lib_group): New.
5777         (Add_lib_group_symbols): New.
5778         * dynobj.cc (do_should_include_member): New.
5779         * dynobj.h (do_should_include_member): New.
5780         * gold.cc (queue_initial_tasks): Update call to queue.
5781         * main.cc (main): Print lib group stats.
5782         * object.cc (do_should_include_member): New.
5783         * object.h: Include archive.h.
5784         (Object::should_include_member): New.
5785         (Object::do_should_include_member): New.
5786         (Sized_relobj::do_should_include_member): New.
5787         * options.cc (General_options::parse_start_lib): New.
5788         (General_options::parse_end_lib): New.
5789         (Input_arguments::add_file): Handle lib groups.
5790         (Input_arguments::start_group): Check we are not in a lib.
5791         (Input_arguments::start_lib): New.
5792         (Input_arguments::end_lib): New.
5793         * options.h (General_options): Add start_lib and end_lib.
5794         (Input_argument::lib_): New.
5795         (Input_argument::lib): New.
5796         (Input_argument::is_lib): New.
5797         (Input_file_lib): New.
5798         (Input_arguments::in_lib_): New.
5799         (Input_arguments::in_lib): New.
5800         (Input_arguments::start_lib): New.
5801         (Input_arguments::end_lib_): New.
5802         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
5803         in unused members as preempted.
5804         (Sized_pluginobj::do_should_include_member): New.
5805         * plugin.h (Sized_pluginobj::do_should_include_member): New.
5806         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
5807         return the blocker.
5808         (Read_symbols::do_whole_lib_group): New.
5809         (Read_symbols::do_lib_group): New.
5810         (Read_symbols::do_read_symbols): Handle lib groups.
5811         (Read_symbols::get_name): Handle lib groups.
5812         * readsyms.h (Read_symbols): Add an archive member pointer.
5813         (Read_symbols::do_whole_lib_group): New.
5814         (Read_symbols::do_lib_group): New.
5815         (Read_symbols::member_): New.
5816         * script.cc (read_input_script): Update call to queue_soon.
5817
5818 2010-03-19  Doug Kwan  <dougkwan@google.com>
5819
5820         * arm.cc (Stub_table::Stub_table): Initialize new data members
5821         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5822         (Stub_table::add_reloc_stub): Assign stub offset and update
5823         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
5824         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
5825         New data members.
5826         (Stub_table::update_data_size_and_addralign): Use
5827         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
5828         instead of going over all reloc stubs.
5829         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
5830         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5831         Stringpool_template::offset_ to size of Stringpool_char.
5832         (Stringpool_template::new_key_offset): Remove code to initialize
5833         Stringpool_template::offset_.
5834         * stringpool.h (Stringpool_template::set_no_zero_null): Set
5835         Stringpool_template::offset_ to zero.
5836
5837 2010-03-15  Doug Kwan  <dougkwan@google.com>
5838
5839         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
5840         offset_.
5841         (Stringpool_template::new_key_offset): New method.
5842         (Stringpool_template::add_string): Assign offsets when adding new
5843         strings.
5844         (Stringpool_template::set_string_offsets): Do not set string offsets
5845         when not optimizing.
5846         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
5847         member size_.
5848         (Chunked_vector::clear): Clear size_.
5849         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
5850         (Chunked_vector::size): Return size_.
5851         (Chunked_vector::push_back): Use size_ to find insert position.
5852         (Chunked_vector::size_): New data member.
5853         (Stringpool_template::set_no_zero_null): Assert string set is empty.
5854         (Stringpool_template::new_key_offset): New method declaration.
5855         (Stringpool_template::offset_): New data member.
5856
5857 2010-03-15   Rafael Espindola  <espindola@google.com>
5858
5859         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
5860         Add_symbols' constructor.
5861         * readsyms.h (Add_symbols): Remove the input_group member.
5862
5863 2010-03-10  Ian Lance Taylor  <iant@google.com>
5864
5865         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
5866         target to ask whether a reference to a symbol requires a stack
5867         split.
5868         * target.h (Target::is_call_to_non_split): New function.
5869         (Target::do_is_call_to_non_split): Declare virtual function.
5870         * target.cc: Include "symtab.h".
5871         (Target::do_is_call_to_non_split): New function.
5872         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
5873
5874 2010-03-10  Cary Coutant  <ccoutant@google.com>
5875
5876         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
5877         (File_read::open[1]): Remove initial mapping of whole_file_view_.
5878         (File_read::open[2]): Add whole_file_view_ to list of views.
5879         (File_read::make_view): Remove test of whole_file_view_.
5880         (File_read::find_or_make_view): Create whole_file_view_ if
5881         necessary.
5882         (File_read::clear_views): Replace bool parameter with enum;
5883         adjust all callers.  Don't delete views with permanent data;
5884         do delete cached views and views from archives if
5885         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
5886         if clearing the corresponding view.
5887         * fileread.h (File_read::Clear_views_mode): New enum.
5888         (File_read::View::is_permanent_view): New method.
5889         (File_read::clear_views): Replace bool parameter
5890         with enum; adjust all callers.
5891         * options.h (General_options): Change keep_files_mapped option;
5892         add map_whole_files.
5893         * readsyms.cc (Add_symbols::run): Delete sd_ object before
5894         releasing the file.
5895         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
5896         the file.
5897
5898 2010-03-10  David S. Miller  <davem@davemloft.net>
5899
5900         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
5901
5902 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
5903
5904         * icf.cc (get_section_contents): Add '@' marker after processing the
5905         merge reloc.
5906
5907 2010-03-08  Doug Kwan  <dougkwan@google.com>
5908
5909         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
5910         due to a conversion warning.
5911         (Arm_relobj::update_output_local_symbol_count): Check for local
5912         symbol with unset output index.
5913
5914 2010-03-05  Ian Lance Taylor  <iant@google.com>
5915
5916         * options.h (class General_options): Add --spare-dynamic-tags.
5917         * output.cc (Output_data_dynamic::set_final_data_size): Implement
5918         --spare-dynamic-tags.
5919
5920 2010-03-05  Ian Lance Taylor  <iant@google.com>
5921
5922         * incremental.cc: Include "libiberty.h".
5923
5924 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
5925
5926         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
5927         function, is_info_ member.
5928         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
5929         (Versions::Versions): Update caller.
5930         (Versions::define_base_version): Likewise.
5931         (Versions::add_def): Likewise.
5932
5933 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
5934
5935         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
5936         (Scan::possible_function_pointer_reloc): New function.
5937         (Scan::local_reloc_may_be_function_pointer): Change to call
5938         possible_function_pointer_reloc.
5939         (Scan::global_reloc_may_be_function_pointer): Ditto.
5940         * icf.h (Icf::check_section_for_function_pointers): Change to reject
5941         relocations in ".data.rel.ro._ZTV" section.
5942         * testsuite/icf_safe_so_test.sh: Change to pass i386.
5943         * testsuite/icf_safe_so_test.cc: Ditto.
5944         * testsuite/icf_safe_test.cc: Ditto.
5945         * testsuite/icf_safe_test.sh: Ditto.
5946
5947 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5948             Ian Lance Taylor  <iant@google.com>
5949
5950         * target-reloc.h (relocate_section): Check the symbol table index
5951         for -1U before setting the local symbol index.
5952         (scan_relocatable_relocs): If copying the relocation, record that
5953         the local symbol is required.
5954         * object.h (Symbol_value::is_output_symtab_index_set): New
5955         function.
5956         (Symbol_value::may_be_discarded_from_output_symtab): New
5957         function.
5958         (Symbol_value::has_output_symtab_entry): New function.
5959         (Symbol_value::needs_output_symtab_entry): Remove.
5960         (Symbol_value::output_symtab_index): Make sure the symbol index is
5961         set.
5962         (Symbol_value::set_output_symtab_index): Make sure the symbol
5963         index is not set.  Make sure the new index is valid.
5964         (Symbol_value::set_must_have_output_symtab_entry): New function.
5965         (Symbol_value::has_output_dynsym_entry): New function.
5966         (Symbol_value::set_output_dynsym_index): Make sure the new index
5967         is valid.
5968         (Sized_relobj::set_must_have_output_symtab_entry): New function.
5969         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
5970         local symbol if permitted.
5971         (Sized_relobj::do_finalize_local_symbols): Call
5972         is_output_symtab_index_set rather than needs_output_symtab_entry.
5973         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
5974         rather than needs_output_symtab_entry.  Call
5975         has_output_dynsym_entry rather than needs_output_dynsym_entry.
5976         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
5977         is_output_symtab_index_set rather than needs_output_symtab_entry.
5978         * testsuite/discard_locals_relocatable_test.c: New file.
5979         * testsuite/discard_locals_test.sh: Test -r.
5980         * testsuite/Makefile.am (check_DATA): Add
5981         discard_locals_relocatable_test1.syms,
5982         discard_local_relocatable_test2.syms.
5983         (MOSTLYCLEANFILES): Likewise.  Also add
5984         discard_locals_relocatable_test1.lout and
5985         discard_locals_relocatable_test2.out.
5986         (discard_locals_relocatable_test1.syms): New target.
5987         (discard_locals_relocatable_test.o): New target.
5988         (discard_locals_relocatable_test1.out): New target.
5989         (discard_locals_relocatable_test2.syms): New target.
5990         (discard_locals_relocatable_test2.out): New target.
5991         (various): Add missing ../ld-new dependencies.
5992         * testsuite/Makefile.in: Rebuild.
5993
5994 2010-03-03  Nick Clifton  <nickc@redhat.com>
5995
5996         * po/fi.po: New Finnish translation.
5997
5998 2010-03-01  Doug Kwan  <dougkwan@google.com>
5999
6000         * layout.cc (Layout::Layout): Force section types of .init_array*,
6001         .preinit_array* and .fini_array* sections.
6002         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6003         Fix check of return value of std::string::find.().
6004         (Output_section::Input_section_sort_compare::operator()): Remove
6005         comment about .init_array.
6006         (Output_section::Input_section_sort_init_fini_compare::operator()):
6007         New method.
6008         (Output_section::sort_attached_input_sections): Handle .init_array
6009         and .fini_array specially.
6010         * output.h (Output_section::Inut_section_sort_compare): Update
6011         comment.
6012         (Output_section::Input_section_sort_init_fini_compare): New struct.
6013
6014 2010-02-26  Doug Kwan  <dougkwan@google.com>
6015
6016         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6017         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6018         * testsuite/debug_msg.sh: Avoid matching source line number for
6019         use of global variable undef_int.
6020
6021 2010-02-26  Doug Kwan  <dougkwan@google.com>
6022
6023         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6024         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6025         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6026         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6027         * options.cc (General_options::General_options): Initialize member
6028         fix_v4bx_.
6029         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6030         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6031         and rm_no_fix_v4bx.stdout
6032         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6033         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6034         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6035         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6036         and arm_no_fix_v4bx.
6037         * Makefile.in: Regenerate.
6038         * testsuite/arm_fix_v4bx.s: New file.
6039         * testsuite/arm_fix_v4bx.sh: Ditto.
6040
6041 2010-02-24  Doug Kwan  <dougkwan@google.com>
6042
6043         * arm.cc (Target_arm::got_section): Make the .got section the first
6044         non RELRO section in the data segment.
6045         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6046         suffixes of section names.
6047
6048 2010-02-24  Doug Kwan  <dougkwan@google.com>
6049
6050         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6051         flags and attributes merging if an input file is a binary file.
6052         * fileread.cc (Input_file::open): Record format of original file.
6053         * fileread.h (Input_file::Format): New enum type.
6054         (Input_file::Input_file): Initialize data member format_.
6055         (Input_file::format): New method definition.
6056         (Input_file::format_):: New data member.
6057
6058 2010-02-24  Doug Kwan  <dougkwan@google.com>
6059
6060         * arm.cc (Arm_output_data_got): New class.
6061         (ARM_TCB_SIZE): New constant
6062         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6063         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6064         If user uses a script with a SECTIONS clause, issue only a warning
6065         for a misplaced EXIDX input section.  Otherwise, issue an error.
6066         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6067         garbage collection.
6068         (Target_arm::got_mode_index_entry): Handle static linking.
6069         (Target_arm::Scan::local): Ditto.
6070         (Target_arm::Scan::global): Ditto.
6071         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6072         all incorrectly implemented relocations.
6073         (Target_arm::fix_exidx_coverage): Pass layout to
6074         Arm_output_section::fix_exidx_coverage.
6075         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6076         from ".ARM.exidx." and ".ARM.extab.".
6077
6078 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6079
6080         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6081         section if it does not already exist.
6082         * attributes.cc (Attributes_section_data::Attributes_section_data):
6083         Don't crash if size is zero.
6084
6085 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6086             Ian Lance Taylor  <iant@google.com>
6087
6088         * gold.cc (queue_middle_tasks): If no input files were opened,
6089         exit.
6090         * workqueue.h (Task_function::Task_function): Assert that there is
6091         a blocker.
6092
6093 2010-02-22  Doug Kwan  <dougkwan@google.com>
6094
6095         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6096         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6097         types to avoid warnings due to different uint64_t implementations
6098         on different hosts.
6099
6100 2010-02-21  Doug Kwan  <dougkwan@google.com>
6101
6102         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6103         handling of the maximum backward branch offset.
6104         (Arm_relocate_functions::thumb_branch_common): Ditto.
6105         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6106         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6107         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6108         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6109         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6110         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6111         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6112         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6113         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6114         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6115         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6116         thumb2_bl_out_of_range.o): New rules.
6117         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6118         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6119         thumb2_bl_out_of_range
6120         * testsuite/Makefile.in: Regenerate.
6121         * testsuite/arm_bl_in_range.s: New file.
6122         * testsuite/arm_bl_out_of_range.s: Ditto.
6123         * testsuite/arm_branch_in_range.sh: Ditto.
6124         * testsuite/arm_branch_range.t: Ditto.
6125         * testsuite/thumb2_branch_range.t: Ditto.
6126         * testsuite/thumb_bl_in_range.s: Ditto.
6127         * testsuite/thumb_bl_out_of_range.s: Ditto.
6128         * testsuite/thumb_branch_range.t: Ditto.
6129
6130 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6131
6132         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6133         Add reloc offset information.
6134         * icf.cc (get_section_contents): Change iterators to point to the new
6135         vectors. Add reloc offset information to the contents.
6136         * icf.h (Icf::Sections_reachable_info): New typedef.
6137         (Icf::Sections_reachable_list): New typedef.
6138         (Icf::Offset_info): New typedef.
6139         (Icf::Reloc_info): New struct typedef.
6140         (Icf::Reloc_info_list): New typedef.
6141         (Icf::symbol_reloc_list): Delete method.
6142         (Icf::addend_reloc_list): Delete method.
6143         (Icf::section_reloc_list): Delete method.
6144         (Icf::reloc_info_list): New method.
6145         (Icf::reloc_info_list_): New member.
6146
6147 2010-02-19  Doug Kwan  <dougkwan@google.com>
6148
6149         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6150         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6151         * arm.cc (Arm_relocation_functions): New forward declaration.
6152         (Target_arm::Target_arm): Initialize new data members
6153         got_mod_index_offset_ and tls_base_symbol_defined_.
6154         (Target_arm::Relocate::relocate_tls): New method.
6155         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6156          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6157         New methods.
6158         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6159         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6160         (Target_arm::got_mod_index_offset_,
6161         Target_arm::tls_base_symbol_defined_): New data members.
6162         (Target_arm::Scan::local, Target::Scan::global,
6163         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6164         relocations.
6165
6166 2010-02-18  Doug Kwan  <dougkwan@google.com>
6167
6168         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6169         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6170         text section as a parameter becuase some broken tools may not set
6171         the link in section header.
6172         (Target_arm::has_got_section): New method.
6173         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6174         without any mapping symbol as data only.  Remove warning.
6175         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6176         link in its section header, try to discover the link by inspecting the
6177         REL31 relocation at the beginning of the section.
6178         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6179         in error message.
6180         (Target_arm::Scan::global): Treat any reference to the symbol
6181         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6182
6183 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6184
6185         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6186         (Scan::global_reloc_may_be_function_pointer): New function.
6187         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6188         (Scan::global_reloc_may_be_function_pointer): New function.
6189         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6190         (Scan::global_reloc_may_be_function_pointer): New function.
6191         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6192         (Scan::global_reloc_may_be_function_pointer): New function.
6193         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6194         (Scan::global_reloc_may_be_function_pointer): New function.
6195         (Scan::possible_function_pointer_reloc): New function.
6196         (Target_x86_64::can_check_for_function_pointers): New function.
6197         * gc.h (gc_process_relocs): Scan relocation types to determine if
6198         function pointers were taken for targets that support it.
6199         * icf.cc (Icf::find_identical_sections): Include functions for
6200         folding in safe ICF whose pointer is not taken.
6201         * icf.h (Secn_fptr_taken_set): New typedef.
6202         (fptr_section_id_): New member.
6203         (section_has_function_pointers): New function.
6204         (set_section_has_function_pointers): New function.
6205         (check_section_for_function_pointers): New function.
6206         * options.h: Fix comment for safe ICF option.
6207         * target.h (can_check_for_function_pointers): New function.
6208         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6209         Modify icf_safe_test for X86-64.
6210         * testsuite/Makefile.in: Regenerate.
6211         * testsuite/icf_safe_so_test.cc: New file.
6212         * testsuite/icf_safe_so_test.sh: New file.
6213         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6214         (main): Change to take pointer to function kept_func_3.
6215         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6216         folding is done correctly for X86-64.
6217
6218 2010-02-12  David S. Miller  <davem@davemloft.net>
6219
6220         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6221         is_symbolless parameter.
6222         (Output_reloc<SHT_REL>::is_symbolless): New.
6223         (Output_reloc<SHT_REL>::is_symbolless_): New.
6224         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6225         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6226         (Output_reloc<SHT_RELA>::is_symbolless): New.
6227         (Output_data_reloc::add_global): Handle is_symbolless.
6228         (Output_data_reloc::add_global_relative): Likewise.
6229         (Output_data_reloc::add_local): Likewise.
6230         (Output_data_reloc::add_local_relative): Likewise.
6231         (Output_data_reloc::add_symbolless_global_addend): New.
6232         (Output_data_reloc::add_symbolless_local_addend): New.
6233         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6234         is_symbolless.
6235         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6236         instead of ->is_relative_
6237         (Output_reloc::write): Likewise.
6238         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6239         (Output_reloc::write_rel): Simplify.
6240
6241         * sparc.cc (Target_sparc::Scan::local): Use
6242         ->add_symbolless_local_addend as needed.
6243         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6244         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6245         based upon relocation offset.
6246
6247 2010-02-11  Doug Kwan  <dougkwan@google.com>
6248
6249         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6250         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6251         beginning of function.
6252         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6253         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6254         parameter is_32bit in calls to should_apply_static_reloc.
6255         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6256         (check_DATA): Add arm_abs_global.stdout.
6257         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6258         arm_abs_global.stdout): New rules.
6259         (MOSTLLYCLEANFILES): Add arm_abs_global
6260         * Makefile.in: Regenerate.
6261         * testsuite/arm_abs_global.s: New file.
6262         * testsuite/arm_abs_global.sh: Ditto.
6263         * testsuite/arm_abs_lib.s: Ditto.
6264
6265 2010-02-11  Ian Lance Taylor  <iant@google.com>
6266
6267         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6268         Read_relocs task.
6269         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6270         Allocate_commons_task first.
6271         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6272         task, rather than symtab_lock_.
6273         (Gc_process_relocs::~Gc_process_relocs): New function.
6274         (Gc_process_relocs::is_runnable): Check this_blocker_.
6275         (Gc_process_relocs::locks): Use next_blocker_ rather than
6276         blocker_.
6277         (Scan_relocs::~Scan_relocs): New function.
6278         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6279         symtab_lock_.
6280         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6281         next_blocker_.
6282         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6283         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6284         constructor accordingly.
6285         (class Gc_process_relocs): Likewise.
6286         (class Scan_relocs): Likewise.
6287         * common.h (class Allocate_commons_task): Remove symtab_lock_
6288         field, and corresponding constructor parameter.
6289         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6290         symtab_lock_.
6291         (Allocate_commons_task::locks): Likewise.
6292
6293 2010-02-11  Ian Lance Taylor  <iant@google.com>
6294
6295         * gold-threads.h (class Once): Define.
6296         (class Initialize_lock): Rewrite as child of Once.
6297         * gold-threads.cc (class Once_initialize): Define.
6298         (once_pointer_control): New static variable.
6299         (once_pointer, once_arg): New static variables.
6300         (c_run_once): New static function.
6301         (Once::Once, Once::run_once, Once::internal_run): New functions.
6302         (class Initialize_lock_once): Remove.
6303         (initialize_lock_control): Remove.
6304         (initialize_lock_pointer): Remove.
6305         (initialize_lock_once): Remove.
6306         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6307         (Initialize_lock::initialize): Rewrite.
6308         (Initialize_lock::do_run_once): New function.
6309         * archive.cc (Archive::interpret_header): Only clear name if it is
6310         not already empty.
6311         * fileread.cc: Include "gold-threads.h"
6312         (file_counts_lock): New static variable.
6313         (file_counts_initialize_lock): Likewise.
6314         (File_read::release): Only increment counts when using --stats.
6315         Use a lock around the increment.
6316         * parameters.cc (class Set_parameters_target_once): Define.
6317         (set_parameters_target_once): New static variable.
6318         (Parameters::Parameters): Move here from parameters.h.
6319         (Parameters::set_target): Rewrite.
6320         (Parameters::set_target_once): New function.
6321         (Parameters::clear_target): Move here and rewrite.
6322         * parameters.h (class Parameters): Update declarations.  Add
6323         set_parameters_target_once_ field.
6324         (Parameters::Parameters): Move to parameters.cc.
6325         (Parameters::clear_target): Likewise.
6326         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6327         task.
6328         (Start_group::~Start_group): New function.
6329         (Start_group::is_runnable): New function.
6330         (Start_group::locks, Start_group::run): New functions.
6331         (Finish_group::run): Change saw_undefined to size_t.
6332         * readsyms.h (class Start_group): Define.
6333         (class Finish_group): Change saw_undefined_ field to size_t.
6334         (Finish_group::Finish_group): Remove saw_undefined and
6335         this_blocker parameters.  Change all callers.
6336         (Finish_group::set_saw_undefined): New function.
6337         (Finish_group::set_blocker): New function.
6338         * symtab.h (class Symbol_table): Change saw_undefined to return
6339         size_t.  Change saw_undefined_ field to size_t.
6340         * target-select.cc (Set_target_once::do_run_once): New function.
6341         (Target_selector::Target_selector): Initialize set_target_once_
6342         field.  Don't initialize lock_ and initialize_lock_ fields.
6343         (Target_selector::instantiate_target): Rewrite.
6344         (Target_selector::set_target): New function.
6345         * target-select.h (class Set_target_once): Define.
6346         (class Target_selector): Update declarations.  Make
6347         Set_target_once a friend.  Remove lock_ and initialize_lock_
6348         fields.  Add set_target_once_ field.
6349
6350 2010-02-10  Ian Lance Taylor  <iant@google.com>
6351
6352         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6353         queueing any tasks.
6354         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6355         (queue_middle_tasks): Add all blockers before queueing any tasks.
6356         (queue_final_tasks): Likewise.
6357         * token.h (Task_token::add_blockers): New function.
6358         * object.h (Input_objects::number_of_relobjs): New function.
6359
6360 2010-02-10  Ian Lance Taylor  <iant@google.com>
6361
6362         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6363         shared, not if not position independent.
6364         * x86_64.cc (Relocate::relocate_tls): Likewise.
6365         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6366         (tls_pie_pic_test): New target.
6367         * testsuite/Makefile.in: Rebuild.
6368
6369         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6370         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6371         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6372         * testsuite/Makefile.in: Rebuild.
6373
6374 2010-02-09  David S. Miller  <davem@davemloft.net>
6375
6376         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6377         R_SPARC_RELATIVE using ->add_local_relative().
6378         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6379
6380         * output.h (Output_data_dynamic::add_section_size): New method
6381         that takes two Output_data objects.
6382         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6383         entry param.  Handle it in initializers.
6384         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6385         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6386         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6387         arg.
6388         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6389         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6390         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6391         for dynrel_includes_plt.
6392         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6393         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6394         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6395         before .rela.plt
6396         (Target_sparc::do_finalize_sections): Update to pass true for
6397         dynrel_includes_plt.
6398         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6399         output before .rela.plt
6400         (Target_powerpc::do_finalize_sections): Update to pass true for
6401         dynrel_includes_plt when 32-bit.
6402
6403 2010-02-08  Doug Kwan  <dougkwan@google.com>
6404
6405         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6406         method.
6407         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6408         Arm_relobj::scan_section_for_cortex_a8_stubs,
6409         Arm_relobj::do_relocation_section): Instead of calling
6410         Output_section::output_address, use faster
6411         Arm_relobj::simple_input_section_output_address.
6412
6413 2010-02-08  David S. Miller  <davem@davemloft.net>
6414
6415         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6416         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6417         relocation helper function.
6418
6419         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6420         just like R_SPARC_GOT{10,13,22}.
6421         (Target_sparc::Scan::local): Likewise.
6422         (Target_sparc::Relocate:relocate): Likewise.
6423
6424 2010-02-06  Ian Lance Taylor  <iant@google.com>
6425
6426         * configure.ac: Rewrite targetobjs duplicate removal code to use
6427         only shell constructs.
6428         * configure: Rebuild.
6429
6430 2010-02-05  Doug Kwan  <dougkwan@google.com>
6431
6432         PR 11247
6433         * arm.cc (Arm_relobj::section_is_scannable): New method.
6434         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6435         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6436
6437 2010-02-04  Doug Kwan  <dougkwan@google.com>
6438
6439         PR 11247
6440         * arm-reloc-property.cc (cstdio): Include.
6441         * configure.ac (targetobjs): Remove duplicates.
6442         * configure: Regenerate.
6443         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6444         big and little endian version for a given address size.
6445
6446 2010-02-03  Doug Kwan  <dougkwan@google.com>
6447
6448         * arm-reloc-property.cc
6449         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6450         definition.
6451         * arm-reloc-property.h
6452         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6453         New method definition.
6454         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6455         declaration.
6456         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6457         overflow to N.
6458         (GOT_PREL): Change implemented to Y.
6459         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6460         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6461         (Arm_relocate_functions::movw_abs_nc): Remove method.
6462         (Arm_relocate_functions::movt_abs): Ditto.
6463         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6464         (Arm_relocate_functions::thm_movt_abs): Ditto.
6465         (Arm_relocate_functions::movw_rel_nc): Ditto.
6466         (Arm_relocate_functions::movw_rel): Ditto.
6467         (Arm_relocate_functions::movt_rel): Ditto.
6468         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6469         (Arm_relocate_functions:thm_movw_rel): Ditto.
6470         (Arm_relocate_functions:thm_movt_rel): Ditto.
6471         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6472         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6473         New method definitions.
6474         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6475         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6476         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6477         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6478         (Target_arm::Relocate::relocate): Check for non-static or
6479         unimplemented relocation code and exit early.  Change calls to
6480         Target_arm::reloc_uses_thumb_bit and
6481         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6482         instead.  Refactor code to handle similar relocations to increase
6483         code sharing.  Remove check for unsupported relocation code in switch
6484         statement.
6485         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6486         relocation property table to find out size.  Change error message to
6487         print out the name of a relocation code instead of the numeric value.
6488         (Target_arm::scan_reloc_for_stub): Use relocation property table
6489         instead of calling Target_arm::reloc_uses_thumb_bit().
6490
6491 2010-02-02  Doug Kwan  <dougkwan@google.com>
6492
6493         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6494         types of relaxed input section.
6495
6496 2010-02-02  Doug Kwan  <dougkwan@google.com>
6497
6498         * Makefile.am (HFILES): Add arm-reloc-property.h.
6499         (DEFFILES): New.
6500         (TARGETSOURCES): Add arm-reloc-property.cc
6501         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6502         (libgold_a_SOURCES): $(DEFFILES)
6503         * Makefile.in: Regenerate.
6504         * arm-reloc-property.cc: New file.
6505         * arm-reloc-property.h: New file.
6506         * arm-reloc.def: New file.
6507         * arm.cc: Update comments.
6508         (arm-reloc-property.h): New included header.
6509         (arm_reloc_property_table): New global variable.
6510         (Target_arm::do_select_as_default_target): New method definition.
6511         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6512         arm-reloc-property to targ_extra_obj.
6513         * parameters.cc (set_parameters_target): Call
6514         Target::select_as_default_target().
6515         * target.h (Target::select_as_default_target): New method definition.
6516         (Target::do_select_as_default_target): Same.
6517
6518 2010-02-01  Doug Kwan  <dougkwan@google.com>
6519
6520         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6521         first_output_text_section_.
6522         (Arm_exidx_fixup::first_output_text_section): New method definition.
6523         (Arm_exidx_fixup::first_output_text_section_): New data member.
6524         (Arm_exidx_fixup::process_exidx_section): Record the first text
6525         output section seen.
6526         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6527         and entsize in output section header.
6528
6529 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6530
6531         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6532         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6533         (Arm_relocate_functions::thm_alu11): New Method.
6534         (Arm_relocate_functions::thm_pc8): New Method.
6535         (Arm_relocate_functions::thm_pc12): New Method.
6536         (Target_arm::Scan::local): Handle the relocations.
6537         (Target_arm::Scan::global): Likewise.
6538         (Target_arm::Relocate::relocate): Likewise.
6539         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6540
6541 2010-01-29  Doug Kwan  <dougkwan@google.com>
6542
6543         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6544         of relocation types as ld.
6545
6546 2010-01-29  Doug Kwan  <dougkwan@google.com>
6547
6548         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6549         to public.
6550         (Arm_relocate_functions::thumb_branch_common): Ditto.
6551         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6552         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6553         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6554         Arm_relocate_functions::jump24): Remove.
6555         (Target_arm::Relocate::relocate): Adjust code to call
6556         Arm_relocation_functions::arm_branch_common and
6557         Arm_relocation_functions::thumb_branch_common instead of their removed
6558         wrappers.  Merge switch-cases together to reduce source code size.
6559
6560 2010-01-29  Doug Kwan  <dougkwan@google.com>
6561
6562         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6563         output_local_symbol_count_needs_update_.
6564         (Arm_relobj::output_local_symbol_count_needs_update,
6565          Arm_relobj::set_output_local_symbol_count_needs_update,
6566          Arm_relobj::update_output_local_symbol_count): New methods.
6567         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6568         member.
6569         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6570         of pointed function as in a R_ARM_PREL31 relocation.
6571         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6572         for output local symbol count updating.
6573         (Target_arm::do_relax): Update output local symbol counts in objects
6574         if necessary.
6575         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6576
6577 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6578
6579         * arm.cc: Added support for the ARM relocations:
6580         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6581         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6582         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6583         movw_prel_nc).
6584         (Arm_relocate_functions::movw_rel): New method.
6585         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6586         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6587         thm_movw_prel_nc).
6588         (Arm_relocate_functions::thm_movw_rel): New method.
6589         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6590         thm_movt_prel).
6591         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6592         relocations.
6593         (Target_arm::Scan::global): Likewise.
6594         (Target_arm::Relocate::relocate): Likewise.
6595         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6596         Likewise.
6597
6598 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6599
6600         * arm.cc: Added support for ARM group relocations.
6601         (Target_arm::reloc_needs_sym_origin): New method.
6602         (Arm_relocate_functions::calc_grp_kn): New method.
6603         (Arm_relocate_functions::calc_grp_residual): New method.
6604         (Arm_relocate_functions::calc_grp_gn): New method.
6605         (Arm_relocate_functions::arm_grp_alu): New Method.
6606         (Arm_relocate_functions::arm_grp_ldr): New Method.
6607         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6608         (Arm_relocate_functions::arm_grp_ldc): New Method.
6609         (Target_arm::Scan::local): Handle the ARM group relocations.
6610         (Target_arm::Scan::global): Likewise.
6611         (Target_arm::Relocate::relocate): Likewise.
6612         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6613         Likewise.
6614
6615 2010-01-26  Doug Kwan  <dougkwan@google.com>
6616
6617         * arm.cc (set): Include.
6618         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6619         pointer type.
6620         (Arm_output_section::Text_section_list): New type.
6621         (Arm_output_section::append_text_sections_to_list): New method.
6622         (Arm_output_section::fix_exidx_coverage): Ditto.
6623         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6624         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6625         Relobj::set_section_offset() instead of
6626         Sized_relobj::invalidate_section_offset().
6627         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6628         parameter for section headers. Ignore relocation sections for
6629         unallocated sections and EXIDX sections.
6630         (Target_arm::fix_exidx_coverage): New method.
6631         (Target_arm::output_section_address_less_than): New type.
6632         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6633         linked text section instead of the EXIDX section.
6634         (Arm_output_section::create_stub_group): Add an assertion to check
6635         that this is not an EXIDX output section.
6636         (Arm_output_section::append_text_sections_to_list): New method.
6637         (Arm_output_section::fix_exidx_coverage): Ditto.
6638         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6639         Arm_relobj::section_needs_reloc_stub_scanning.
6640         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6641         first pass.
6642         (Target_arm::fix_exidx_coverage): New method.
6643         * object.h (Relobj::set_output_section): New method.
6644         (Sized_relobj::invalidate_section_offset): Remove method.
6645         (Sized_relobj::do_invalidate_section_offset): Remove method.
6646         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6647
6648 2010-01-25  Doug Kwan  <dougkwan@google.com>
6649
6650         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6651         Fix warning due to signed and unsigned comparison on a 32-bit host.
6652
6653 2010-01-22  Doug Kwan  <dougkwan@google.com>
6654
6655         * arm.cc (Target_arm::do_relax): Record an output section for section
6656         offset adjustment it contains any stub table that has changed.
6657         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6658         offsets in an output section if necessary.
6659         * output.cc (Output_section::Output_section): Initialize
6660         section_offsets_need_adjustments_.
6661         (Output_section::add_input_section_for_script): Renamed to
6662         Output_section::add_simple_input_section.
6663         (Output_section::save_states): Add a comment.
6664         (Output_section::discard_states): New method defintion.
6665         (Output_section::adjust_section_offsets): Same.
6666         * output.h (Output_section::add_input_section_for_script): Renamed to
6667         Output_section::add_simple_input_section.
6668         (Output_section::discard_states): New method declaration.
6669         (Output_section::adjust_section_offsets): Same.
6670         (Output_section::section_offsets_need_adjustment,
6671         Output_section::set_section_offsets_need_adjustment): New method
6672         definitions.
6673         (Output_section::section_offsets_need_adjustment_): New data member.
6674         * script-sections.cc
6675         (Output_section_element_input::set_section_address): Adjust code for
6676         renaming of Output_section::add_input_section_for_script.
6677         (Orphan_output_section::set_section_address): Same.
6678
6679 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6680
6681         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6682         Fix_v4bx enum values .
6683         * gold/options.h (General_options): New option definitions.
6684         (General_options::fix_v4bx): New method.
6685         (General_options::Fix_v4bx): New enum.
6686         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6687         (General_options::parse_fix_v4bx_interworking): New method.
6688
6689 2010-01-22  Doug Kwan  <dougkwan@google.com>
6690
6691         * arm.cc (Arm_exidx_fixup): New class.
6692
6693 2010-01-21  Doug Kwan  <dougkwan@google.com>
6694
6695         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6696         classes.
6697         (Arm_exidx_section_offset_map): New type.
6698
6699 2010-01-21  Doug Kwan  <dougkwan@google.com>
6700
6701         * arm.cc (Arm_exidx_input_section): New class.
6702         (Arm_relobj::exidx_input_section_by_link,
6703         Arm_relobj::exidx_input_section_by_shndx,
6704         Arm_relobj::make_exidx_input_section): New methods.
6705         (read_arm_attributes_section): Remove.
6706         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6707         information about them.
6708         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6709         to here.
6710
6711 2010-01-20  Doug Kwan  <dougkwan@google.com>
6712
6713         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6714         Input_section_specifier to Section_id.
6715         (Target_arm::new_arm_input_section: Adjust code for change of key
6716         type.
6717         (Target_arm::find_arm_input_section): Ditto.
6718         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6719         (Section_id): Remove.
6720         (Garbage_collection::Section_id_hash): Remove.
6721         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6722         (Section_id): Remove.
6723         (Icf::Section_id_hash): Remove.
6724         * object.h (Section_id, Const_section_id, Section_id_hash,
6725         Const_section_id_hash): New type definitions.
6726         * output.cc (Output_section::add_relaxed_input_section): Change to
6727         use Const_section_id instead of Input_section_specifier as key type.
6728         (Output_section::add_merge_input_section): Ditto.
6729         (Output_section::build_relaxation_map): Change to use Section_id
6730         instead of Input_section_specifier as key type.
6731         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6732         Ditto.
6733         (Output_section::convert_input_sections_to_relaxed_sections): Change
6734         to use Const_section_id instead of Input_section_specifier as key type.
6735         (Output_section::find_merge_section): Ditto.
6736         (Output_section::find_relaxed_input_section): Ditto.
6737         * output.h (Input_section_specifier): Remove class.
6738         (Output_section::Output_section_data_by_input_section_map): Change
6739         key type to Const_section_id.
6740         (Output_section::Output_relaxed_input_section_by_input_section_map):
6741         Ditto.
6742         (Output_section::Relaxation_map): Change key type to Section_id.
6743
6744 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6745
6746         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6747         (class Arm_v4bx_stub): New class.
6748         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6749         (Stub_factory::make_arm_v4bx_stub): New method.
6750         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6751         (Stub_table::empty): Handle v4bx stubs.
6752         (Stub_table::add_arm_v4bx_stub): New method.
6753         (Stub_table::find_arm_v4bx_stub): New method.
6754         (Arm_relocate_functions::v4bx): New method.
6755         (Target_arm::fix_v4bx): New method.
6756         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6757         (Stub_table::relocate_stubs): Likewise.
6758         (Stub_table::do_write): Likewise.
6759         (Stub_table::update_data_size_and_addralign): Likewise.
6760         (Stub_table::finalize_stubs):  Likewise.
6761         (Target_arm::Scan::local): Likewise.
6762         (Target_arm::Scan::global): Likewise.
6763         (Target_arm::do_finalize_sections): Likewise.
6764         (Target_arm::Relocate::relocate): Likewise.
6765         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6766         Likewise.
6767         (Target_arm::scan_reloc_for_stub): Likewise.
6768         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6769
6770 2010-01-19  Ian Lance Taylor  <iant@google.com>
6771
6772         * output.cc (Output_section_headers::do_sized_write): Write large
6773         segment count to sh_info field.
6774         (Output_file_header::do_sized_write): For large segment count,
6775         write PN_XNUM to e_phnum field.
6776
6777 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6778
6779         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6780         (Arm_relocate_functions::thm_jump8): New function.
6781         (Arm_relocate_functions::thm_jump11): New function.
6782         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6783         R_ARM_THM_JUMP11.
6784         (Target_arm::Scan::global): Likewise.
6785         (Target_arm::Relocate::relocate): Likewise.
6786         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6787         Likewise.
6788
6789 2010-01-14  Doug Kwan  <dougkwan@google.com>
6790
6791         * arm.cc (map, utility): Include headers.
6792         (Target_arm::apply_cortex_a8_workaround): New method.
6793         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
6794         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
6795         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
6796         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
6797         the --[no-]fix-cortex-a8 command line options.
6798         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
6799         (Target_arm::relocate_stub): Use addend in instruction template.
6800         * options.h (DEFINE_bool): Set the user-set flag.
6801         (General_options): Add --[no-]-fix-cortex options.
6802         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
6803         : Update fast look-up map after conversion.
6804
6805 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
6806
6807         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
6808         in the first pass of do_layout.
6809
6810 2010-01-13  Doug Kwan  <dougkwan@google.com>
6811
6812         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6813         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
6814         apparent compiler problem of not folding static constant integral
6815         data members of elfcpp::Elf_sizes<32>.
6816
6817 2010-01-13  Doug Kwan  <dougkwan@google.com>
6818
6819         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
6820         Arm_relobj::section_needs_cortex_a8_stub_scanning,
6821         Arm_relobj::scan_section_for_cortex_a8_erratum,
6822         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
6823         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
6824         sections to scan for relocation stubs into a new method
6825         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
6826         relocation and Cortex-A8 stub scanning.
6827         (Target_arm::do_relax): Force stubs to be after stubbed sections
6828         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
6829         the beginning of a new relaxation pass.  Update a comment.
6830         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
6831
6832 2010-01-12  Ian Lance Taylor  <iant@google.com>
6833
6834         * target-reloc.h (visibility_error): New inline function.
6835         (relocate_section): Call visibility_error.
6836         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
6837         (MOSTLYCLEANFILES): Likewise.
6838         (protected_4_pic.o, protected_3.err): New targets.
6839         * testsuite/protected_4.cc: New file.
6840
6841 2010-01-12  Doug Kwan  <dougkwan@google.com>
6842
6843         * arm.cc (Cortex_a8_reloc): New class.
6844         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
6845         and cortex_a8_relocs_info_.
6846         (Target_arm::fix_cortex_a8): New method definition.
6847         (Target_arm::Cortex_a8_relocs_info): New type.
6848         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
6849         New data member declarations.
6850         (Target_arm::scan_reloc_for_stub): Record information about
6851         relocations for THUMB branches that might be exempted from the
6852         Cortex-A8 workaround.
6853         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
6854         at the beginning of a relaxation pass.
6855
6856 2010-01-12  Doug Kwan  <dougkwan@google.com>
6857
6858         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
6859         (Arm_relobj::Mapping_symbol_position,
6860          Arm_reloj::Mapping_symbol_position_less,
6861          Arm_relobj::Mapping_symbols_info): New types.
6862         (Target_arm::is_mapping_symbol_name): New method definition.
6863         (Arm_relobj::do_count_local_symbols): Save information about mapping
6864         symbols.
6865
6866 2010-01-11  Doug Kwan  <dougkwan@google.com>
6867
6868         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
6869         Arm_relocate_functions::thumb32_branch_upper,
6870         Arm_relocate_functions::thumb32_branch_lower,
6871         Arm_relocate_functions::thumb32_cond_branch_offset,
6872         Arm_relocate_functions::thumb32_cond_branch_upper,
6873         Arm_relocate_functions::thumb32_cond_branch_lower,
6874         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
6875         branch offset encoding.
6876         (Arm_relocate_functions::thumb_branch_common): Use new branch
6877         offset encoding methods to avoid code duplication.
6878         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
6879         (Stub_addend_reader::operator()): Use new branch encoding method
6880         to avoid code duplication.
6881
6882 2010-01-11  Doug Kwan  <dougkwan@google.com>
6883
6884         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
6885         (Target_arm::do_finalize_sections): Define special EXIDX section
6886         symbols only if referenced.
6887         * gc.h (Garbage_collection::add_reference): New method.
6888         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
6889         code duplication.
6890
6891 2010-01-11  Ian Lance Taylor  <iant@google.com>
6892
6893         * script.cc (Version_script_info::build_expression_list_lookup):
6894         Change complaing about duplicate wildcard match from error to
6895         warning.
6896
6897         * script.cc (class Lazy_demangler): Recreate--revert part of patch
6898         of 2009-12-30.
6899         (Version_script_info::Version_script_info): Initialize globs_,
6900         default_version_, default_is_global_, and exact_.  Don't
6901         initialize globals_ or locals_.
6902         (Version_script_info::build_lookup_tables): Build local symbols
6903         first.
6904         (Version_script_info::unquote): New function.
6905         (Version_script_info::add_exact_match): New function.
6906         (Version_script_info::build_expression_list_lookup): Remove lookup
6907         parameter.  Add is_global parameter.  Change all callers.  Handle
6908         wildcard pattern specially.  Unquote pattern.  Call
6909         add_exact_match.
6910         (Version_script_info::get_name_to_match): New function.
6911         (Version_script_info::get_symbol_version): New function.
6912         (Version_script_info::get_symbol_version_helper): Remove.
6913         (Version_script_info::check_unmatched_names): Call unquote.
6914         * script.h (class Version_script_info): Change get_symbol_version
6915         to be non-inline and add is_global parameter; change all callers.
6916         Rewrite symbol_is_local.  Update declarations.  Define struct
6917         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
6918         Remove globals_ and locals_ members.  Add exact_, globs_,
6919         default_version_, is_global_.
6920         (Version_script_info::Glob): Remove pattern, add expression and
6921         is_global.  Update constructor.  Change all callers.
6922         * dynobj.cc (Versions::finalize): Mark the version symbol as the
6923         default version.
6924         (Versions::symbol_section_contents): If a symbol is undefined, or
6925         defined in a dynamic object, set the version index to
6926         VER_NDX_LOCAL.
6927         * symtab.cc (Symbol_table::add_from_relobj): Don't call
6928         symbol_is_local.
6929         (Symbol_table::add_from_pluginobj): Likewise.
6930         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
6931
6932 2010-01-11  Doug Kwan  <dougkwan@google.com>
6933
6934         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
6935         (incremental_dump_LDADD): Add linking option for libintl.
6936         * Makefile.in: Regenerate.
6937
6938 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
6939
6940         PR gold/11144
6941         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
6942         instead of -Ds.
6943         * testsuite/Makefile.in: Regenerated.
6944
6945 2010-01-10  Doug Kwan  <dougkwan@google.com>
6946
6947         * options.h (DEFINE_var): Use parentheses around argument varname__
6948         in macro body to avoid any unintended subsequent substitutions.
6949
6950 2010-01-10  Ian Lance Taylor  <iant@google.com>
6951
6952         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
6953         candidates before doing symbol resolution.
6954
6955         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
6956         ODR candidates if only one is weak.
6957
6958 2010-01-08  Ian Lance Taylor  <iant@google.com>
6959
6960         * script.cc (Version_script_info::build_expression_list_lookup):
6961         Don't warn about ambiguous version, just record the ambiguity.
6962         (Version_script_info::get_symbol_version_helper): Give error if
6963         version is ambiguous.
6964
6965 2010-01-08  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
6968           prev_data_size_ and prev_addralign_.  Remove initializer for
6969           deleted data member has_been_changed_.
6970           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
6971           to determine if the table is empty.
6972           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
6973           Remove.
6974           (Stub_table::add_reloc_stub): Define method in class definition
6975           instead of just declaring it there.
6976           (Stub_table::add_cortex_a8_stub): New method definition.
6977           (Stub_table::update_data_size_and_addralign): Ditto.
6978           (Stub_table::finalize_stubs): Ditto.
6979           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
6980           (Stub_table::do_addralign_): Return address alignment in the
6981           (Stub_table::do_reset_address_and_file_offset): Define method in
6982           class definition instead of declaring it there.  Set current data
6983           size to be the data size of the previous pass.
6984           (Stub_table::set_final_data_size): Use current data size as the
6985           final data size.
6986           (Stub_table::relocate_stub): Change parameter type of stub from
6987           Reloc_stub pointer to Stub pointer.
6988           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
6989           (Stub_table::Cortex_a8_stub_list): New typedef.
6990           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
6991            Stub_table::prev_addralign_): New data member.
6992           (Arm_relobj::Arm_relobj): Initialize data member
6993           section_has_cortex_a8_workaround_.
6994           (Arm_relobj::section_has_cortex_a8_workaround,
6995            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
6996            definitions.
6997           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
6998           declarations.
6999           (Target_arm::relocate_stub): Change parameter type of stub from
7000           Reloc_stub pointer to Stub pointer.
7001           (Insn_template::size, Insn_template::alignment): Handle
7002           THUMB16_SPECIAL_TYPE.
7003           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7004            Stub_table::update_data_size_and_addralign,
7005            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7006           definitions.
7007           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7008           (Stub_table::do_write): Ditto.
7009           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7010
7011 2010-01-08  Ian Lance Taylor  <iant@google.com>
7012
7013         PR 11108
7014         * symtab.h (class Symbol): Remove fields is_target_special_ and
7015         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7016         (Symbol::is_defined_in_discarded_section): New function.
7017         (Symbol::set_is_defined_in_discarded_section): New function.
7018         (Symbol::has_plt_offset): Rewrite.
7019         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7020         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7021         Don't initialize is_target_special_ or has_plt_offset_.
7022         Initialize is_defined_in_discarded_section_.
7023         (Symbol_table::add_from_relobj): If appropriate, set
7024         is_defined_in_discarded_section.
7025         * resolve.cc (Symbol::override_base_with_special): Don't test
7026         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7027         * target-reloc.h (relocate_section): Do special handling for
7028         symbols defined in discarded sections for global symbols as well
7029         as local symbols.
7030
7031 2010-01-08  Ian Lance Taylor  <iant@google.com>
7032
7033         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7034         the SHT_SYMTAB case.
7035
7036 2010-01-08  Ian Lance Taylor  <iant@google.com>
7037
7038         * object.cc (Sized_relobj::do_layout): Don't get confused if
7039         layout_eh_frame returns NULL.
7040
7041 2010-01-08  Ian Lance Taylor  <iant@google.com>
7042
7043         PR 11084
7044         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7045         dynamic symbol table, use the normal symbol table.
7046         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7047         symbol table.
7048
7049 2010-01-08  Ian Lance Taylor  <iant@google.com>
7050
7051         PR 11072
7052         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7053         sections.
7054
7055 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7056
7057         * version.cc (print_version): Change to "Copyright 2010".
7058
7059 2010-01-08  Ian Lance Taylor  <iant@google.com>
7060
7061         PR 10287
7062         PR 11063
7063         * i386.cc (class Target_i386): Change return type of plt_section
7064         to be non-const.
7065         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7066         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7067         tls_desc_rel_ field.
7068         (Output_data_plt_i386::rel_tls_desc): New function.
7069         (Target_i386::rel_tls_desc_section): New function.
7070         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7071         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7072         R_386_TLS_DESC reloc in rel_tls_desc_section.
7073         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7074         Define struct Tlsdesc_info.
7075         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7076         (Target_x86_64::do_reloc_symbol_index): New function.
7077         (Target_x86_64::add_tlsdesc_info): New function.
7078         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7079         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7080         tlsdesc_rel_ field.
7081         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7082         all callers.
7083         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7084         (Target_x86_64::rela_tlsdesc_section): New function.
7085         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7086         handling.
7087         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7088         (Target_x86_64::do_reloc_addend): New function.
7089         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7090         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7091         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7092         (Output_reloc::type): New function.
7093         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7094         (Output_reloc::is_target_specific): New function.
7095         (Output_reloc::target_arg): New function.
7096         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7097         absolute relocs and target specific relocs.
7098         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7099         add_target_specific.
7100         (class Output_data_reloc) [SHT_RELA]: Likewise.
7101         * output.cc (Output_reloc::Output_reloc): Add four new versions
7102         for absolute relocs and target specific relocs.
7103         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7104         (Output_reloc::get_symbol_index): Likewise.
7105         (Output_reloc::local_section_offset): Check that local_sym_index_
7106         is not TARGET_CODE or 0.
7107         (Output_reloc::symbol_value): Likewise.
7108         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7109         reloc.
7110         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7111         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7112         functions.
7113         * layout.cc (add_target_dynamic_tags): Use output section for
7114         DT_PLTRELSZ and DT_JMPREL.
7115
7116 2010-01-07  Ian Lance Taylor  <iant@google.com>
7117
7118         PR 11061
7119         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7120         function.
7121         (class Output_data_reloc_generic): Define.
7122         (class Output_data_reloc_base): Change base class to
7123         Output_data_reloc_generic.  Change add() method to call
7124         bump_relative_reloc_count for a relative reloc.  Remove
7125         sort_relocs_ field.
7126         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7127         to sort_relocs().
7128         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7129         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7130         appropriate.
7131         * layout.h (class Layout): Update declaration.
7132
7133 2010-01-07  Ian Lance Taylor  <iant@google.com>
7134
7135         * output.h (class Output_data): Add const version of
7136         output_section and do_output_section.
7137         (class Output_section_data): Add const version of
7138         do_output_section.
7139         (class Output_section): Likewise.
7140         * layout.cc (Layout::add_target_dynamic_tags): New function.
7141         * layout.h (class Layout): Update declarations.
7142         * arm.cc (Target_arm::do_finalize_sections): Use
7143         add_target_dynamic_tags.
7144         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7145         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7146         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7147         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7148
7149 2010-01-07  Ian Lance Taylor  <iant@google.com>
7150
7151         PR 11042
7152         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7153         object as needed.
7154
7155 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7156             Ian Lance Taylor  <iant@google.com>
7157
7158         PR 11019
7159         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7160         Xindex::read_symtab_xindex.
7161
7162 2010-01-07  Doug Kwan  <dougkwan@google.com>
7163
7164         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7165         (Insn_template::thumb16_bcond_insn): New method declaration.
7166         (Insn_template): Fix spelling.
7167         (Stub::thumb16_special): New method declaration.
7168         (Stub::do_write): Define virtual method which was previously pure
7169         virtual.
7170         (Stub::do_thumb16_special): New method declaration.
7171         (Stub::do_fixed_endian_write): New template member.
7172         (Reloc_stub::do_write): Remove.
7173         (Reloc_stub::do_fixed_endian_write): Remove.
7174         (Cortex_a8_stub): New class definition.
7175         (Stub_factory::make_cortex_a8_stub): New method definition.
7176         (Stub_factory::Stub_factory): Add missing static storage class
7177         qualifier for elf32_arm_stub_a8_veneer_blx.
7178
7179 2010-01-07  Ian Lance Taylor  <iant@google.com>
7180
7181         PR 10980
7182         * options.h (class General_options): Add --warn-unresolved-symbols
7183         and --error-unresolved-symbols.
7184         * errors.cc (Errors::undefined_symbol): Implement
7185         --warn-unresolved-symbols.
7186
7187         * options.h (class General_options): Add -z text and -z textoff.
7188         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7189
7190 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7191
7192         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7193         (Garbage_collection::cident_sections): New function.
7194         (Garbage_collection::add_cident_section): New function.
7195         (Garbage_collection::cident_sections_): New member.
7196         (gc_process_relocs): Add references to sections whose names are C
7197         identifiers.
7198         * gold.h (cident_section_start_prefix): New constant.
7199         (cident_section_stop_prefix): New constant.
7200         (is_cident): New function.
7201         * layout.cc (Layout::define_section_symbols): Replace string constants
7202         with the newly defined constants.
7203         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7204         C identifiers.
7205         * testsuite/Makefile.am: Add gc_orphan_section_test.
7206         * testsuite/Makefile.in: Regenerate.
7207         * testsuite/gc_orphan_section_test.cc: New file.
7208         * testsuite/gc_orphan_section_test.sh: New file.
7209
7210 2010-01-06  Ian Lance Taylor  <iant@google.com>
7211
7212         PR 10980
7213         * options.h (class General_options): Add --warn-shared-textrel.
7214         * layout.cc (Layout::finish_dynamic_section): Implement
7215         --warn-shared-textrel.
7216
7217         PR 10980
7218         * options.h (class General_options): Add --warn-multiple-gp.
7219
7220 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7221
7222         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7223         $(THREADSLIB) and $(LIBDL).
7224         * Makefile.in: Rebuild.
7225
7226 2010-01-06  Ian Lance Taylor  <iant@google.com>
7227
7228         PR 10980
7229         * options.cc (General_options::parse_section_start): New function.
7230         (General_options::section_start): New function.
7231         (General_options::General_options): Initialize all members.
7232         * options.h: Include <map>
7233         (class General_options): Add --section-start.  Add section_starts_
7234         member.
7235         * layout.cc (Layout::attach_allocated_section_to_segment): If
7236         --section-start was used, set the address of the segment.  Remove
7237         local sort_sections.
7238         (Layout::relaxation_loop_body): If the address of the load segment
7239         has been set by --section-start, don't use it.
7240         * output.h (Output_segment::update_flags_for_output_section): New
7241         function.
7242         * output.cc (Output_segment::add_output_section): Call
7243         update_flags_for_output_section.
7244
7245 2010-01-05  Ian Lance Taylor  <iant@google.com>
7246
7247         PR 10980
7248         * options.h (class General_options): Add --undefined-version.
7249         * script.cc (struct Version_expression): Add was_matched_by_symbol
7250         field.
7251         (Version_script_info::matched_symbol): New function.
7252         (Version_script_info::get_symbol_version_helper): Call
7253         matched_symbol.
7254         (Version_script_info::check_unmatched_names): New function.
7255         * script.h (class Version_script_info): Update declarations.
7256         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7257
7258         * options.h (class General_options): Use DEFINE_bool_alias for
7259         allow_multiple_definition.
7260         * resolve.cc (Symbol_table::should_override): Don't test
7261         allow_multiple_definition.
7262
7263         PR 10980
7264         * options.h (class General_options): Add --cref.
7265         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7266         until after printing cref table.
7267         * cref.cc: Include "symtab.h".
7268         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7269         (Cref_table_compare::operator()): New function.
7270         (Cref_inputs::gather_cref): New function.
7271         (filecol): New static const.
7272         (Cref_inputs::print_cref): New function.
7273         (Cref::print_cref): New function.
7274         * cref.h: Include <cstdio>.
7275         (class Cref): Update declarations.
7276         * mapfile.h (Mapfile::file): New function.
7277         * object.h (class Object): Define Symbols.  Declare virtual
7278         do_get_global_symbols.
7279         (Object::get_global_symbols): New function.
7280         * object.cc (Input_objects::add_object): Pass object to cref_ if
7281         --cref.
7282         (Input_objects::archive_start): Likewise.
7283         (Input_objects::archive_stop): Likewise.
7284         (Input_objects::print_cref): New function.
7285         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7286         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7287         --cref.
7288         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7289         function.
7290         * plugin.h (class Sized_pluginobj): Update declarations.
7291
7292 2010-01-05  Ian Lance Taylor  <iant@google.com>
7293
7294         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7295         to is_default_version.  Rename insdef to insdefault.
7296         (Symbol_table::add_from_relobj): Rename def to is_default_version
7297         and local to is_forced_local.
7298         (Symbol_table::add_from_pluginobj): Likewise.
7299         (Symbol_table::add_from_dynobj): Likewise.
7300         (Symbol_table::define_special_symbol): Rename insdef to
7301         insdefault.
7302
7303 2010-01-04  Ian Lance Taylor  <iant@google.com>
7304
7305         PR 10980
7306         * options.h (class General_options): Add
7307         --allow-multiple-definition and -z muldefs.
7308         * resolve.cc (Symbol_table::should_override): Don't warn about a
7309         multiple symbol definition if --allow-multiple-definition or -z
7310         muldefs.
7311
7312         PR 10980
7313         * options.h (class General_options): Add --add-needed and
7314         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7315         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7316         error if --copy-dt-needed-entries aka --add-needed is used and
7317         would cause a change in behaviour.
7318
7319         PR 10980
7320         * options.h (class General_options): Add -G as a short version of
7321         --shared.  Add no-op options -assert, -g, and -i.
7322
7323 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7324
7325         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7326         check for .text or .gnu.linkonce.t sections.
7327         * icf.cc (Icf::find_identical_sections): Ditto.
7328         Change the detection for mangled function name within the section
7329         name.
7330         * icf.h (is_section_foldable_candidate): New function.
7331
7332 2009-12-30  Ian Lance Taylor  <iant@google.com>
7333
7334         PR 10980
7335         * options.h (class General_options): Permit two dashes with
7336         --retain-symbols-file.
7337
7338 2009-12-30  Ian Lance Taylor  <iant@google.com>
7339
7340         PR 10979
7341         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7342         don't put the file header and segment headers in the text
7343         segment.
7344
7345         PR 10979
7346         * common.cc (Sort_commons::operator()): Stabilize sort when both
7347         entries are NULL.
7348         (Symbol_table::do_allocate_commons_list): When allocating common
7349         symbols, skip a symbol which is no longer common.
7350         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7351         an object before checking its type.
7352         * testsuite/common_test_2.c: New file.
7353         * testsuite/common_test_3.c: New file.
7354         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7355         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7356         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7357         (common_test_2_pic.o, common_test_2.so): New targets.
7358         (common_test_3_pic.o, common_test_3.so): New targets.
7359         * testsuite/Makefile.in: Rebuild.
7360
7361         PR 10979
7362         * script.cc (read_input_script): If we see a new SECTIONS clause,
7363         and we have added an input section, give an error.
7364         * layout.h (class Layout): Add have_added_input_section function.
7365         Add have_added_input_section_ field.
7366         * layout.cc (Layout::Layout): Initialize
7367         have_added_input_section_.
7368         (Layout::layout): Set have_added_input_section_.
7369         (Layout::layout_eh_frame): Likewise.
7370
7371 2009-12-30  Ian Lance Taylor  <iant@google.com>
7372
7373         PR 10931
7374         * options.h (class General_options): Add --sort-common option.
7375         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7376         * common.cc (Sort_common): Add sort_order parameter to
7377         constructor.  Add sort_order_ field.
7378         (Sort_commons::operator): Check sort_order_.
7379         (Symbol_table::allocate_commons): Determine the sort order.
7380         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7381         Change all callers.
7382         (Symbol_table::do_allocate_commons_list): Likewise.
7383
7384 2009-12-30  Ian Lance Taylor  <iant@google.com>
7385
7386         PR 10916
7387         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7388         symbols from this object, don't change the visibility of an
7389         undefined symbol.
7390         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7391
7392 2009-12-30  Ian Lance Taylor  <iant@google.com>
7393
7394         PR 10861
7395         * script.h (class Version_script_info): Define Language enum.
7396         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7397         new fields globals_, locals_, and is_finalized_.
7398         * script.cc: Various formatting fixes.
7399         (class Parser_closure): Change language_stack_ from a vector of
7400         std::string to one of Version_script_info::Language.  Adjust all
7401         uses accordingly.
7402         (class Lazy_demangler): Remove.
7403         (struct Version_expression): Change language from std::string to
7404         Version_script_info::Language.
7405         (Version_script_info::Version_script_info): New function.
7406         (Version_script_info::~Version_script_info): Don't call clear.
7407         (Version_script_info::finalize): New function.
7408         (Version_script_info::build_lookup_tables): New function.
7409         (Version_script_info::build_expression_list_lookup): New
7410         function.
7411         (Version_script_info::get_symbol_version_helper): Rewrite to use
7412         lookup tables.
7413         (Version_script_info::print_expression_list): Adjust to use
7414         Version_script_info::Language.
7415         (script_push_lex_into_version_mode): Check that the version script
7416         has not been finalized.
7417         (version_script_push_lang): Change language string to
7418         Version_script_info::Language.
7419         * options.cc (Command_line::version_script): New function.
7420         * options.h (class General_options): Add finalize_dynamic_list
7421         function.  Change version_script from declaration to definition.
7422         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7423         * testsuite/version_script.map: Remove duplicate def of foo.
7424         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7425         version_script.map.
7426         * testsuite/Makefile.in: Rebuild.
7427
7428 2009-12-30  Ian Lance Taylor  <iant@google.com>
7429
7430         PR 10843
7431         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7432         if the input symbol index is 0, make the output symbol index 0.
7433
7434 2009-12-30  Ian Lance Taylor  <iant@google.com>
7435
7436         PR 10670
7437         * options.h (class General_options): Add -x/--discard-all.
7438         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7439         --discard-all.  If the local symbol needs a dynamic entry, check
7440         that before handling --discard-locals.
7441
7442 2009-12-30  Ian Lance Taylor  <iant@google.com>
7443
7444         PR 10450
7445         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7446         flags to PF_R.
7447         (Output_segment::add_output_section): Don't change the flags if
7448         the type is PT_TLS.
7449
7450         PR 10450
7451         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7452         GNU hash table if they need a dynamic value.  Otherwise, don't add
7453         them if they are defined in a dynamic object or are forced local.
7454
7455 2009-12-29  Ian Lance Taylor  <iant@google.com>
7456
7457         PR 10450
7458         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7459         .gnu.hash table for a 32-bit target.
7460
7461         PR 10450
7462         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7463         regular and a dynamic object only needs a dynamic symbol table
7464         entry if it is externally visible.
7465
7466         PR 10450
7467         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7468         constructor.  Add global_offset_table_ field.
7469         (Target_i386::got_section): Set global_offset_table_.
7470         (Target_i386::do_finalize_sections): Set global_offset_table_
7471         size.
7472         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7473         in constructor.  Add global_offset_table_ field.
7474         (Target_x86_64::got_section): Set global_offset_table_.
7475         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7476         size.
7477
7478         * layout.cc (Layout::Layout): Initialize increase_relro_.
7479         (Layout::get_output_section): Add is_relro, is_last_relro, and
7480         is_first_non_relro parameters.  Change all callers.
7481         (Layout::choose_output_section): Likewise.
7482         (Layout::add_output_section_data): Likewise.
7483         (Layout::make_output_section): Likewise.
7484         (Layout::set_segment_offsets): Clear increase_relro when using a
7485         linker script.
7486         * layout.h (class Layout): Add increase_relro method.  Add
7487         increase_relro_ field.  Update declarations.
7488         * output.cc (Output_section::Output_section): Initialize
7489         is_last_relro_ and is_first_non_relro_.
7490         (Output_segment::add_output_section): Group relro sections is
7491         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7492         (Output_segment::maximum_alignment): Remove relro handling.
7493         (Output_segment::set_section_addresses): Add increase_relro
7494         parameter.  Change all callers.  Add initial alignment to align
7495         relro sections on separate page.  Remove old relro handling.
7496         (Output_segment::set_section_list_addresses): Remove in_relro
7497         parameter.  Change all callers.
7498         (Output_segment::set_offset): Add increase parameter.  Change all
7499         callers.  Remove old relro handling.
7500         * output.h (class Output_section): Add new methods: is_last_relro,
7501         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7502         Add is_last_relro_ and is_first_non_relro_ fields.
7503         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7504         Create separate .got.plt section.  Call increase_relro.
7505         * x86_64.cc (Target_x86_64::got_section): Likewise.
7506         * testsuite/relro_script_test.t: Add .got.plt.
7507
7508         PR 10450
7509         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7510         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7511         (Layout::finalize): Call set_dynamic_symbol_size.
7512         (Layout::set_dynamic_symbol_size): New function.
7513         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7514         set_dynamic_symbol_size.
7515
7516         PR 10450
7517         * output.h (class Output_section): Add is_entsize_zero_ field.
7518         * output.cc (Output_section::Output_section): Initialize
7519         is_entsize_zero_.
7520         (Output_section::set_entsize): If two different entsizes are
7521         requested, force it to zero.
7522         (Output_section::add_input_section): Set flags for .debug_str
7523         before updating section flags.  Set entsize.
7524         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7525         and SHF_STRING if all input sections have those flags.
7526
7527 2009-12-29   Rafael Espindola  <espindola@google.com>
7528
7529         * main.cc (main): Fix the sys time reporting.
7530         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7531         reporting.
7532
7533 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7534
7535         * options.cc (General_options::parse_version): Allow -v to exit
7536         without an error if there is nothing to link.
7537
7538 2009-12-29  Ian Lance Taylor  <iant@google.com>
7539
7540         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7541         using a version of gcc before 4.1.
7542         * configure: Rebuild.
7543
7544 2009-12-28  Chris Demetriou  <cgd@google.com>
7545
7546         * attributes.cc (Output_attributes_section_data::do_write): Use
7547         std::vector::front rather than std::vector::data.
7548
7549 2009-12-28  Ian Lance Taylor  <iant@google.com>
7550
7551         * symtab.h (class Symbol_table): Add enum Defined.
7552         * resolve.cc (Symbol_table::should_override): Add defined
7553         parameter.  Change all callers.  Test whether object is NULL
7554         before calling a method on it.
7555         (Symbol_table::report_resolve_problem): Add defined parameter.
7556         Change all callers.
7557         (Symbol_table::should_override_with_special): Likewise.
7558         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7559         parameter.  Change all callers.
7560         (Symbol_table::do_define_in_output_data): Likewise.
7561         (Symbol_table::define_in_output_segment): Likewise.
7562         (Symbol_table::do_define_in_output_segment): Likewise.
7563         (Symbol_table::define_as_constant): Likewise.
7564         (Symbol_table::do_define_as_constant): Likewise.
7565         * script.h (class Symbol_assignment): Add is_defsym parameter to
7566         constructor; change all callers.
7567         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7568         parameter.  Change all callers.  Add is_defsym_ field.
7569         (class Parser_closure): Add parsing_defsym parameter to
7570         constructor; change all callers.  Add parsing_defsym accessor
7571         function.  Add parsing_defsym_ field.
7572
7573 2009-12-28  Ian Lance Taylor  <iant@google.com>
7574
7575         * gold.cc (queue_middle_tasks): Fix formatting.
7576         * object.cc (Relobj::is_section_name_included): Likewise.
7577
7578 2009-12-23  Ian Lance Taylor  <iant@google.com>
7579
7580         * i386.cc (Target_i386::do_calls_non_split): Recognize
7581         -fsplit-stack prologue for a function with a static chain.
7582         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7583         -fsplit-stack prologue when using %r11.
7584
7585 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7586
7587         * options.cc (General_options::parse_version): Make -v continue and do
7588         the link like GNU ld does.
7589
7590 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7591
7592         * Makefile.am (CCFILES): Add timer.cc.
7593         (HFILES): Add timer.h.
7594         * configure.ac: Check for sysconf and times.
7595         * main.cc: include timer.h.
7596         (main): Use Timer instead of get_run_time.
7597         * timer.cc: New.
7598         * timer.h: New.
7599         * workqueue.cc: include timer.h.
7600         (Workqueue::find_and_run_task):
7601         Report user, sys and wall time.
7602         * Makefile.in: Regenerate.
7603         * config.in: Regenerate.
7604         * configure: Regenerate.
7605
7606 2009-12-16  Doug Kwan  <dougkwan@google.com>
7607
7608         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7609         sections.
7610         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7611         relaxed input sections.
7612         * output.cc (Output_section::find_relaxed_input_section): Change
7613         return type to Output_relaxed_input_section pointer.  Adjust code
7614         for new type of relaxed_input_section_map_.
7615         * output.h (Output_section::find_relaxed_input_section): Change
7616         return type to Output_relaxed_input_section pointer.
7617         (Output_section::Output_relaxed_input_section_by_input_section_map):
7618         New type.
7619         (Output_section::relaxed_input_section_map_): Change type to
7620         Output_section::Output_relaxed_input_section_by_input_section_map.
7621         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7622         input section.
7623
7624 2009-12-15  Ian Lance Taylor  <iant@google.com>
7625
7626         * layout.cc (Layout::create_shstrtab): Only write out after input
7627         sections if we are compressing debug sections.
7628
7629 2009-12-15  Ian Lance Taylor  <iant@google.com>
7630
7631         * archive.cc (Archive::add_symbols): Only look up a symbol without
7632         a version if there is, in fact, a version.
7633
7634 2009-12-14  Ian Lance Taylor  <iant@google.com>
7635
7636         Revert -Wshadow changes, all changes from:
7637         2009-12-11  Doug Kwan  <dougkwan@google.com>
7638         2009-12-11  Nick Clifton  <nickc@redhat.com>
7639         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7640
7641 2009-12-11  Doug Kwan  <dougkwan@google.com>
7642
7643         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7644         due to -Wshadow.
7645         * attributes.cc (Object_attribute::size): Ditto.
7646         (Attributes_section_data::size): Ditto.
7647         (Attributes_section_data::Attributes_section_data): Ditto.
7648         (Output_attributes_section_data::do_write): Ditto.
7649         * attributes.h (Object_attribute::set_type): Ditto.
7650         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7651
7652 2009-12-11  Nick Clifton  <nickc@redhat.com>
7653
7654         * archive.cc: Fix shadowed variable warnings.
7655         * arm.cc: Likewise.
7656         * compressed_output.cc: Likewise.
7657         * compressed_output.h: Likewise.
7658         * configure: Likewise.
7659         * dwarf_reader.cc: Likewise.
7660         * dynobj.cc: Likewise.
7661         * dynobj.h: Likewise.
7662         * ehframe.cc: Likewise.
7663         * ehframe.h: Likewise.
7664         * errors.cc: Likewise.
7665         * expression.cc: Likewise.
7666         * fileread.cc: Likewise.
7667         * fileread.h: Likewise.
7668         * freebsd.h: Likewise.
7669         * i386.cc: Likewise.
7670         * icf.cc: Likewise.
7671         * incremental.h: Likewise.
7672         * layout.cc: Likewise.
7673         * layout.h: Likewise.
7674         * mapfile.cc: Likewise.
7675         * merge.cc: Likewise.
7676         * merge.h: Likewise.
7677         * object.cc: Likewise.
7678         * object.h: Likewise.
7679         * options.h: Likewise.
7680         * output.cc: Likewise.
7681         * output.h: Likewise.
7682         * parameters.cc: Likewise.
7683         * plugin.cc: Likewise.
7684         * powerpc.cc: Likewise.
7685         * reduced_debug_output.cc: Likewise.
7686         * reduced_debug_output.h: Likewise.
7687         * reloc.cc: Likewise.
7688         * reloc.h: Likewise.
7689         * resolve.cc: Likewise.
7690         * script-sections.cc: Likewise.
7691         * script.cc: Likewise.
7692         * script.h: Likewise.
7693         * sparc.cc: Likewise.
7694         * symtab.cc: Likewise.
7695         * symtab.h: Likewise.
7696         * target-select.cc: Likewise.
7697         * target-select.h: Likewise.
7698         * token.h: Likewise.
7699         * workqueue.cc: Likewise.
7700         * workqueue.h: Likewise.
7701         * x86_64.cc: Likewise.
7702
7703 2009-12-10  Doug Kwan  <dougkwan@google.com>
7704
7705         * arm.cc (attributes.h): New include.
7706         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7707         (Arm_relobj::~Arm_relobj): Delete object pointed by
7708         attributes_section_data_.
7709         (Arm_relobj::attributes_section_data): New method definition.
7710         (Arm_relobj::attributes_section_data_): New data member declaration.
7711         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7712         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7713         attributes_section_data_.
7714         (Arm_dynobj::attributes_section_data): New method definition.
7715         (Arm_dynobj::attributes_section_data_): New data member declaration.
7716         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7717         initialization value of may_use_blx_ to false.
7718         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7719         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7720         object attributes to compute results instead of hard-coding.
7721         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7722         Target_arm::get_secondary_compatible_arch,
7723         Target_arm::set_secondary_compatible_arch
7724         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7725         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7726         New method declarations.
7727         (Target_arm::get_aeabi_object_attribute): New method definition.
7728         (Target_arm::attributes_section_data_): New data member declaration.
7729         (read_arm_attributes_section): New template definition.
7730         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7731         (Arm_dynobj::do_read_symbols): Ditto.
7732         (Target_arm::do_finalize_sections): Merge attributes sections from
7733         input.  Check for BLX use after attributes section merging.
7734         Fix __exidx_start and __exidx_end visibility.  Create an
7735         .ARM.attributes section if necessary.
7736         (Target_arm::get_secondary_compatible_arch,
7737         Target_arm::set_secondary_compatible_arch,
7738         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7739         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7740         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7741         New method definitions.
7742
7743 2009-12-09  Ian Lance Taylor  <iant@google.com>
7744
7745         * plugin.cc (Plugin::load): Don't cast from void* to a function
7746         pointer.
7747
7748 2009-12-09  Ian Lance Taylor  <iant@google.com>
7749
7750         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7751         information fields.
7752
7753 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7754
7755         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7756         Replace two_file_shared_1.so with two_file_shared_2.so.
7757         * testsuite/Makefile.in: Regenerated.
7758
7759 2009-12-08  Doug Kwan  <dougkwan@google.com>
7760
7761         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7762         (HFILES): Add attributes.h and int_encoding.h.
7763         * Makefile.in: Regenerate.
7764         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7765         function definitions to int_encoding.cc
7766         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7767         prototypes to int_encoding.h
7768         * reduced_debug_output.cc (int_encoding.h): New include.
7769         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7770         function definitions to int_encoding.cc
7771         (insert_into_vector, read_from_pointer): Move template definitions to
7772         int_encoding.h
7773         * attributes.cc: New file.
7774         * attributes.h: New file.
7775         * int_encoding.cc: New file.
7776         * int_encoding.h: New file.
7777
7778 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7779
7780         PR gold/11055
7781         * incremental-dump.cc (dump_incremental_inputs): New.
7782         (main): Use dump_incremental_inputs.
7783
7784 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7785
7786         PR gold/10893
7787         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7788         checking elfcpp::STT_FUNC.
7789         (Target_i386::Relocate::relocate): Likewise.
7790         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
7791
7792         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
7793         symbols from shared libraries into normal FUNC symbols.
7794
7795         * symtab.h (Symbol): Add is_func and use it.
7796
7797 2009-12-05  Doug Kwan  <dougkwan@google.com>
7798
7799         * arm.cc (Target_arm::arm_info): Initialize new fields
7800         attributes_section and attributes_vendor.
7801         * i386.cc (Target_i386::i386_info): Same.
7802         * object.cc (Sized_relobj::do_layout): Skip attribute section.
7803         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
7804         fields attributes_section and attributes_vendor.
7805         * sparc.cc (Target_sparc::sparc_info): Same.
7806         * target.h (Target::attributes_section, Target::attributes_vendor,
7807         Target::is_attributes_section, Target::attribute_arg_type,
7808         Target::attributes_order): New method definitions.
7809         (Target::Target_info::attributes_section,
7810         Target::Target_info::attributes_vendor): New fields.
7811         (Target::do_attribute_arg_type, Target::do_attributes_order): New
7812         virtual method definitions.
7813         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
7814         attributes_section and attributes_vendor.
7815         * testsuite/testfile.cc (Target_test::test_target_info): Same.
7816
7817 2009-12-05  Doug Kwan  <dougkwan@google.com>
7818
7819         * arm.cc: Update comments about interworking and stub generation.
7820         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
7821         considered as non-PIC.
7822         (Arm_relocate_functions::base_abs): Fix formatting.
7823         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
7824         of function to use GOT entry address instead of offset.
7825         (Target_arm::Scan::global): Issue an error if a symbol would need a
7826         PLT does not get one because it is untyped.  Remove code to create
7827         dynamic symbols for relative branches.
7828         (Target_arm::Relocate::relocate: Use 0 instead of false since function
7829         takes unsigned integer instead of boolean.
7830
7831 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
7832
7833         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
7834         (two_file_test_LDADD): Likewise.
7835         (common_test_1_LDADD): Likewise.
7836         (exception_test_LDADD) Likewise.
7837         (weak_test_LDADD): Likewise.
7838         (many_sections_test_LDADD): Likewise.
7839         (initpri1_LDADD): Likewise.
7840         (script_test_1_LDADD): Likewise.
7841         (script_test_2_LDADD): Likewise.
7842         (justsyms_LDADD): Likewise.
7843         (binary_test_LDADD): Likewise.
7844         (large_LDADD): Likewise.
7845         * testsuite/Makefile.in: Regenerated.
7846
7847 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
7848
7849         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
7850         (Symbol_table::override_with_special): Likewise.
7851         (Symbol_table::add_from_object): Likewise.
7852
7853 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7854
7855         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7856         Don't set the data_offset twice.
7857
7858 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
7859
7860         * testsuite/Makefile.in: Regenerate.
7861
7862 2009-12-03  Doug Kwan  <dougkwan@google.com>
7863
7864         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
7865         (Target_arm::do_finalize_sections): Add parameter for symbol table
7866         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
7867         * i386.cc (Target_i386::do_finalize_sections): Add an additional
7868         parameter for symbol table pointer.
7869         * layout.cc (Layout::finalize): Call Target::finalize_sections with
7870         an additional parameter for a pointer to symbol table.
7871         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
7872         parameter for a symbol table pointer.
7873         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
7874         * target.h (Target::finalize_sections, Target::do_finalize_sections):
7875         Ditto.
7876         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
7877         parameter for a symbol table pointer.
7878
7879 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
7880
7881         * incremental.cc (Incremental_inputs_header)
7882         (Incremental_inputs_header_write, Incremental_inputs_entry)
7883         (Incremental_inputs_entry_write): Move ...
7884         * incremental.h (Incremental_inputs_header)
7885         (Incremental_inputs_header_write, Incremental_inputs_entry)
7886         (Incremental_inputs_entry_write): here.
7887
7888 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7889
7890         * incremental.cc (make_sized_incremental_binary): Set the target.
7891         Error if it is incompatible.
7892         * output.h (Output_file): Add filename method.
7893
7894 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7895
7896         * incremental.cc (Incremental_inputs_entry): Remove unused argument
7897         from the get_* methods.
7898
7899 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7900
7901         * incremental-dump.cc (main): Check that the offeset of a script is 0.
7902         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
7903         Write 0 for the data_offset of scripts.
7904
7905 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
7906
7907         * testsuite/Makefile.am: Add the incremental_test.sh test.
7908         * testsuite/incremental_test.sh: New.
7909         * testsuite/incremental_test_1.c: New.
7910         * testsuite/incremental_test_2.c: New.
7911
7912 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
7913
7914        * incremental-dump.cc (main): Fix typos.
7915
7916 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
7917
7918         PR gold/11025
7919         * incremental-dump.cc (main): Use llu to print 64 bit values.
7920
7921 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
7922             H.J. Lu  <hongjiu.lu@intel.com>
7923
7924         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
7925         $(LIBDL).
7926         (incremental_dump_LDADD): Likewise.
7927         * Makefile.in: Regenerated.
7928
7929 2009-11-25  Doug Kwan  <dougkwan@google.com>
7930
7931         Revert:
7932
7933         2009-11-25  Doug Kwan  <dougkwan@google.com>
7934
7935                 * arm.cc (Target_arm::Target_arm): Move method definition
7936                 outside of class definition.  Add code to handle
7937                 --target1-rel, --target1-abs and --target2= options.
7938                 (Target_arm::get_reloc_reloc_type): Change method to be
7939                 non-static and const.
7940                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
7941                 New data member declaration.
7942                 (Target_arm::Scan::local, Target_arm::Scan::global,
7943                 Target_arm::Relocate::relocate,
7944                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7945                 Adjust call to Target_arm::get_real_reloc_type.
7946                 (Target_arm::get_real_reloc_type): Use command line options
7947                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7948                 * options.h (--target1-rel, --target1-abs, --target2): New
7949                 ARM-only options.
7950
7951 2009-11-25  Doug Kwan  <dougkwan@google.com>
7952
7953         * arm.cc (Target_arm::Target_arm): Move method definition outside of
7954         class definition.  Add code to handle --target1-rel, --target1-abs
7955         and --target2= options.
7956         (Target_arm::get_reloc_reloc_type): Change method to be non-static
7957         and const.
7958         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
7959         member declaration.
7960         (Target_arm::Scan::local, Target_arm::Scan::global,
7961         Target_arm::Relocate::relocate,
7962         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
7963         call to Target_arm::get_real_reloc_type.
7964         (Target_arm::get_real_reloc_type): Use command line options to
7965         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
7966         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
7967         options.
7968
7969 2009-11-25  Doug Kwan  <dougkwan@google.com>
7970
7971         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
7972         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
7973         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
7974         formatting.
7975         (Arm_relocate_functions::thm_call): Replace body with a call to
7976         Arm_relocate_functions::thumb_branch_common.
7977         (Arm_relocate_functions::thm_jump24,
7978         Arm_relocate_functions::thm_xpc22): New method definitions.
7979         (Arm_relocate_functions::thumb_branch_common): New method definition.
7980         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
7981         operator.
7982         (Target_arm::Relocate::relocate): Adjust call to thm_call.
7983         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
7984
7985 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7986
7987         * Makefile.am: Build incremental-dump
7988         * Makefile.in: Regenerate.
7989         * incremental-dump.cc: New.
7990         * incremental.cc (Incremental_inputs_header_data,
7991         Incremental_inputs_entry_data): Move to incremental.h
7992         * incremental.h: (Incremental_inputs_header_data,
7993         Incremental_inputs_entry_data): Move from incremental.cc
7994
7995 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
7996
7997         * incremental.cc (Incremental_inputs_header,
7998         Incremental_inputs_header_write, Incremental_inputs_entry,
7999         Incremental_inputs_entry_write): Add a typedef with the data type.
8000
8001 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8002
8003         * incremental.cc (Incremental_inputs_header,
8004         Incremental_inputs_header_write, Incremental_inputs_entry,
8005         Incremental_inputs_entry_write): Update comment about which
8006         type has the filed descriptions.
8007
8008 2009-11-15  Doug Kwan  <dougkwan@google.com>
8009
8010         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8011         (Arm_relocate_functions::arm_branch_common): Change method defintion
8012         in class definition to a method declaration and update list of formal
8013         parameters.
8014         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8015         Arm_relocation_functions::jump24): Adjust call to
8016         Arm_relocate_functions::arm_branch_common.  Update list of formal
8017         parameters.
8018         (Arm_relocate_functions::xpc25): New method definition.
8019         (Arm_relocate_functions::arm_branch_common): Move method defintion
8020         out from class definition.  Use stubs for mode-switching and extending
8021         branch ranges.
8022         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8023         specially.  Change code to enable use of stubs in ARM branches.
8024
8025 2009-11-10  Doug Kwan  <dougkwan@google.com>
8026
8027         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8028         in method declaration.
8029         (Target_arm::relocate_stub): New method declaration.
8030         (Target_arm::default_target): Change to return a pointer instead of
8031         a const reference.
8032         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8033         Target_arm::default_target.
8034         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8035         method definition.
8036         (Target_arm::relocate_section): Adjust view.
8037         (Target_arm::relocate_stub): New method definition.
8038
8039 2009-11-10  Doug Kwan  <dougkwan@google.com>
8040
8041         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8042         a format warning.
8043         * incremental.cc (open_incremental_binary): Initialized local
8044         variables to avoid warnings.
8045         * object.cc (make_elf_object): Ditto.
8046         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8047         a format warning.
8048
8049 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8050
8051         PR gold/10930
8052         * testsuite/plugin_test.c: Include "config.h".
8053
8054 2009-11-09  Doug Kwan  <dougkwan@google.com>
8055
8056         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8057         (arm_symbol_value): Remove.
8058         (Arm_relocate_functions::arm_branch_common,
8059         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8060         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8061         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8062         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8063         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8064         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8065         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8066         Arm_relocate_functions::thm_mobw_abs_nc,
8067         Arm_relocate_functions::thm_mov_abs,
8068         Arm_relocate_functions::movw_prel_nc,
8069         Arm_relocate_functions::thm_movt_abs,
8070         Arm_relocate_functions::movt_prel,
8071         Arm_relocate_functions::thm_movw_prel_nc,
8072         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8073         (Target_arm::Relocate::relocate): Only decompose address into two
8074         parts if relocation type uses the thumb-bit and pass the actual
8075         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8076         calls to methods in Arm_relocate_functions for this change.
8077
8078 2009-11-08  Ian Lance Taylor  <iant@google.com>
8079
8080         PR 10925
8081         * reloc.cc: Instantiate
8082         Sized_relobj::initialize_input_to_output_maps and
8083         Sized_relobj:free_input_to_output_maps.
8084
8085 2009-11-06  Ian Lance Taylor  <iant@google.com>
8086
8087         PR 10876
8088         * defstd.cc (in_segment): Set only_if_ref true for "end".
8089
8090 2009-11-06  Doug Kwan  <dougkwan@google.com>
8091
8092         * arm.cc (class Reloc_stub): Correct a comment.
8093         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8094         (Target_arm::scan_section_for_stubs): New method declaration.
8095         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8096         Change methods from private to protected.
8097         (Target_arm::do_may_relax): New method definition.
8098         (Target_arm::do_relax, Target_arm::group_sections,
8099         Target_arm::scan_reloc_for_stub,
8100         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8101         (Target_arm::arm_input_section_map_): New data member declaration.
8102         (Target_arm::scan_reloc_for_stub,
8103         Target_arm::scan_reloc_section_for_stubs,
8104         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8105         Target_arm::do_relax): New method definitions.
8106
8107 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8108
8109         * configure.ac: Check for (struct stat)::st_mtim
8110         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8111         * config.in: Regenerate.
8112         * configure: Regenerate.
8113
8114 2009-11-05  Ian Lance Taylor  <iant@google.com>
8115
8116         PR 10910
8117         * output.cc (Output_segment::add_output_section): Add missing
8118         return statement.
8119
8120 2009-11-04  Ian Lance Taylor  <iant@google.com>
8121
8122         PR 10880
8123         * object.h (class Object): Add is_needed and set_is_needed
8124         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8125         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8126         defined in a dynamic object and referenced by a regular object,
8127         set is_needed for the dynamic object.
8128         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8129         if the file is marked with as_needed and it is not needed.
8130
8131 2009-11-04  Ian Lance Taylor  <iant@google.com>
8132
8133         PR 10887
8134         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8135         tags if data is discarded by linker script.
8136         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8137         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8138         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8139         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8140
8141 2009-11-04  Ian Lance Taylor  <iant@google.com>
8142
8143         * layout.cc (Layout::get_output_section): Add is_interp and
8144         is_dynamic_linker_section parameters.  Change all callers.
8145         (Layout::choose_output_section): Likewise.
8146         (Layout::make_output_section): Likewise.
8147         (Layout::add_output_section_data): Add is_dynamic_linker_section
8148         parameter.  Change all callers.
8149         * layout.h (class Layout): Update declarations.
8150         * output.h (class Output_section): Add is_interp, set_is_interp,
8151         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8152         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8153         generate_code_fills_at_write_ to a bitfield.
8154         * output.cc (Output_section::Output_sections): Initialize new
8155         fields.
8156         (Output_segment::add_output_section): Add do_sort parameter.
8157         Change all callers.
8158
8159 2009-11-03  Ian Lance Taylor  <iant@google.com>
8160
8161         PR 10860
8162         * options.h (class General_options): Add --warn-common.
8163         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8164         merging two common symbols.
8165         (Symbol_table::should_override): Handle --warn-common when merging
8166         a common symbol with a defined symbol.  Use report_resolve_problem
8167         for multiple definitions.
8168         (Symbol_table::report_resolve_problem): New function.
8169         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8170
8171 2009-11-03  Doug Kwan  <dougkwan@google.com>
8172
8173         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8174         stub_factory_.
8175         (Target_arm::stub_factory): New method definition.
8176         (Target_arm::new_arm_input_section,
8177         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8178         Target_arm::reloc_uses_thumb_bit): New method declarations.
8179         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8180         New type definitions.
8181         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8182         member declarations.
8183         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8184         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8185         New method definitions.
8186
8187 2009-11-03  Ian Lance Taylor  <iant@google.com>
8188
8189         * options.h (class General_options): Add --warn_constructors.
8190
8191 2009-11-03  Ian Lance Taylor  <iant@google.com>
8192
8193         PR 10893
8194         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8195         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8196
8197 2009-11-03  Ian Lance Taylor  <iant@google.com>
8198
8199         PR 10895
8200         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8201         --msgid-bugs-address.
8202         (install-pdf): New target.
8203         (install-data_yes): Look up one directory to find mkinstalldirs.
8204
8205 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8206
8207         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8208         tree.
8209
8210 2009-10-30  Doug Kwan  <dougkwan@google.com>
8211
8212         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8213
8214 2009-10-30  Doug Kwan  <dougkwan@google.com>
8215
8216         * arm.cc (Stub_addend_reader): New struct template definition
8217         and partial specializations.
8218         (Stub_addend_reader::operator()): New method definition for a
8219         partially specialized template.
8220
8221 2009-10-30  Doug Kwan  <dougkwan@google.com>
8222
8223         * arm.cc (Arm_relobj::processor_specific_flags): New method
8224         definition.
8225         (Arm_relobj::do_read_symbols): New method declaration.
8226         (Arm_relobj::processor_specific_flags_): New data member declaration.
8227         (Arm_dynobj): New class definition.
8228         (Target_arm::do_finalize_sections): Add input_objects parameter.
8229         (Target_arm::do_adjust_elf_header): New method declaration.
8230         (Target_arm::are_eabi_versions_compatible,
8231         (Target_arm::merge_processor_specific_flags): New method declaration.
8232         (Target_arm::do_make_elf_object): New overloaded method definitions
8233         and declaration.
8234         (Arm_relobj::do_read_symbols): New method definition.
8235         (Arm_dynobj::do_read_symbols): Ditto.
8236         (Target_arm::do_finalize_sections): Add input_objects parameters.
8237         Merge processor-specific flags from all input objects.
8238         (Target_arm::are_eabi_versions_compatible,
8239         Target_arm::merge_processor_specific_flags,
8240         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8241         New method definitions.
8242         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8243         Input_objects pointer type parameter.
8244         * layout.cc (Layout::finalize): Pass input objects to target's.
8245         finalize_sections function.
8246         * output.cc (Output_file_header::do_sized_write): Set ELF file
8247         header's processor-specific flags.
8248         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8249         Input_objects pointer type parameter.
8250         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8251         * target.h (Input_objects): New forward class declaration.
8252         (Target::processor_specific_flags,
8253         Target::are_processor_specific_flags_sect): New method definitions.
8254         (Target::finalize_sections): Add input_objects parameter.
8255         (Target::Target): Initialize processor_specific_flags_ and
8256         are_processor_specific_flags_set_.
8257         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8258         parameter.
8259         (Target::set_processor_specific_flags): New method definition.
8260         (Target::processor_specific_flags_,
8261         Target::are_processor_specific_flags_set_): New data member
8262         declarations.
8263         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8264         Input_objects pointer type parameter.
8265
8266 2009-10-30  Doug Kwan  <dougkwan@google.com>
8267
8268         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8269
8270 2009-10-28  Ian Lance Taylor  <iant@google.com>
8271
8272         * object.h (class Relobj): Drop options parameter from
8273         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8274         do_scan_relocs, do_relocate.  Change all callers.
8275         (class Sized_relobj): Drop options parameters from
8276         do_gc_process_relocs, do_scan_relocs, do_relocate,
8277         do_relocate_sections, relocate_sections, emit_relocs_scan,
8278         emit_relocs_scan_reltype.  Change all callers.
8279         (struct Relocate_info): Remove options field and all references to
8280         it.
8281         * reloc.h (class Read_relocs): Remove options constructor
8282         parameter and options_ field.  Change all callers.
8283         (class Gc_process_relocs, class Scan_relocs): Likewise.
8284         (class Relocate_task): Likewise.
8285         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8286         all callers.
8287         (scan_relocatable_relocs): Likewise.
8288         * target.h (class Sized_target): Remove options parameter from
8289         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8290         all callers.
8291         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8292         callers.
8293         * arm.cc: Update functions to remove options parameters.
8294         * i386.cc: Likewise.
8295         * powerpc.cc: Likewise.
8296         * sparc.cc: Likewise.
8297         * x86_64.cc: Likewise.
8298         * testsuite/testfile.cc: Likewise.
8299
8300 2009-10-28  Doug Kwan  <dougkwan@google.com>
8301
8302         * arm.cc (Arm_relobj): New class definition.
8303         (Arm_relobj::scan_sections_for_stubs,
8304         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8305         New method definitions.
8306
8307 2009-10-28  Cary Coutant  <ccoutant@google.com>
8308
8309         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8310         (Plugin::cleanup_done_): New member.
8311         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8312         (Plugin_manager::cleanup_done_): Remove.
8313         (Plugin_manager::add_input_file): Edit error message.
8314         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8315         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8316
8317 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8318
8319         * fileread.cc: (File_read::View::~View): Use the new
8320         data_ownership_ filed.
8321         (File_read::~File_read): Dispose the new whole_file_view_.
8322         (File_read::open): Mmap the whole file if needed.
8323         (File_read::open): Use whole_file_view_ instead of contents_.
8324         (File_read::find_view): Use whole_file_view_ if applicable.
8325         (File_read::do_read): Use whole_file_view_ instead of contents_.
8326         (File_read::make_view): Use whole_file_view_ instead of contents_,
8327         update File_read::View::View call.
8328         (File_read::find_or_make_view): Update File_read::View::View
8329         call.
8330         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8331         remove contents_
8332         (File_read::View::Data_ownership): New enum.
8333         (File_read::View::View): Replace bool mapped_ with Data_ownership
8334         argument.
8335         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8336         (File_read::View::data_ownership_): New field.
8337         (File_read::contents_): Remove (replaced by whole_file_view_).
8338         (File_read::whole_file_view_): New field.
8339         * options.h (class General_options): Add --keep-files-mapped.
8340
8341 2009-10-27  Cary Coutant  <ccoutant@google.com>
8342
8343         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8344         * testsuite/Makefile.am (plugin_test_5): New test case.
8345         * testsuite/Makefile.in: Regenerate.
8346
8347 2009-10-25  Doug Kwan  <dougkwan@google.com>
8348
8349         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8350         from private to protected to allow access by child class.
8351         (Sized_relobj::do_relocate_sections): New method declaration.
8352         (Sized_relobj::relocate_sections): Virtualize.
8353         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8354         Sized_relobj::relocate_sections.  Instantiate template explicitly
8355         for different target sizes and endianity.
8356
8357 2009-10-24  Doug Kwan  <dougkwan@google.com>
8358
8359         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8360         (Arm_input_section::as_arm_input_section): New method.
8361         (Arm_output_section): New class definition.
8362         (Arm_output_section::create_stub_group,
8363         Arm_output_section::group_sections): New method definitions.
8364
8365 2009-10-22  Doug Kwan  <dougkwan@google.com>
8366
8367         * arm.cc (Arm_input_section): New class definition.
8368         (Arm_input_section::init, Arm_input_section:do_write,
8369         Arm_input_section::set_final_data_size,
8370         Arm_input_section::do_reset_address_and_file_offset): New method
8371         definitions.
8372
8373 2009-10-21  Doug Kwan  <dougkwan@google.com>
8374
8375         * arm.cc (Stub_table, Arm_input_section): New forward class
8376         declarations.
8377         (Stub_table): New class defintion.
8378         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8379         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8380         New method definition.
8381
8382 2009-10-21  Doug Kwan  <dougkwan@google.com>
8383
8384         * arm.cc: Update copyright comments.
8385         (Target_arm): New forward class template declaration.
8386         (Arm_address): New type.
8387         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8388         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8389         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8390         constants.
8391         (Insn_template): Same.
8392         (DEF_STUBS): New macro.
8393         (Stub_type): New enum type.
8394         (Stub_template): New class definition.
8395         (Stub): Same.
8396         (Reloc_stub): Same.
8397         (Stub_factory): Same.
8398         (Target_arm::Target_arm): Initialize may_use_blx_ and
8399         should_force_pic_veneer_.
8400         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8401         Target_arm::should_force_pic_veneer,
8402         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8403         Target_arm::using_thumb_only, Target_arm:;default_target): New
8404         method defintions.
8405         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8406         New data member declarations.
8407         (Insn_template::size, Insn_template::alignment): New method defintions.
8408         (Stub_template::Stub_template): New method definition.
8409         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8410         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8411         (Stub_factory::Stub_factory): New method definition.
8412         * gold.h (string_hash): New template.
8413         * output.h (Input_section_specifier::hash_value): Use
8414         gold::string_hash.
8415         (Input_section_specifier::string_hash): Remove.
8416         * stringpool.cc (Stringpool_template::string_hash): Use
8417         gold::string_hash.
8418
8419 2009-10-20  Doug Kwan  <dougkwan@google.com>
8420
8421         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8422         symbols of relaxed input sections.
8423         * output.h (Output_section::find_relaxed_input_section): Make
8424         method public.
8425
8426 2009-10-16  Doug Kwan  <dougkwan@google.com>
8427
8428         * dynobj.cc (Versions::Versions): Initialize version_script_.
8429         Only insert base version symbol definition for a shared object
8430         if version script defines any version versions.
8431         (Versions::define_base_version): New method definition.
8432         (Versions::add_def): Check that base version is not needed.
8433         (Versions::add_need): Define base version lazily.
8434         * dynobj.h (Versions::define_base_version): New method declaration.
8435         (Versions::needs_base_version_): New data member declaration.
8436         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8437         (check_DATA): Add no_version_test.stdout.
8438         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8439         New make rules.
8440         * testsuite/Makefile.in: Regenerate.
8441         * testsuite/no_version_test.c: New file.
8442         * testsuite/no_version_test.sh: Ditto.
8443
8444 2009-10-16  Doug Kwan  <dougkwan@google.com>
8445
8446         * expression.cc (class Segment_start_expression): New class definition.
8447         (Segment_start_expression::value): New method definition.
8448         (script_exp_function_segment_start): Return a new
8449         Segment_start_expression.
8450         * gold/script-c.h (script_saw_segment_start_expression): New function
8451         prototype.
8452         * script-sections.cc (Script_sections::Script_sections): Initialize
8453         SAW_SEGMENT_START_EXPRESSION_ to false.
8454         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8455         and -Tbbs options to specify section addresses if given in
8456         command line and no SEGMENT_START expression is seen in a script.
8457         * script-sections.h (Script_sections::saw_segment_start_expression,
8458         Script_sections::set_saw_segment_start_expression): New method
8459         definition.
8460         (Script_sections::saw_segment_start_expression_): New data member
8461         declaration.
8462         * script.cc (script_saw_segment_start_expression): New function.
8463         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8464         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8465         script_test_7.sh and script_test_8.sh.
8466         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8467         script_test_8.stdout.
8468         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8469         (script_test_6, script_test_6.stdout, script_test_7,
8470         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8471         * Makefile.in: Regenerate.
8472         * testsuite/script_test_6.sh: New file.
8473         * testsuite/script_test_6.t: Same.
8474         * testsuite/script_test_7.sh: Same.
8475         * testsuite/script_test_7.t: Same.
8476         * testsuite/script_test_8.sh: Same.
8477
8478 2009-10-16  Doug Kwan  <dougkwan@google.com>
8479
8480         * output.cc (Output_segment::set_section_list_address): Cast
8481         expressions to unsigned long long type to avoid format warnings.
8482
8483 2009-10-15  Ian Lance Taylor  <iant@google.com>
8484
8485         * script.cc (Script_options::add_symbol_assignment): Always add a
8486         dot assignment to script_sections_.
8487         * script-sections.cc (Script_sections::add_dot_assignment):
8488         Initialize if necessary.
8489
8490         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8491         program headers with no load segment if there is a linker script.
8492
8493         * layout.cc (Layout::set_segment_offsets): Align the file offset
8494         to the segment aligment for -N or -n with no load segment.
8495         * output.cc (Output_segment::add_output_section): Don't crash if
8496         the first section is a TLS section.
8497         (Output_segment::set_section_list_addresses): Print an error
8498         message if the address moves backward in a linker script.
8499         * script-sections.cc
8500         (Output_section_element_input::set_section_addresses): Don't
8501         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8502         (Orphan_output_section::set_section_addresses): Likewise.
8503
8504 2009-10-15  Doug Kwan  <dougkwan@google.com>
8505
8506         * layout.cc (Layout::finish_dynamic_section): Generate tags
8507         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8508         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8509         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8510
8511 2009-10-14  Ian Lance Taylor  <iant@google.com>
8512
8513         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8514         fields.
8515         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8516         data_shdr fields of relinfo.
8517         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8518         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8519         R_386_TLS_LDO_32, adjust based on section flags.
8520         (Target_i386::Relocate::fix_up_ldo): Remove.
8521
8522 2009-10-13  Ian Lance Taylor  <iant@google.com>
8523
8524         Add support for -pie.
8525         * options.h (class General_options): Add -pie and
8526         --pic-executable.
8527         (General_options::output_is_position_independent): Test -pie.
8528         (General_options::output_is_executable): Return true if not shared
8529         and not relocatable.
8530         (General_options::output_is_pie): Remove.
8531         * options.cc (General_options::finalize): Reject incompatible uses
8532         of -pie.
8533         * gold.cc (queue_middle_tasks): A -pie link is not static.
8534         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8535         * symtab.cc (Symbol::final_value_is_known): Return false if
8536         output_is_position_independent.
8537         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8538         output_is_position_independent.
8539         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8540         output_is_position_independent.
8541         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8542         output_is_position_independent.
8543         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8544         two_file_pie_test.
8545         (basic_pie_test.o, basic_pie_test): New targets.
8546         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8547         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8548         (two_file_pie_test): New target.
8549         * testsuite/Makefile.in: Rebuild.
8550         * README: Remove note saying that -pie is not supported.
8551
8552 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8553
8554         * options.h (class General_options): Add -init and -fini.
8555         * layout.cc (Layout::finish_dynamic_section): Emit
8556         given init and fini functions.
8557
8558 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8559
8560         * gc.h (gc_process_relocs): Check if icf is enabled using new
8561         function.
8562         * gold.cc (queue_initial_tasks): Likewise.
8563         (queue_middle_tasks): Likewise.
8564         * object.cc (do_layout): Likewise.
8565         * symtab.cc (is_section_folded): Likewise.
8566         * main.cc (main): Likewise.
8567         * reloc.cc (Read_relocs::run): Likewise.
8568         (Sized_relobj::do_scan_relocs): Likewise.
8569         * icf.cc (is_function_ctor_or_dtor): New function.
8570         (Icf::find_identical_sections): Check if function is ctor or dtor when
8571         safe icf is chosen.
8572         * options.h (General_options::icf): Change option to be an enum.
8573         (Icf_status): New enum.
8574         (icf_enabled): New method.
8575         (icf_safe_folding): New method.
8576         (set_icf_status): New method.
8577         (icf_status_): New variable.
8578         * (options.cc) (General_options::finalize): Set icf_status_.
8579         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8580         icf_test and icf_keep_unique_test to use the --icf enum flag.
8581         * testsuite/icf_safe_test.sh: New file.
8582         * testsuite/icf_safe_test.cc: New file.
8583
8584 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8585
8586         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8587         includes to gc.h and icf.h.
8588         * arm.cc: Include gc.h.
8589         * gold.cc: Likewise.
8590         * i386.cc: Likewise.
8591         * powerpc.cc: Likewise.
8592         * sparc.cc: Likewise.
8593         * x86_64.cc: Likewise.
8594         * gc.h: Include icf.h.
8595
8596 2009-10-11  Ian Lance Taylor  <iant@google.com>
8597
8598         * plugin.cc: Include "gold.h" before other header files.
8599
8600 2009-10-10  Chris Demetriou  <cgd@google.com>
8601
8602         * options.h (Input_file_argument::Input_file_type): New enum.
8603         (Input_file_argument::is_lib_): Replace with...
8604         (Input_file_argument::type_): New member.
8605         (Input_file_argument::Input_file_argument): Take Input_file_type
8606         'type' rather than boolean 'is_lib' as second argument.
8607         (Input_file_argument::is_lib): Use type_.
8608         (Input_file_argument::is_searched_file): New function.
8609         (Input_file_argument::may_need_search): Handle is_searched_file.
8610         * options.cc (General_options::parse_library): Support -l:filename.
8611         (General_options::parse_just_symbols): Update for Input_file_argument
8612         changes.
8613         (Command_line::process): Likewise.
8614         * archive.cc (Archive::get_file_and_offset): Likewise.
8615         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8616         * script.cc (read_script_file, script_add_file): Likewise.
8617         * fileread.cc (Input_file::Input_file): Likewise.
8618         (Input_file::will_search_for): Handle is_searched_file.
8619         (Input_file::open): Likewise.
8620         * readsyms.cc (Read_symbols::get_name): Likewise.
8621         * testsuite/Makefile.am (searched_file_test): New test.
8622         * testsuite/Makefile.in: Regenerate.
8623         * testsuite/searched_file_test.cc: New file.
8624         * testsuite/searched_file_test_lib.cc: New file.
8625
8626 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8627             Ian Lance Taylor  <iant@google.com>
8628
8629         * descriptor.cc: Include <cstdio> and "binary-io.h".
8630         (Descriptors::open): Open the files in binary mode always.
8631         * script.cc (Lex::get_token): Treat \r as whitespace.
8632
8633 2009-10-09  Ian Lance Taylor  <iant@google.com>
8634
8635         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8636
8637 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8638             Ian Lance Taylor  <iant@google.com>
8639
8640         * configure.ac: Check for readv function also.
8641         * fileread.cc (readv): Define if not HAVE_READV.
8642         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8643         does not exist.
8644         * config.in: Regenerate.
8645         * configure: Regenerate.
8646
8647 2009-10-09  Doug Kwan  <dougkwan@google.com>
8648
8649         * layout.cc (Layout::make_output_section): Call target hook to make
8650         ordinary output section.
8651         (Layout::finalize): Adjust parameter list of call the
8652         Target::may_relax().
8653         * layout.h (class Layout::section_list): New method.
8654         * merge.h (Output_merge_base::entsize): Change visibility to public.
8655         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8656         New methods.
8657         (Output_merge_string::do_is_string): New method.
8658         * object.cc (Sized_relobj::do_setup): renamed from
8659         Sized_relobj::set_up.
8660         * object.h (Sized_relobj::adjust_shndx,
8661         Sized_relobj::initializ_input_to_output_maps,
8662         Sized_relobj::free_input_to_output_maps): Change visibilities to
8663         protected.
8664         (Sized_relobj::setup): Virtualize.
8665         (Sized_relobj::do_setup): New method declaration.
8666         (Sized_relobj::invalidate_section_offset,
8667         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8668         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8669         * options.cc (parse_int): New function.
8670         * options.h (parse_int): New declaration.
8671         (DEFINE_int): New macro.
8672         (stub_group_size): New option.
8673         * output.cc (Output_section::Output_section): Initialize memebers
8674         merge_section_map_, merge_section_by_properties_map_,
8675         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8676         (Output_section::add_input_section): Handled deferred code-fill
8677         generation and remove an old comment.
8678         (Output_section::add_relaxed_input_section): New method definition.
8679         (Output_section::add_merge_input_section): Use merge section by
8680         properties map to speed to search.  Update merge section maps
8681         as appropriate.
8682         (Output_section::build_relaxation_map): New method definition.
8683         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8684         Same.
8685         (Output_section::relax_input_section): Renamed to
8686         Output_section::convert_input_sections_to_relaxed_sections and change
8687         interface to take a vector of pointers to relaxed sections.
8688         (Output_section::find_merge_section,
8689         Output_section::find_relaxed_input_section): New method definitions.
8690         (Output_section::is_input_address_mapped,
8691         Output_section::output_offset, Output_section::output_address):
8692         Use output section data maps to speed up searching.
8693         (Output_section::find_starting_output_address): Add comments.
8694         (Output_section::do_write,
8695         Output_section::write_to_postprocessing_buffer): Do code-fill
8696         generation as appropriate.
8697         (Output_section::get_input_sections): Invalidate relaxed input section
8698         map.
8699         (Output_section::restore_states): Adjust type of checkpoint .
8700         Invalidate relaxed input section map.
8701         * output.h (Output_merge_base): New class declaration.
8702         (Input_section_specifier): New class defintion.
8703         (class Output_relaxed_input_section) Change base class to
8704         Output_section_data_build.
8705         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8706         base class initializer.
8707         (Output_section::add_relaxed_input_section): New method declaration.
8708         (Output_section::Input_section): Change visibility to protected.
8709         (Output_section::Input_section::relobj,
8710         Output_section::Input_section::shndx): Handle relaxed input sections.
8711         Output_section::input_sections) Change visibility to protected.  Also
8712         define overload to return a non-const pointer.
8713         (Output_section::Merge_section_properties): New class defintion.
8714         (Output_section::Merge_section_by_properties_map,
8715         Output_section::Output_section_data_by_input_section_map,
8716         Output_section::Relaxation_map): New types.
8717         (Output_section::relax_input_section): Rename method to
8718         Output_section::convert_input_sections_to_relaxed_sections and change
8719         interface to take a vector of relaxed section pointers.
8720         (Output_section::find_merge_section,
8721         Output_section::find_relaxed_input_section,
8722         Output_section::build_relaxation_map,
8723         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8724         New method declarations.
8725         (Output_section::merge_section_map_
8726         Output_section::merge_section_by_properties_map_,
8727         Output_section::relaxed_input_section_map_,
8728         Output_section::is_relaxed_input_section_map_valid_,
8729         Output_section::generate_code_fills_at_write_): New data members.
8730         * script-sections.cc
8731         (Output_section_element_input::set_section_addresses): Call
8732         current_data_size and addralign methods of relaxed input sections.
8733         (Orphan_output_section::set_section_addresses): Call current_data_size
8734         and addralign methods of relaxed input sections.
8735         * symtab.cc (Symbol_table::compute_final_value): Extract template
8736         from the body of Symbol_table::sized_finalize_symbol.
8737         (Symbol_table::sized_finalized_symbol): Call
8738         Symbol_table::compute_final_value.
8739         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8740         (Symbol_table::compute_final_value): New templated method declaration.
8741         * target.cc (Target::do_make_output_section): New method defintion.
8742         * target.h (Target::make_output_section): New method declaration.
8743         (Target::relax): Add more parameters for input objects, symbol table
8744         and layout.  Adjust call to do_relax.
8745         (Target::do_make_output_section): New method declaration.
8746         (Target::do_relax): Add parameters for input objects, symbol table
8747         and layout.
8748
8749 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8750
8751         * pread.c: Include stdio.h.
8752
8753 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8754
8755         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8756         defined.
8757
8758 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8759
8760         * dwarf_reader.cc (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         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8766         Change read_shndx type to unsigned int.
8767         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8768         int.
8769         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8770         * layout.cc (Layout::create_symtab_sections): Cast the result of
8771         local_symcount * symsize to off_t in the gold_assert.
8772
8773 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8774
8775         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8776         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8777         R_ARM_BASE_ABS.
8778         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8779         (Arm_relocate_functions::thm_abs5): New function.
8780         (Arm_relocate_functions::abs12): New function.
8781         (Arm_relocate_functions::abs16): New function.
8782         (Arm_relocate_functions::base_abs): New function.
8783         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8784         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8785         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8786         R_ARM_BASE_ABS.
8787         (Scan::global): Likewise.
8788         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8789         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
8790         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
8791         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
8792         R_ARM_BASE_ABS.
8793
8794 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8795
8796         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
8797         (Arm_relocate_functions::movt_prel): New function.
8798         (Arm_relocate_functions::thm_movw_prel_nc): New function.
8799         (Arm_relocate_functions::thm_movt_prel): New function.
8800         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
8801         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
8802         (Scan::global, Relocate::relocate): Likewise.
8803         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8804
8805 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8806
8807         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
8808         Incremental_checker.
8809         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
8810         unsigned int.
8811         (class Incremental_inputs_header): New class.
8812         (Incremental_inputs_header_writer): Edit comment.
8813         (Incremental_inputs_entry): New class.
8814         (Incremental_inputs_entry_writer): Edit comment.
8815         (Sized_incremental_binary::do_find_incremental_inputs_section):
8816         Add *strtab_shndx parameter, fill it.
8817         (Sized_incremental_binary::do_check_inputs): New method.
8818         (Incremental_checker::can_incrementally_link_output_file): Use
8819         Sized_incremental_binary::check_inputs.
8820         (Incremental_inputs::report_command_line): Save command line in
8821         command_line_.
8822         * incremental.h:
8823         (Incremental_binary::find_incremental_inputs_section): New
8824         method.
8825         (Incremental_binary::do_find_incremental_inputs_section): Add
8826         strtab_shndx parameter.
8827         (Incremental_binary::do_check_inputs): New pure virtual method.
8828         (Sized_incremental_binary::do_check_inputs): Declare.
8829         (Incremental_checker::Incremental_checker): Add incremental_inputs
8830         parameter, use it to initialize incremental_inputs_.
8831         (Incremental_checker::incremental_inputs_): New field.
8832         (Incremental_checker::command_line): New method.
8833         (Incremental_checker::inputs): New method.
8834         (Incremental_checker::command_line_): New field.
8835
8836 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
8837
8838         * incremental.cc: Include <cstdarg> and "target-select.h".
8839         (vexplain_no_incremental): New function.
8840         (explain_no_incremental): New function.
8841         (Incremental_binary::error): New method.
8842         (Sized_incremental_binary::do_find_incremental_inputs_section): New
8843         method.
8844         (make_sized_incremental_binary): New function.
8845         (open_incremental_binary): New function.
8846         (can_incrementally_link_file): Add checks if output is ELF and has
8847         inputs section.
8848         * incremental.h: Include "elfcpp_file.h" and "output.h".
8849         (Incremental_binary): New class.
8850         (Sized_incremental_binary): New class.
8851         (open_incremental_binary): Declare.
8852         * object.cc (is_elf_object): Use
8853         elfcpp::Elf_recognizer::is_elf_file.
8854         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
8855         * output.h (Output_file::filesize): New method.
8856
8857 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8858
8859         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
8860         New function.
8861         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
8862         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
8863         function.
8864         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
8865         function.
8866         (Arm_relocate_functions::movw_abs_nc): New function.
8867         (Arm_relocate_functions::movt_abs): New function.
8868         (Arm_relocate_functions::thm_movw_abs_nc): New function.
8869         (Arm_relocate_functions::thm_movt_abs): New function.
8870         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
8871         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
8872         (Scan::global): Likewise.
8873         (Relocate::relocate): Likewise.
8874         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8875
8876 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8877
8878         * arm.cc (Arm_relocate_functions::got_prel) New function.
8879         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
8880         (Relocate::relocate): Likewise.
8881         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8882
8883 2009-10-06  Ian Lance Taylor  <iant@google.com>
8884
8885         * options.h (class General_options): Define
8886         split_stack_adjust_size parameter.
8887         * object.h (class Object): Add uses_split_stack_ and
8888         has_no_split_stack_ fields.  Add uses_split_stack and
8889         has_no_split_stack accessor functions.  Declare
8890         handle_split_stack_section.
8891         (class Reloc_symbol_changes): Define.
8892         (class Sized_relobj): Define Function_offsets.  Declare
8893         split_stack_adjust, split_stack_adjust_reltype, and
8894         find_functions.
8895         * object.cc (Object::handle_split_stack_section): New function.
8896         (Sized_relobj::do_layout): Call handle_split_stack_section.
8897         * dynobj.cc (Sized_dynobj::do_layout): Call
8898         handle_split_stack_section.
8899         * reloc.cc (Sized_relobj::relocate_sections): Call
8900         split_stack_adjust for executable sections in split_stack
8901         objects.  Pass reloc_map to relocate_section.
8902         (Sized_relobj::split_stack_adjust): New function.
8903         (Sized_relobj::split_stack_adjust_reltype): New function.
8904         (Sized_relobj::find_functions): New function.
8905         * target-reloc.h: Include "object.h".
8906         (relocate_section): Add reloc_symbol_changes parameter.  Change
8907         all callers.
8908         * target.h (class Target): Add calls_non_split method.  Declare
8909         do_calls_non_split virtual method.  Declare match_view and
8910         set_view_to_nop.
8911         * target.cc: Include "elfcpp.h".
8912         (Target::do_calls_non_split): New function.
8913         (Target::match_view): New function.
8914         (Target::set_view_to_nop): New function.
8915         * gold.cc (queue_middle_tasks): Give an error if mixing
8916         split-stack and non-split-stack objects with -r.
8917         * i386.cc (Target_i386::relocate_section): Add
8918         reloc_symbol_changes parameter.
8919         (Target_i386::do_calls_non_split): New function.
8920         * x86_64.cc (Target_x86_64::relocate_section): Add
8921         reloc_symbol_changes parameter.
8922         (Target_x86_64::do_calls_non_split): New function.
8923         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
8924         parameter.
8925         * powerpc.cc (Target_powerpc::relocate_section): Add
8926         reloc_symbol_changes parameter.
8927         * sparc.cc (Target_sparc::relocate_section): Add
8928         reloc_symbol_changes parameter.
8929         * configure.ac: Call AM_CONDITIONAL for the default target.
8930         * configure: Rebuild.
8931         * testsuite/Makefile.am (TEST_AS): New variable.
8932         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
8933         (check_DATA): Add split_i386 and split_x86_64 files.
8934         (SPLIT_DEFSYMS): Define.
8935         (split_i386_[1234n].o): New targets.
8936         (split_i386_[124]): New targets.
8937         (split_i386_[1234r].stdout): New targets.
8938         (split_x86_64_[1234n].o): New targets.
8939         (split_x86_64_[124]): New targets.
8940         (split_x86_64_[1234r].stdout): New targets.
8941         (MOSTLYCLEANFILES): Add new executables.
8942         * testsuite/split_i386.sh: New file.
8943         * testsuite/split_x86_64.sh: New file.
8944         * testsuite/split_i386_1.s: New file.
8945         * testsuite/split_i386_2.s: New file.
8946         * testsuite/split_i386_3.s: New file.
8947         * testsuite/split_i386_4.s: New file.
8948         * testsuite/split_i386_n.s: New file.
8949         * testsuite/split_x86_64_1.s: New file.
8950         * testsuite/split_x86_64_2.s: New file.
8951         * testsuite/split_x86_64_3.s: New file.
8952         * testsuite/split_x86_64_4.s: New file.
8953         * testsuite/split_x86_64_n.s: New file.
8954         * testsuite/testfile.cc (Target_test): Update relocation_section
8955         function.
8956         * testsuite/Makefile.in: Rebuild.
8957
8958 2009-10-06  Ian Lance Taylor  <iant@google.com>
8959
8960         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
8961         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
8962         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
8963         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
8964         the address on ldo_addrs_.
8965         (Target_i386::Relocate::fix_up_ldo): New function.
8966
8967 2009-10-06   Rafael Espindola  <espindola@google.com>
8968
8969         * plugin.cc (add_input_library): New.
8970         (Plugin::load): Add add_input_library to tv.
8971         (Plugin_manager::add_input_file): Add the is_lib argument.
8972         (add_input_file): Update call to Plugin_manager::add_input_file.
8973         (add_input_library): New.
8974         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
8975
8976 2009-09-30  Doug Kwan  <dougkwan@google.com>
8977
8978         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
8979         symbol and call Symbol::may_need_copy_reloc to determine if
8980         a copy reloc is needed.
8981         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
8982         nocopyreloc is given in command line.
8983         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
8984         given in command line.
8985         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
8986         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
8987         of the removed Target_i386::may_need_copy_reloc.
8988         * options.h (copyreloc): New option with default value false.
8989         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8990         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
8991         instead of the removed Target_powerpc::may_need_copy_reloc.
8992         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
8993         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
8994         instead of the removed Target_sparc::may_need_copy_reloc.
8995         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
8996         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
8997         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
8998         instead of the removed Target_x86_64::may_need_copy_reloc.
8999
9000 2009-09-30  Ian Lance Taylor  <iant@google.com>
9001
9002         * object.h (class Object): Remove target_ field, and target,
9003         sized_target, and set_target methods.
9004         (Object::sized_target): Remove.
9005         (class Sized_relobj): Update declarations.  Remove sized_target.
9006         * object.cc (Sized_relobj::setup): Remove target parameter.
9007         Change all callers.
9008         (Input_objects::add_object): Don't do anything with the target.
9009         (make_elf_sized_object): Add punconfigured parameter.  Change all
9010         callers.  Set or test parameter target.
9011         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9012         Change all callers.
9013         * parameters.cc (Parameters::set_target): Change parameter type to
9014         be non-const.
9015         (Parameters::default_target): Remove.
9016         (set_parameters_target): Change parameter type to be non-const.
9017         (parameters_force_valid_target): New function.
9018         (parameters_clear_target): New function.
9019         * parameters.h (class Parameters): Update declarations.  Remove
9020         default_target method.  Add sized_target and clear_target
9021         methods.  Change target_ to be non-const.
9022         (set_parameters_target): Update declaration.
9023         (parameters_force_valid_target): Declare.
9024         (parameters_clear_target): Declare.
9025         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9026         as NULL if we aren't searching.
9027         (Add_symbols::run): Don't check for compatible target.
9028         * fileread.cc (Input_file::open_binary): Call
9029         parameters_force_valid_target.
9030         * gold.cc (queue_middle_tasks): Likewise.
9031         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9032         set_target on object.
9033         * dynobj.h (class Sized_dynobj): Update declarations.
9034         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9035         make_elf_object returns NULL.
9036         (Archive::include_member): Don't check whether object target is
9037         compatible.
9038         * output.cc (Output_section::add_input_section): Get target from
9039         parameters.
9040         (Output_section::relax_input_section): Likewise.
9041         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9042         parameters.
9043         (Sized_relobj::do_scan_relocs): Likewise.
9044         (Sized_relobj::relocate_sections): Likewise.
9045         * resolve.cc (Symbol_table::resolve): Likewise.
9046         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9047         parameter.  Change all callers.
9048         (Symbol_table::add_from_object): Get target from parameters.
9049         (Symbol_table::add_from_relobj): Don't check object target.
9050         (Symbol_table::add_from_dynobj): Likewise.
9051         (Symbol_table::define_special_symbol): Get target from
9052         parameters.
9053         * symtab.h (class Symbol_table): Update declaration.
9054         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9055         parameter.  Change all callers.  Clear parameter target.
9056         (Binary_test): Test target here.
9057         * testsuite/object_unittest.cc (gold_testsuite): Remove
9058         target_test_pointer parameter.  Change all callers.
9059         (Object_test): Test target here.
9060
9061 2009-09-26  Ian Lance Taylor  <iant@google.com>
9062
9063         * testsuite/initpri1.c: Don't try to use constructor priorities if
9064         compiling with gcc before 4.3.
9065
9066 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9067
9068         * testsuite/retain_symbols_file_test.sh (check_present): Change
9069         output file name to retain_symbols_file_test.stdout.
9070         (check_absent): Likewise.
9071
9072 2009-09-18  Craig Silverstein  <csilvers@google.com>
9073
9074         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9075         * options.cc: Include <cerrno> and <fstream>.
9076         (General_options::finalize): Parse -retain-symbols-file tag.
9077         * options.h: New flag.
9078         (General_options): New method should_retain_symbol, new
9079         variable symbols_to_retain.
9080         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9081         should_retain_symbol map.
9082         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9083         * testsuite/Makefile.in: Regenerate.
9084         * testsuite/retain_symbols_file_test.sh: New file.
9085
9086 2009-09-18  Nick Clifton  <nickc@redhat.com>
9087
9088         * po/es.po: Updated Spanish translation.
9089
9090 2009-09-17  Doug Kwan  <dougkwan@google.com>
9091
9092         * debug.h (DEBUG_RELAXATION): New constant.
9093         (DEBUG_ALL): Add DEBUG_RELAXATION.
9094         (debug_string_to_enum): Add relaxation debug option.
9095         * layout.cc
9096         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9097         Layout::Relaxation_debug_check::read_sections,
9098         Layout::Relaxation_debug_check::read_sections): New method definitions.
9099         (Layout::Layout): Initialize data members
9100         record_output_section_data_from_scrips_,
9101         script_output_section_data_list_ and relaxation_debug_check_.
9102         (Layout::save_segments, Layout::restore_segments,
9103         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9104         Layout::relaxation_loop_body): New method definitions.
9105         (Layout::finalize): Support relaxation.  Move section layout code to
9106         Layout::relaxation_loop_body.
9107         (Layout::set_asection_address_from_script): Move code for orphan
9108         section placement out.
9109         (Layout::place_orphan_sections_in_script): New method definition.
9110         * layout.h (Output_segment_headers, Output_file_header):
9111         New forward class declarations.
9112         (Layout::~Layout): Define.
9113         (Layout::new_output_section_data_from_script): New method definition.
9114         (Layout::place_orphan_sections_in_script): New method declaration.
9115         (Layout::Segment_states): New type declaration.
9116         (Layout::save_segments, Layout::restore_segments,
9117         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9118         Layout::relaxation_loop_body): New method declarations.
9119         (Layout::Output_section_data_list): New type declaration.
9120         (Layout::Relaxation_debug_check): New class definition.
9121         (Layout::record_output_section_data_from_script_,
9122         Layout::script_output_section_data_list_, Layout::segment_states_,
9123         Layout::relaxation_debug_check_): New data members.
9124         * output.cc: (Output_section_headers::do_size): New method definition.
9125         (Output_section_headers::Output_section_headers): Move size
9126         computation to Output_section_headers::do_size.
9127         (Output_segment_headers::do_size): New method definition.
9128         (Output_file_header::Output_file_header): Move size computation to
9129         Output_file_header::do_size and call it.
9130         (Output_file_header::do_size): New method definition.
9131         (Output_data_group::Output_data_group): Adjust call to
9132         Output_section_data.
9133         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9134         (Output_symtab_xindex::do_write): Add array bound check.
9135         (Output_section::Input_section::print_to_mapfile): Handle
9136         RELAXED_INPUT_SECTION_CODE.
9137         (Output_section::Output_section): Initialize data member checkpoint_.
9138         (Output_section::~Output_section): Delete checkpoint object pointed
9139         by checkpoint_.
9140         (Output_section::add_input_section): Always add an Input_section if
9141         relaxing.
9142         (Output_section::add_merge_input_section): Add assert.
9143         (Output_section::relax_input_section): New method definition.
9144         (Output_section::set_final_data_size): Set load address to zero for
9145         an unallocated section.
9146         (Output_section::do_address_and_file_offset_have_reset_values):
9147         New method definition.
9148         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9149         Handle relaxed input section.
9150         (Output_section::sort_attached_input_sections): Checkpoint input
9151         section list lazily.
9152         (Output_section::get_input_sections): Change type of input_sections to
9153         list of Simple_input_section pointers.  Checkpoint input section list
9154         lazily.  Also handle relaxed input sections.
9155         (Output_section::add_input_section_for_script): Take a reference to
9156         a Simple_input_section object instead of Relobj pointer and section
9157         index as parameter.  Handle relaxed input sections.
9158         (Output_section::save_states, Output_section::restore_states): New
9159         method definitions.
9160         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9161         (Output_data::is_data_size_fixed): New method definition.
9162         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9163         if it is fixed.
9164         (Output_data::address_and_file_offset_have_reset_values): New method
9165         definition.
9166         (Output_data::do_address_and_file_offset_have_reset_values): New method
9167         definition.
9168         (Output_data::set_data_size): Check that data size is not fixed.
9169         (Output_data::fix_data_size): New method definition.
9170         (Output_data::is_data_size_fixed_): New data member.
9171         (Output_section_headers::set_final_data_size): New method definition.
9172         (Output_section_headers::do_size): New method declaration.
9173         (Output_segment_headers::set_final_data_size): New method definition.
9174         (Output_segment_headers::do_size): New method declaration.
9175         (Output_file_header::set_final_data_size)::New method definition.
9176         (Output_file_header::do_size)::New method declaration.
9177         (Output_section_data::Output_section_data): Add new parameter
9178         is_data_size_fixed and use it to fix data size.
9179         (Output_data_const::Output_data_const): Adjust call to base class
9180         constructor and fix data size.
9181         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9182         base class constructor and fix data size.
9183         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9184         base class constructor and fix data size.
9185         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9186         class constructor and fix data size.
9187         (Output_data_group::set_final_data_size): New method definition.
9188         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9189         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9190         class constructor and fix data size.
9191         (Output_relaxed_input_section): New class definition.
9192         (Output_section::Simple_input_section): New class definition.
9193         (Output_section::get_input_sections): Adjust parameter list.
9194         (Output_section::add_input_section_for_script): Same.
9195         (Output_section::save_states, Output_section::restore_states,
9196         Output_section::do_address_and_file_offset_have_reset_values,
9197         (Output_section::Input_section::Input_section): Handle
9198         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9199         Output_relaxed_input_section.
9200         (Output_section::Input_section::is_input_section,
9201         Output_section::Input_section::set_output_section): Handle relaxed
9202         input section.
9203         (Output_section::Input_section::is_relaxed_input_section,
9204         Output_section::Input_section::output_section_data,
9205         Output_section::Input_section::relaxed_input_section): New method
9206         definitions.
9207         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9208         value.
9209         (Output_section::Input_section::u1_): Update comments.
9210         (Output_section::Input_section::u2_): Add new union member poris.
9211         (Output_section::Checkpoint_output_section): New classs definition.
9212         (Output_section::relax_input_section): New method declaration.
9213         (Output_section::checkpoint_): New data member.
9214         (Output_segment): Update comments.
9215         (Output_segment::Output_segment): Un-privatize copy constructor.
9216         (Output_segment::operator=): Un-privatize.
9217         * script-sections.cc (Output_section_element::Input_section_list):
9218         Change element type to Output_section::Simple_input_section.
9219         (Output_section_element_dot_assignment::set_section_addresses):
9220         Register output section data for relaxation clean up.
9221         (Output_data_exression::Output_data_expression): Adjust call to base
9222         constructor to fix data size.
9223         (Output_section_element_data::set_section_addresses): Register
9224         Output_data_expression object for relaxation clean up.
9225         (struct Input_section_info): Replace Relobj pointer and section index
9226         pair with Output_section::Simple_input_section and Convert struct to a
9227         class.
9228         (Input_section_sorter::operator()): Adjust access to
9229         Input_section_info data member to use accessors.
9230         (Output_section_element_input::set_section_addresses): Use layout
9231         parameter.  Adjust code to use Output_section::Simple_input_section
9232         and Input_secction_info classes.  Register filler for relaxation
9233         clean up.
9234         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9235         and section index pair with Output_section::Simple_input_section
9236         class.  Adjust code accordingly.
9237         (Phdrs_element::release_segment): New method definition.
9238         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9239         segment list.
9240         (Script_sections::release_segments): New method definition.
9241         * gold/script-sections.h (Script_sections::release_segments): New
9242         method declaration.
9243         * gold/target.h (Target::may_relax, Target::relax,
9244         Target::do_may_relax, Target::do_relax): New method definitions.
9245
9246 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9247
9248         * arm.cc (has_signed_unsigned_overflow): New function.
9249         (Arm_relocate_functions::abs8): New function.
9250         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9251         (Target_arm::Scan::global): Likewise.
9252         (Target_arm::relocate::relocate): Likewise.
9253         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9254         Likewise.
9255
9256 2009-09-16  Cary Coutant  <ccoutant@google.com>
9257
9258         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9259         * testsuite/Makefile.in: Regenerate.
9260
9261 2009-09-11  Nick Clifton  <nickc@redhat.com>
9262
9263         * po/gold.pot: Updated by the Translation project.
9264
9265 2009-09-08  Cary Coutant  <ccoutant@google.com>
9266
9267         * output.cc (Output_file::open): Add execute permission to empty file.
9268         * testsuite/Makefile.am (permission_test): New test.
9269         * testsuite/Makefile.in: Regenerate.
9270
9271 2009-09-02  Ian Lance Taylor  <iant@google.com>
9272
9273         * output.cc (Output_file::resize): Call map_no_anonymous rather
9274         than map.
9275
9276 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9277
9278         * gold.cc: Include "incremental.h".
9279         (queue_initial_tasks): Call Incremental_checker methods.
9280         * incremental.cc: Include "output.h".
9281         (Incremental_checker::can_incrementally_link_output_file): New
9282         method.
9283         * incremental.h (Incremental_checker): New class.
9284
9285         * output.cc (Output_file::open_for_modification): New method.
9286         (Output_file::map_anonymous): Changed return type to bool.  Record
9287         map in base_ field.
9288         (Output_file::map_no_anonymous): New method, broken out of map.
9289         (Output_file::map): Use map_no_anonymous and map_anonymous.
9290         * output.h (class Output_file): Update declarations.
9291
9292 2009-08-24  Cary Coutant  <ccoutant@google.com>
9293
9294         * options.h (Command_line::Pre_options): New class.
9295         (Command_line::pre_options): New member.
9296         * options.cc (gold::options::ready_to_register): New variable.
9297         (One_option::register_option): Do nothing if not registering options.
9298         Assert if same short option registered twice.
9299         (General_options::General_options): Turn off option registration when
9300         done constructing.
9301         (Command_line::Pre_options::Pre_options): New constructor.
9302
9303 2009-08-24  Cary Coutant  <ccoutant@google.com>
9304
9305         * options.h (General_options::no_keep_memory): Remove incorrect
9306         short option.
9307
9308 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9309
9310         * Makefile.am (am__skiplex, am__skipyacc): New.
9311         * Makefile.in: Regenerate.
9312
9313 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9314
9315         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9316         (INCLUDES): ... this.
9317         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9318         (AM_CPPFLAGS): Renamed from ...
9319         (INCLUDE): ... this.
9320         * Makefile.in, testsuite/Makefile.in: Regenerate.
9321
9322         * Makefile.in: Regenerate.
9323         * aclocal.m4: Likewise.
9324         * config.in: Likewise.
9325         * configure: Likewise.
9326         * testsuite/Makefile.in: Likewise.
9327
9328         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9329         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9330         * Makefile.in: Regenerate.
9331         * testsuite/Makefile.in: Regenerate.
9332
9333 2009-08-19  Cary Coutant  <ccoutant@google.com>
9334
9335         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9336         symbols in shared libraries overridden by hidden or internal symbols
9337         in the main program.
9338
9339 2009-08-19  Chris Demetriou  <cgd@google.com>
9340
9341         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9342         checking source file names in error messages.
9343
9344 2009-08-18  Doug Kwan  <dougkwan@google.com>
9345
9346         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9347         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9348         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9349         an elfcpp::Ehdr as parameter.
9350         * object.cc (Object::set_target): Remove the version that looks up
9351         a target and sets it.
9352         (Sized_relobj::setup): Take a Target object instead of
9353         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9354         (make_elf_sized_object): Find target and ask target to
9355         make an ELF object.
9356         * object.h: (Object::set_target): Remove the version that looks up
9357         a target and sets it.
9358         (Sized_relobj::setup): Take a Target object instead of
9359         an elfcpp:Ehdr as parameter.
9360         * target.cc: Include dynobj.h.
9361         (Target::do_make_elf_object_implementation): New.
9362         (Target::do_make_elf_object): New.
9363         * target.h (Target::make_elf_object): New template declaration.
9364         (Target::do_make_elf_object): New method declarations.
9365         (Target::do_make_elf_object_implementation): New template declaration.
9366
9367 2009-08-14  Ian Lance Taylor  <iant@google.com>
9368
9369         * gold.h (FUNCTION_NAME): Define.
9370         (gold_unreachable): Use FUNCTION_NAME.
9371
9372 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9373
9374         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9375         symbol in the --keep-unique list is not found.
9376
9377 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9378
9379         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9380         been maked as --keep-unique.
9381         (Icf::unfold_section): New function.
9382         * icf.h (Icf::unfold_section): New function.
9383         * options.h (General_options::keep_unique): New option.
9384         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9385         * testsuite/Makefile.in: Regenerate.
9386         * testsuite/icf_keep_unique_test.sh: New file.
9387         * testsuite/icf_keep_unique_test.cc: New file.
9388
9389 2009-08-12  Cary Coutant  <ccoutant@google.com>
9390
9391         PR 10471
9392         * resolve.cc (Symbol_table::resolve): Check for references from
9393         dynamic objects to hidden and internal symbols.
9394         * testsuite/Makefile.am (hidden_test.sh): New test.
9395         * testsuite/Makefile.in: Regenerate.
9396         * testsuite/hidden_test.sh: New script.
9397         * testsuite/hidden_test_1.c: New test source.
9398         * testsuite/hidden_test_main.c: New test source.
9399
9400 2009-08-11  Doug Kwan  <dougkwan@google.com>
9401
9402         * arm.cc: Update comments.
9403         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9404         segment to locate the .ARM.exidx section if present.
9405
9406 2009-08-09  Doug Kwan  <dougkwan@google.com>
9407
9408         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9409         patch.
9410
9411 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9412         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9413         compiler warnings.
9414
9415 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9416
9417         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9418         valid tls_segment only for non-debug-section relocations.
9419         * testsuite/Makefile.am: Add gc_tls_test.
9420         * testsuite/Makefile.in: Regenerate.
9421         * testsuite/gc_tls_test.cc: New file.
9422         * testsuite/gc_tls_test.sh: New file.
9423
9424 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9425
9426         * icf.cc: New file.
9427         * icf.h: New file.
9428         * Makefile.am (CCFILES): Add icf.cc.
9429         (HFILES): Add icf.h
9430         * Makefile.in: Regenerate.
9431         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9432         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9433         section, symbol and addend information for the relocs.
9434         * gold.cc (queue_middle_tasks): Call identical code folding.
9435         * gold.h: Add defines for multimap.
9436         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9437         to the call of finalize_local_symbols.
9438         * main.cc (main): Create object of class Icf.
9439         * object.cc (Sized_relobj::do_layout): Allow this function to be
9440         called twice during icf.
9441         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9442         to sections marked as identical by icf.
9443         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9444         when available.
9445         (Sized_relobj::do_section_entsize): New function.
9446         * object.h (Object::section_entsize): New function.
9447         (Object::do_section_entsize): New pure virtual function.
9448         (Relobj::finalize_local_symbols): Add new parameter.
9449         (Relobj::do_section_entsize): New function.
9450         * options.h (General_options::icf): New option.
9451         (General_options::icf_iterations): New option.
9452         (General_options::print_icf_sections): New option.
9453         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9454         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9455         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9456         icf.
9457         * symtab.cc (Symbol_table::is_section_folded): New function.
9458         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9459         to sections marked as identical by icf.
9460         * symtab.h (Symbol_table::set_icf): New function.
9461         (Symbol_table::icf): New function.
9462         (Symbol_table::is_section_folded): New function.
9463         (Symbol_table::icf_): New data member.
9464         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9465         * testsuite/Makefile.am: Add commands to build icf_test.
9466         * testsuite/Makefile.in: Regenerate.
9467         * testsuite/icf_test.sh: New file.
9468         * testsuite/icf_test.cc: New file.
9469
9470 2009-07-24  Chris Demetriou  <cgd@google.com>
9471
9472         * layout.cc (is_compressible_debug_section): Fix incorrect
9473         comment about compressed section names.
9474
9475 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9476
9477         PR 10419
9478         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9479
9480 2009-07-16  Ian Lance Taylor  <iant@google.com>
9481
9482         PR 10400
9483         * layout.h: #include <map>.
9484         (class Kept_section): Change from struct to class.  Add accessors
9485         and setters.  Add section size to Comdat_group mapping.  Change
9486         Comdat_group to std::map.  Add is_comdat_ field.  Add
9487         linkonce_size field in union.
9488         (class Layout): Update declaration of find_or_add_kept_section.
9489         Don't declare find_kept_object.
9490         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9491         parameter.  Add object, shndx, is_comdat, and is_group_name
9492         parameters.  Change all callers.  Adjust for new Kept_section.
9493         (Layout::find_kept_object): Remove.
9494         * object.cc (Sized_relobj::include_section_group): Update use of
9495         Kept_section.  Rename secnum to shndx.  Only record
9496         Kept_comdat_section if sections are the same size.
9497         (Sized_relobj::include_linkonce_section): Update use of
9498         Kept_section.  Only record Kept_comdat_section if sections are the
9499         same size.  Set size of linkonce section.
9500         (Sized_relobj::map_to_kept_section): Update call to
9501         get_kept_comdat_section.
9502         * object.h (class Sized_relobj): Rename fields in
9503         Kept_comdat_section to drop trailing underscores; change object
9504         field to Relobj*.  Change Kept_comdat_section_table to store
9505         struct rather than pointer.
9506         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9507         Add kept_object and kept_shndx parameters.  Change all callers.
9508         (Sized_relobj::get_kept_comdat_section): Change return type to
9509         bool.  Add kept_object and kept_shndx parameters.  Change all
9510         callers.
9511         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9512         Layout::find_or_add_kept_section.
9513
9514 2009-07-09  Ian Lance Taylor  <iant@google.com>
9515
9516         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9517         Reserve space in the hash table.
9518
9519 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9520
9521         * fileread.cc (File_read::get_mtime): New method.
9522         * fileread.h (Timespec): New structure.
9523         (File_read::get_mtime): New method.
9524         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9525         Renamed from timestamp_nsec.
9526         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9527         Elf_Xword.
9528         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9529         timestamp_nsec.
9530         (Incremental_inputs::report_archive): Save mtime; style fix.
9531         (Incremental_inputs::report_obejct): Save mtime; style fix.
9532         (Incremental_inputs::report_script): Save mtime; style fix.
9533         (Incremental_inputs::finalize_inputs): Style fix.
9534         (Incremental_inputs::finalize): Style fix.
9535         (Incremental_inputs::create_input_section_data): Store inputs
9536         mtime.
9537         * incremental.h (Incremental_inputs::report_script): Add mtime
9538         argument.
9539         (Incremental_inputs::Input_info::Input_info): Intialize only one
9540         union member.
9541         (Incremental_inputs::Input_info::archive): Move to nameless
9542         union.
9543         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9544         (Incremental_inputs::Input_info::script): Move to nameless union.
9545         (Incremental_inputs::mtime): New field.
9546         * script.cc (read_input_script): Pass file mtime to
9547         Incremental_input.
9548         * script.h (Script_info::inputs): Style fix.
9549
9550 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9551
9552         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9553         instead of 32.
9554
9555 2009-06-24  Ian Lance Taylor  <iant@google.com>
9556
9557         PR 10156
9558         * layout.cc (Layout::choose_output_section): If we find an
9559         existing section, update the flags.
9560         (Layout::create_notes): New function, broken out of
9561         Layout::finalize.
9562         (Layout::finalize): Don't create note sections.
9563         (Layout::create_note): Don't crash if linker script discards
9564         section.
9565         (Layout::create_gold_note): Likewise.
9566         (Layout::create_build_id): Likewise.  Don't set
9567         after_input_sections on the section.
9568         (Layout::create_executable_stack_info): Remove target parameter.
9569         Change caller.
9570         * layout.h (class Layout): Declare create_notes.  Update
9571         declaration of create_executable_stack_info.
9572         * gold.cc (queue_middle_tasks): Call create_notes.
9573         * output.cc (Output_section::update_flags_for_input_section): Move
9574         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9575         invalid.
9576         * output.h (Output_data::mark_address_invalid): New function.
9577         (class Output_section): Only declare, not define,
9578         update_flags_for_input_section.  Remove set_flags.
9579
9580 2009-06-24  Ian Lance Taylor  <iant@google.com>
9581
9582         * script-sections.cc (Output_section_definition::
9583         set_section_addresses): Rename shadowing local load_address to
9584         laddr.
9585
9586 2009-06-24  Ian Lance Taylor  <iant@google.com>
9587
9588         PR 10244
9589         * reloc.cc (relocate_sections): Skip empty relocation sections.
9590
9591 2009-06-23  Ian Lance Taylor  <iant@google.com>
9592
9593         PR 10156
9594         * layout.cc (Layout::create_note): Use choose_output_section
9595         rather than make_output_section.
9596
9597 2009-06-23  Ian Lance Taylor  <iant@google.com>
9598
9599         PR 10237
9600         * options.cc (General_options::parse_V): Set printed_version_.
9601         (General_options::General_options): Initialize printed_version_.
9602         * options.h (class General_options): Add printed_version_ field.
9603         * gold.cc (queue_initial_tasks): If there are no input files,
9604         don't give a fatal error if we printed the version information.
9605         (queue_middle_tasks): If using -r with a shared object, give a
9606         fatal error rather than an ordinary error.
9607
9608 2009-06-23  Ian Lance Taylor  <iant@google.com>
9609
9610         PR 10219
9611         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9612         (Layout::make_output_section): Set have_stabstr_section_ if we see
9613         a .stab*str section.
9614         (Layout::finalize): Call link_stabs_sections.
9615         (Layout::link_stabs_sections): New file.
9616         * layout.h (class Layout): Add have_stabstr_section_ field.
9617         Declare link_stabs_sections.
9618
9619 2009-06-23  Doug Kwan  <dougkwan@google.com>
9620
9621         * Makefile.am (libgold_a_LIBADD): New.
9622         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9623         * Makefile.in: Regenerate.
9624         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9625         * configure: Regenerate.
9626         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9627         * fileread.cc: Include sys/state.h
9628         * gold.h: Declare memmem and strndup if found missing.
9629         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9630
9631 2009-06-23  Ian Lance Taylor  <iant@google.com>
9632
9633         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9634         * configure: Rebuild.
9635
9636 2009-06-23  Ian Lance Taylor  <iant@google.com>
9637
9638         PR 10147
9639         * object.cc (Object::section_contents): Don't try to get a view if
9640         the section has length zero.
9641         (Object::handle_gnu_warning_section): If the section is empty, use
9642         the name of the section as the warning.
9643
9644 2009-06-23  Ian Lance Taylor  <iant@google.com>
9645
9646         PR 10133
9647         * stringpool.h (class Stringpool_template): Add optimize_ field.
9648         (Stringpool_template::set_optimize): New function.
9649         * stringpool.cc (Stringpool_template::Stringpool_template):
9650         Initialize optimize_ field.
9651         (Stringpool_template::set_string_offsets): Test local optimize
9652         fild rather than parameter.
9653         * layout.cc (Layout::Layout): Call set_optimize on the section
9654         name stringpool.
9655
9656 2009-06-22  Ian Lance Taylor  <iant@google.com>
9657
9658         PR 10030
9659         * yyscript.y: Parse TARGET.
9660         * script.cc (script_set_target): New function.
9661         * script-c.h (script_set_target): Declare.
9662         * options.cc (General_options::string_to_object_format): Rename
9663         from string_to_object_format in anonymous namespace.  Change
9664         callers.
9665         * options.h (class General_options): Declare
9666         string_to_object_format.
9667
9668 2009-06-22  Ian Lance Taylor  <iant@google.com>
9669
9670         * script-sections.cc (Script_sections::create_segments): Don't put
9671         program headers in a PT_LOAD segment if -n or -N.
9672
9673 2009-06-22  Ian Lance Taylor  <iant@google.com>
9674
9675         PR 10141
9676         * options.h (class General_options): Add -z lazy and -z now.  Sort
9677         -z options into alphabetical order.
9678         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9679
9680 2009-06-21  Ian Lance Taylor  <iant@google.com>
9681
9682         * layout.cc (Layout::make_output_section): Call
9683         Target::new_output_section.
9684         (Layout::attach_allocated_section_to_segment): Put large section
9685         sections in a separate load segment with the large segment flag
9686         set.
9687         (Layout::segment_precedes): Sort large data segments after other
9688         load segments.
9689         (align_file_offset): New static function.
9690         (Layout::set_segment_offsets): Use align_file_offset.
9691         * output.h (class Output_section): Add is_small_section_ and
9692         is_large_section_ fields.
9693         (Output_section::is_small_section): New function.
9694         (Output_section::set_is_small_section):  New function.
9695         (Output_section::is_large_section): New function.
9696         (Output_section::set_is_large_section): New function.
9697         (Output_section::is_large_data_section): New function.
9698         (class Output_segment): Add is_large_data_segment_ field.
9699         (Output_segment::is_large_data_segment): New function.
9700         (Output_segment::set_is_large_data_segment): New function.
9701         * output.cc (Output_section::Output_section): Initialize new
9702         fields.
9703         (Output_segment::Output_segment): Likewise.
9704         (Output_segment::add_output_section): Add assertion that large
9705         data sections always go in large data segments.  Force small data
9706         sections to the end of the list of data sections.  Force small BSS
9707         sections to the start of the list of BSS sections.  For large BSS
9708         sections to the end of the list of BSS sections.
9709         * symtab.h (class Symbol): Declare is_common_shndx.
9710         (Symbol::is_defined): Check Symbol::is_common_shndx.
9711         (Symbol::is_common): Likewise.
9712         (class Symbol_table): Define enum Commons_section_type.  Update
9713         declarations.  Add small_commons_ and large_commons_ fields.
9714         * symtab.cc (Symbol::is_common_shndx): New function.
9715         (Symbol_table::Symbol_table): Initialize new fields.
9716         (Symbol_table::add_from_object): Put small and large common
9717         symbols in the right list.
9718         (Symbol_table::sized_finalized_symbol): Check
9719         Symbol::is_common_shndx.
9720         (Symbol_table::sized_write_globals): Likewise.
9721         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9722         common symbol lists.  Don't call do_allocate_commons_list if the
9723         list is empty.
9724         (Symbol_table::do_allocate_commons_list): Remove is_tls
9725         parameter.  Add comons_section_type parameter.  Change all
9726         callers.  Handle small and large common symbols.
9727         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9728         Symbol::is_common_shndx.
9729         * resolve.cc (symbol_to_bits): Likewise.
9730         * target.h (Target::small_common_shndx): New function.
9731         (Target::small_common_section_flags): New function.
9732         (Target::large_common_shndx): New function.
9733         (Target::large_common_section_flags): New function.
9734         (Target::new_output_section): New function.
9735         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9736         small_common_section_flags, and large_common_section_flags
9737         fields.
9738         (Target::do_new_output_section): New virtual function.
9739         * arm.cc (Target_arm::arm_info): Initialize new fields.
9740         * i386.cc (Target_i386::i386_info): Likewise.
9741         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9742         Likewise.
9743         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9744         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9745         (Target_x86_64::do_new_output_section): New function.
9746         * configure.ac: Define conditional MCMODEL_MEDIUM.
9747         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9748         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9749         (large_LDFLAGS): Define.
9750         * testsuite/large.c: New file.
9751         * testsuite/testfile.cc (Target_test::test_target_info):
9752         Initialize new fields.
9753         * configure, testsuite/Makefile.in: Rebuild.
9754
9755 2009-06-05  Doug Kwan  <dougkwan@google.com>
9756
9757         * Makefile.am (CCFILES): Add target.cc.
9758         * Makefile.in: Regenerate.
9759         * i386.cc (class Target_i386): Define new virtual method to
9760         override do_is_local_label_name in parent.
9761         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9762         local symbols if --discard-locals or -X is given.
9763         * options.h (class General_options): Declare new options
9764         '--discard-locals' and '-X' for discarding locals.
9765         * target.h (class Target): Define new methods is_local_label_name.
9766         Declare new virtual method do_is_local_label_name.
9767         * target.cc: New file.
9768         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9769         (check_SCRIPTS): Add discard_locals_test.sh.
9770         (check_DATA): Add discard_local_tests.syms.
9771         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9772         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9773         * testsuite/Makefile.in: Regenerate.
9774         * testsuite/discard_locals_test.c: New file.
9775         * testsuite/discard_locals_test.sh: Same.
9776
9777 2009-06-05  Doug Kwan  <dougkwan@google.com>
9778
9779         * object.cc (Sized_relobj::Sized_relobj): Initialize
9780         discarded_eh_frame_shndx_ to -1U.
9781         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9782         section.
9783         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9784         a discarded .eh_frame section.
9785         (Sized_relobj::do_finalize_local_symbols): Ditto.
9786         * object.h (class Sized_relobj): Declare new member
9787         discarded_eh_frame_shndx_.
9788         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9789         (local_labels_test.o, local_labels_test): New rules.
9790         * testsuite/Makefile.in: Regenerate.
9791
9792 2009-06-04  Doug Kwan  <dougkwan@google.com>
9793
9794         * layout.cc (Layout::section_name_mapping): Add mapping for
9795         special ARM sections.
9796
9797 2009-06-03  Doug Kwan  <dougkwan@google.com>
9798
9799         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
9800         (utils::has_overflow): Same.
9801
9802 2009-06-03  Ian Lance Taylor  <iant@google.com>
9803
9804         * layout.cc (Layout::section_name_mapping): New array, replacing
9805         Layout::linkonce_mapping.
9806         (Layout::section_name_mapping_count): New variable, replacing
9807         Layout::linkonce_mapping_count.
9808         (Layout::linkonce_output_name): Remove.
9809         (Layout::output_section_name): Rewrite.
9810         * layout.h (class Layout): Rename Linkonce_mapping to
9811         Section_name_mapping, linkonce_mapping to section_name_mapping,
9812         linkonce_mapping_count to section_name_mapping_count.  Don't
9813         declare linkonce_output_name.
9814
9815 2009-06-03  Doug Kwan  <dougkwan@google.com>
9816
9817         * gold/arm.cc (namespace utils): New.
9818         (Target_arm::reloc_is_non_pic): Define new method.
9819         (class Arm_relocate_functions): New.
9820         (Target_arm::Relocate::relocate): Handle relocation types used by
9821         Android.
9822
9823 2009-06-03  Ian Lance Taylor  <iant@google.com>
9824
9825         * arm.cc (Target_arm::scan::global): Use || instead of |.
9826
9827 2009-06-02  Doug Kwan  <dougkwan@google.com>
9828
9829         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
9830         issued_non_pic_error_.
9831         (class Target_arm::Scan): Declare new method check_non_pic.
9832         Define new method symbol_needs_plt_entry.
9833         Declare new data member issued_non_pic_error_.
9834         (class Target_arm::Relocate): Declare new method
9835         should_apply_static_reloc.
9836         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
9837         (Target_arm::Scan::check_non_pic): Define new method.
9838         (Target_arm::Scan::local): Handle a small subset of reloc types used
9839         by Android.
9840         (Target_arm::Scan::local): Same.
9841         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
9842
9843 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
9844
9845         * incremental.cc (Incremental_inputs::report_command_line): Filter
9846         out --incremental-* options.
9847
9848 2009-05-29  Doug Kwan  <dougkwan@google.com>
9849
9850         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
9851         template class.
9852         (class Target_arm): Update comment.
9853         (Target_arm::Target_arm): Initialize new data members GOT_,
9854         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
9855         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
9856         and Target_arm::rel_dyn_section.
9857         Declare new_enum Target_arm::Got_type.
9858         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
9859         and DYNBSS_.
9860         Update commments for member do_dynsym_value.
9861         (Target_arm::got_size, Target_arm::plt_section,
9862         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
9863         new methods inside class defintion.
9864         (Target_arm::got_section): Define new method.
9865         (Target_arm::rel_dyn_section): Same.
9866         (Output_data_plt_arm): New template class.
9867         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
9868         (Output_data_plt_arm:do_adjust_output_section): Define new method.
9869         (Output_data_plt_arm::add_entry): Same.
9870         (Output_data_plt_arm::first_plt_entry): Define new
9871         static data member for PLT instruction template.
9872         (Output_data_plt_arm::plt_entry): Same.
9873         (Output_data_plt_arm::do_write): Define new method.
9874         (Target_arm::make_plt_entry): Same.
9875         (Target_arm::do_finalize_sections): Same.
9876         (Target_arm::do_dynsym_value): Same.
9877
9878 2009-05-28  Doug Kwan  <dougkwan@google.com>
9879
9880         * Makefile.am (TARGETSOURCES): Add arm.cc.
9881         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
9882         * Makefile.in: Regenerate.
9883         * arm.cc: New file.
9884         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
9885
9886 2009-05-26  Doug Kwan  <dougkwan@google.com>
9887
9888         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
9889         (General_options::check_excluded_libs): Strip off directories in
9890         archive name before matching like GNU ld does.
9891         * testsuite/Makefile.am (MOSTLYCLEANFILES,
9892         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
9893         (exclude_libs_test_LDFLAGS): Add linker option
9894         -Wl,--exclude-libs,libexclude_libs_test_3
9895         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
9896         an explicit archive without using -l.
9897         (alt/libexclude_libs_test_3.a): New make rule.
9898         * testsuite/Makefile.in: Regenerate.
9899         * testsuite/exclude_libs_test.c : Declare lib3_default().
9900         (main): Call it.
9901         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
9902         * exclude_libs_test_3.c: New file.
9903
9904 2009-05-26  Nick Clifton  <nickc@redhat.com>
9905
9906         * po/id.po: New Indonesian translation.
9907         * po/gold.pot: Updated template file.
9908
9909 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
9910
9911         * testsuite/Makefile.am: Add -ffunction-sections to compile
9912         gc_comdat_test files.  Add -Wl,--gc-sections to build
9913         gc_comdat_test.
9914         * testsuite/Makefile.in: Regenerate.
9915         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
9916
9917 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
9918
9919         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
9920         kept comdat section was garbage collected.
9921         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
9922         * testsuite/Makefile.in: Regenerate.
9923         * testsuite/gc_comdat_test.sh: New file.
9924         * testsuite/gc_comdat_test_1.cc: New file.
9925         * testsuite/gc_comdat_test_2.cc: New file.
9926
9927 2009-05-19  Doug Kwan  <dougkwan@google.com>
9928
9929         * archive.cc (Archive::Archive): Move constructor from archive.h
9930         to here.  Initialize no_export_.
9931         (Archive::get_elf_object_for_member): Set no_export flag of object.
9932         * archive.h (Archive::Archive): Move constructor body to
9933         archive.cc.
9934         (Archive::no_export): New method.
9935         (Archive::no_export_): New field.
9936         * object.h (Object::Object): Initialize no_export_ to false.
9937         (Object::no_export, Object::set_no_export): New methods.
9938         (Object::no_export_): New field.
9939         * options.cc (General_options::parse_exclude_libs): New method.
9940         (General_options::check_excluded_libs) Same.
9941         * options.h (exclude_libs): New option.
9942         (General_options::check_excluded_libs): New method declaration.
9943         (General_options::excluded_libs_): New field.
9944         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
9945         default or protected visibility if an object has no-export flag set.
9946         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
9947         (check_SCRIPTS): Add exclude_libs_test.sh.
9948         (check_DATA): Add exclude_libs_test.syms.
9949         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
9950         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
9951         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
9952         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
9953         (exclude_libs_test.syms, libexclude_libs_test_1.a,
9954         libexclude_libs_test_2.a): New rules.
9955         * testsuite/Makefile.in: Regenerate.
9956         * testsuite/exclude_libs_test.c: New file.
9957         * testsuite/exclude_libs_test.sh: Ditto.
9958         * testsuite/exclude_libs_test_1.c: Ditto.
9959         * testsuite/exclude_libs_test_2.c: Ditto.
9960
9961 2009-05-15  Ian Lance Taylor  <iant@google.com>
9962
9963         * configure.ac: Check for declarations for cases where libiberty.h
9964         checks HAVE_DECL_xxx.
9965         * configure, config.in: Rebuild.
9966
9967 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
9968
9969         * gold.h (Incremental_argument_list): Remove (invalid) forward
9970         declaration.
9971         * incremental.cc (Incremental_inputs::report_achive): New method.
9972         (Incremental_inputs::report_object): New method.
9973         (Incremental_inputs::report_script): New method.
9974         (Incremental_inputs::finalize_inputs): New method.
9975         (Incremental_inputs::finalize): Call finalize_inputs().
9976         (Incremental_inputs::sized_create_incremental_inputs_section_data):
9977         Create inputs entries.
9978         * incremental.h (Incremental_input_type): New enum.
9979         (Incremental_inputs::Incremental_input): Initialize new fields.
9980         (Incremental_inputs::report_inputs): New method.
9981         (Incremental_inputs::report_achive): New method.
9982         (Incremental_inputs::report_object): New method.
9983         (Incremental_inputs::report_script): New method.
9984         (Incremental_inputs::finalize_inputs): New method.
9985         (Incremental_inputs::Input_info): New struct.
9986         (Incremental_inputs::Input_info_map): New typedef.
9987         (Incremental_inputs::lock_): New field.
9988         (Incremental_inputs::Inputs_): New field.
9989         (Incremental_inputs::Inputs_map): New field.
9990         * main.cc (main): Call Incremental_input::report_inputs.
9991         * options.h (Input_argument_list): Typedef moved from
9992         Input_arguments.
9993         (Input_file_group::Files): Remove, use ::Input_argument_list.
9994         (Input_file_group::Input_argument_list): Remove, use
9995         ::Input_argument_list.
9996         * plugin.cc (Plugin_manager::add_input_file): Add error in
9997         incremental build.
9998         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
9999         functions.
10000         * script.cc (read_input_script): Call
10001         Incremental_input::report_script.
10002         * script.h (Script_info): New class.
10003
10004 2009-04-27  Ian Lance Taylor  <iant@google.com>
10005
10006         * x86_64.cc (do_adjust_output_section): Set entsize to
10007         plt_entry_size.
10008
10009 2009-04-23  Elliott Hughes  <enh@google.com>
10010
10011         * output.cc (Output_file::close): After short writes, continue
10012         writing from the correct offset in the buffer being written.
10013
10014 2009-04-23  Chris Demetriou  <cgd@google.com>
10015
10016         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10017         * configure: Regenerate.
10018         * config.in: Regenerate.
10019         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10020         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10021
10022 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10023
10024         * incremental.cc (Incremental_inputs_header_data): Renamed from
10025         Incremental_input_header_data.
10026         (Incremental_inputs_header_data::data_size): New field.
10027         (Incremental_inputs_header_data::put_input_file_count): Renamed
10028         from input_file_count.
10029         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10030         from command_line_offset.
10031         (Incremental_inputs_header_data::put_reserved): Renamed from
10032         put_reserved.
10033         (Incremental_inputs_entry_data): Renamed from
10034         Incremental_input_entry_data.
10035         (Incremental_inputs_entry_data::data_size): New field.
10036         (Incremental_inputs::report_command_line): New method.
10037         (Incremental_inputs::finalize): New method.
10038         (Incremental_inputs::create_incremental_inputs_data): New method.
10039         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10040         * incremental.h: New file.
10041         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10042        (Layout::finalize): Create incremental inputs section in
10043         incremental builds.
10044        (Layout::create_incremental_info_sections): New method.
10045         * layout.h (Layout::incremental_inputs): New method.
10046        (Layout::create_incremental_info_sections): New method.
10047        (Layout::incremental_inputs_): New field.
10048         * main.cc (main): Notify Incremental_input of the command line.
10049
10050 2009-04-01  Ian Lance Taylor  <iant@google.com>
10051             Mikolaj Zalewski  <mikolajz@google.com>
10052
10053         * gold.h (reserve_unordered_map): Define, three versions, one for
10054         each version of Unordered_map.
10055         * layout.cc (Layout::Layout): Remove options parameter.  Add
10056         number_of_input_files parameter.  Don't initialize options_.
10057         Initialize number_of_input_files_ and resized_signatures_.  Move
10058         sections_are_attached_.
10059         (Layout::layout_group): Reserve space for group_signatures_.
10060         (Layout::find_or_add_kept_section): Change name parameter to be a
10061         reference.  Resize signatures_ map when it gets large enough.
10062         (Layout::layout_eh_frame): Use parameters->options() instead of
10063         this->options_.
10064         (Layout::make_output_section): Likewise.
10065         (Layout::attach_allocated_section_to_segment): Likewise.
10066         (Layout::finalize, Layout::create_executable_stack): Likewise.
10067         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10068         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10069         * layout.h (class Layout): Update declarations.  Remove options_
10070         field.  Add number_of_input_files_ and resized_signatures_
10071         fields.  Move sections_are_attached_ field.
10072         * main.cc (main): Pass number of input files to Layout
10073         constructor.  Don't pass options.
10074
10075 2009-03-30  Ian Lance Taylor  <iant@google.com>
10076
10077         * ffsll.c (ffsll): Correct implementation.
10078
10079 2009-03-27  Ian Lance Taylor  <iant@google.com>
10080
10081         * ffsll.c: New file.
10082         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10083         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10084         * ftruncate.c (ftruncate): Declare before definition.
10085         * mremap.c (mremap): Likewise.
10086         * pread.c (pread): Likewise.
10087         * configure, Makefile.in, config.in: Rebuild.
10088
10089         * mremap.c: New file.
10090         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10091         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10092         (mremap): Declare if HAVE_MREMAP is not defined.
10093         * configure, Makefile.in, config.in: Rebuild.
10094
10095 2009-03-27  Cary Coutant  <ccoutant@google.com>
10096
10097         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10098         position independent.
10099         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10100         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10101
10102 2009-03-24  Cary Coutant  <ccoutant@google.com>
10103
10104         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10105         an executable.
10106         (needs_dynamic_reloc): Likewise.
10107
10108 2009-03-24  Ian Lance Taylor  <iant@google.com>
10109
10110         * yyscript.y (file_cmd): Recognize EXTERN.
10111         (extern_name_list, extern_name_list_body): New nonterminals.
10112         * script.cc (script_add_extern): Define.
10113         * script-c.h (script_add_extern): Declare.
10114
10115 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10116
10117         * object.cc (is_elf_object): Define.
10118         * object.h (is_elf_object): Declare.
10119         * archive.cc (Archive::get_elf_object_for_member): Call
10120         is_elf_object.
10121         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10122
10123 2009-03-24  Elliott Hughes  <enh@google.com>
10124
10125         * output.cc (Output_file::map_anonymous): Define.
10126         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10127         try an anonymous one.  Report the size if the mmap fails.
10128         * output.h (class Output_file): Declare map_anonymous.
10129
10130 2009-03-24  Ian Lance Taylor  <iant@google.com>
10131
10132         * target-select.cc (instantiate_target): Don't acquire the lock if
10133         the instantiated_target_ field has already been set.
10134
10135 2009-03-23  Ian Lance Taylor  <iant@google.com>
10136
10137         * gold-threads.h (class Initialize_lock): Define.
10138         * gold-threads.cc (class Initialize_lock_once): Define.
10139         (initialize_lock_control): New static variable.
10140         (initialize_lock_pointer): New static variable.
10141         (initialize_lock_once): New static function.
10142         (Initialize_lock::Initialize_lock): Define.
10143         (Initialize_lock::initialize): Define.
10144         * target-select.h: Include "gold-threads.h".
10145         (class Target_selector): Add lock_ and initialize_lock_ fields.
10146         Don't define instantiate_target, just declare it.
10147         * target-select.cc (Target_selector::Target_selector): Initialize
10148         new fields.
10149         (Target_selector::instantiate_target): Define.
10150         * descriptors.h: Include "gold-threads.h".
10151         (class Descriptors): Add initialize_lock_ field.
10152         * descriptors.cc (Descriptors::Descriptors): Initialize new
10153         field.
10154         (Descriptors::open): Use initialize_lock_ field
10155         * errors.h (class Errors): Add initialize_lock_ field.
10156         * errors.cc (Errors::Errors): Initialize new field.
10157         (Errors::initialize_lock): Use initialize_lock_ field.
10158         * powerpc.cc (class Target_selector_powerpc): Remove
10159         instantiated_target_ field.  In do_recognize call
10160         instantiate_target rather than do_instantiate_target.  In
10161         do_instantiate_target just allocate a new target.
10162         * sparc.cc (class Target_selector_sparc): Likewise.
10163
10164         * freebsd.h: New file.
10165         * i386.cc: Include "freebsd.h".
10166         (Target_i386): Derive from Target_freebsd rather than
10167         Sized_target.
10168         (Target_selector_i386): Derive from Target_selector_freebsd rather
10169         than Target_selector.
10170         * x86_64.cc: Include "freebsd.h".
10171         (Target_x86_64): Derive from Target_freebsd rather than
10172         Sized_target.
10173         (Target_selector_x86_64): Derive from Target_selector_freebsd
10174         rather than Target_selector.
10175         * target.h (class Target): Add adjust_elf_header and
10176         do_adjust_elf_header.
10177         * output.cc (Output_file_header:: do_sized_write): Call target
10178         adjust_elf_header routine.
10179         * configure.tgt: Set targ_osabi.
10180         * configure.ac: Define GOLD_DEFAULT_OSABI.
10181         * parameters.cc (Parameters::default_target): Pass
10182         GOLD_DEFAULT_OSABI to select_target.
10183         * target-select.h (class Target_selector): Make instantiate_target
10184         protected rather than private.
10185         * Makefile.am (HFILES): Add freebsd.h.
10186         * configure, Makefile.in, config.in: Rebuild.
10187
10188         * merge.cc (do_add_input_section): Correct pend value.  Change
10189         message about last entry not being null terminated from error to
10190         warning.
10191
10192 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10193
10194         * incremental.cc: New file.
10195         * Makefile.am (CCFILES): Add incremental.cc.
10196         * Makefile.in: Rebuild.
10197
10198 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10199
10200         * layout.cc (Layout::output_section_name): Preserve names
10201         of '.note.' sections.
10202
10203 2009-03-19  Ian Lance Taylor  <iant@google.com>
10204
10205         * descriptors.cc (Descriptors::open): Check that the options are
10206         valid before using them.
10207
10208 2009-03-18  Ian Lance Taylor  <iant@google.com>
10209
10210         * script-sections.h: Include <list>.
10211         (class Script_sections): Change Sections_elements from std::vector
10212         to std::list.  Typedef public Elements_iterator.  Add
10213         orphan_section_placement_, data_segment_align_start_, and
10214         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10215         field.
10216         * script-sections.cc (class Orphan_section_placement): New class.
10217         (class Sections_element): Add virtual functions is_relro and
10218         orphan_section_init.  Remove virtual function place_orphan_here.
10219         (class Output_section_definition): Add is_relro and
10220         orphan_section_init.  Remove place_orphan_here.
10221         (class Orphan_output_section): Likewise.
10222         (Script_sections::Script_sections): Update for field changes.
10223         (Script_sections::data_segment_align): Set saw_data_segment_align_
10224         and data_segment_align_start_, not data_segment_align_index.
10225         (Script_sections::data_segment_relro_end): Check
10226         saw_data_segment_align_.  Use data_segment_align_start_ rather
10227         than data_segment_align_index_.
10228         (Script_sections::place_orphan): Rewrite to use
10229         Orphan_section_placement.
10230
10231 2009-03-17  Ian Lance Taylor  <iant@google.com>
10232
10233         * archive.cc (Archive::add_symbols): Check for a version attached
10234         to the symbol name in the archive map.
10235         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10236         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10237         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10238         (ver_test_11.a): New target.
10239         * testsuite/Makefile.in: Rebuild.
10240
10241         * configure.ac: Check for chsize and posix_fallocate.  Replace
10242         ftruncate.
10243         * ftruncate.c: New file, from gnulib.
10244         * output.cc (posix_fallocate): Define dummy version if not
10245         HAVE_POSIX_FALLOCATE.
10246         (Output_file::map): Call posix_fallocate rather than lseek and
10247         write.
10248         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10249         * configure, Makefile.in, config.in: Rebuild.
10250
10251 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10252
10253         * layout.h (Layout::create_note): Add section_name parameter.
10254         * layout.cc (Layout::create_note): Likewise.
10255         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10256
10257 2009-03-17  Ian Lance Taylor  <iant@google.com>
10258
10259         * descriptors.cc: Include "options.h".
10260         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10261         (Descriptors::open): Always use O_CLOEXEC when opening a new
10262         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10263         then set FD_CLOEXEC.
10264
10265         * sparc.cc (class Target_sparc): Add has_got_section.
10266         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10267         make sure we have a GOT section.
10268
10269         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10270         (Target_sparc::Scan::local): Likewise.
10271         (Target_sparc::Scan::global): Likewise.
10272         (Target_sparc::Relocate::relocate): Likewise.
10273         (Target_sparc::Relocate::relocate_tls): Likewise.
10274
10275         * symtab.cc (Symbol_table::define_default_version): New function,
10276         broken out of add_from_object.
10277         (Symbol_table::add_from_object): Call define_default_version.
10278         (Symbol_table::define_special_symbol): Add resolve_oldsym
10279         parameter.  Change all callers.  If the version for a symbol comes
10280         from a version script, resolve it with the symbol with the same
10281         name with no version.  Also add the symbol without a version if
10282         appropriate.
10283         (do_define_in_output_data): If resolving with oldsym, don't delete
10284         sym.
10285         (do_define_in_output_segment): Likewise.
10286         (do_define_as_constant): Likewise.
10287         * symtab.h (class Symbol_table): Update declarations.
10288
10289 2009-03-13  Ian Lance Taylor  <iant@google.com>
10290
10291         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10292         (Read_symbols::requeue): New function.
10293         (Read_symbols::do_read_symbols): If make_elf_object fails because
10294         the target type is not configured, and the file was searched for,
10295         issue a warning and retry with the next directory.
10296         (Add_symbols::run): If the file has an incompatible format, and
10297         it was searched for, requeue the Read_symbols task.  On error,
10298         release the object.
10299         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10300         dirindex parameter to constructor.  Change all callers.  Declare
10301         incompatible_warning and requeue.
10302         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10303         input_argument_ and input_group_ fields.  Add them to
10304         constructor.  Change all callers.
10305         (class Read_script): Add dirindex_ field.  Add it to constructor.
10306         Change all callers.
10307         * archive.cc (Archive::setup): Remove input_objects parameter.
10308         Change all callers.
10309         (Archive::get_file_and_offset): Likewise.
10310         (Archive::read_all_symbols): Likewise.
10311         (Archive::read_symbols): Likewise.
10312         (Archive::get_elf_object_for_member): Remove input_objects
10313         parameter.  Add punconfigured parameter.  Change all callers.
10314         (Archive::add_symbols): Change return type to bool.  Check return
10315         value of include_member.
10316         (Archive::include_all_members): Likewise.
10317         (Archive::include_member): Change return type to bool.  Return
10318         false if first included object has incompatible target.  Set
10319         included_member_ field.
10320         (Add_archive_symbols::run): If add_symbols returns false, requeue
10321         Read_symbols task.
10322         * archive.h (class Archive): Add included_member_ field.
10323         Initialize it in constructor.  Add input_file and searched_for
10324         methods.  Update declarations.
10325         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10326         input_argument_ fields.  Add them to constructor.  Change all
10327         callers.
10328         * script.cc: Include "target-select.h".
10329         (class Parser_closure): Add skip_on_incompatible_target_ and
10330         found_incompatible_target_ fields.  Add
10331         skip_on_incompatible_target parameter to constructor.  Change all
10332         callers.  Add methods skip_on_incompatible_target,
10333         clear_skip_on_incompatible_target, found_incompatible_target, and
10334         set_found_incompatible_target.
10335         (read_input_script): Add dirindex parameter.  Change all callers.
10336         If parser finds an incompatible target, requeue Read_symbols
10337         task.
10338         (script_set_symbol): Clear skip_on_incompatible_target in
10339         closure.
10340         (script_add_assertion, script_parse_option): Likewise.
10341         (script_start_sections, script_add_phdr): Likewise.
10342         (script_check_output_format): New function.
10343         * script.h (read_input_script): Update declaration.
10344         * script-c.h (script_check_output_format): Declare.
10345         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10346         (ignore_cmd): Remove OUTPUT_FORMAT.
10347         * fileread.cc (Input_file::Input_file): Add explicit this.
10348         (Input_file::will_search_for): New function.
10349         (Input_file::open): Add pindex parameter.  Change all callers.
10350         * fileread.h (class Input_file): Add input_file_argument method.
10351         Declare will_search_for.  Update declarations.
10352         * object.cc (make_elf_object): Add punconfigured parameter.
10353         Change all callers.
10354         * object.h (class Object): Make input_file public.  Add
10355         searched_for method.
10356         (make_elf_object): Update declaration.
10357         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10358         restart search.
10359         * dirsearch.h (class Dirsearch): Update declaration.
10360         * options.h (class General_options): Add --warn-search-mismatch.
10361         * parameters.cc (Parameters::is_compatible_target): New function.
10362         * parameters.h (class Parameters): Declare is_compatible_target.
10363         * workqueue.cc (Workqueue::add_blocker): New function.
10364         * workqueue.h (class Workqueue): Declare add_blocker.
10365
10366         * fileread.cc (Input_file::open): Remove options parameter.
10367         Change all callers.
10368         (Input_file::open_binary): Likewise.
10369         * script.cc (read_input_script): Likewise.
10370         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10371         options parameter from constructor.  Change all callers.
10372         (class Read_script): Likewise.
10373         * fileread.h (class Input_file): Update declarations.
10374         * script.h (read_input_script): Update declaration.
10375
10376 2009-03-10  Nick Clifton  <nickc@redhat.com>
10377
10378         * po/es.po: New Spanish translation.
10379
10380 2009-03-06  Cary Coutant  <ccoutant@google.com>
10381
10382         * options.cc (parse_short_option): Keep dash_z from registering itself.
10383
10384 2009-03-03  Ian Lance Taylor  <iant@google.com>
10385
10386         PR 9918
10387         * target-reloc.h (relocate_section): Pass output_section to
10388         relocate.
10389         * i386.cc (Target_i386::should_apply_static_reloc): Add
10390         output_section parameter.  Change all callers.
10391         (Target_i386::Relocate::relocate): Add output_section parameter.
10392         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10393         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10394         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10395         * testsuite/two_file_shared.sh: New script.
10396         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10397         (check_DATA): Add two_file_shared.dbg.
10398         (two_file_shared.dbg): New target.
10399         * testsuite/Makefile.in: Rebuild.
10400
10401 2009-03-01  Ian Lance Taylor  <iant@google.com>
10402
10403         * configure.ac: Check for byteswap.h.
10404         * configure: Rebuild.
10405         * config.in: Rebuild.
10406
10407 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10408
10409         * layout.cc (Layout::find_or_add_kept_section): New function.
10410         (Layout::add_comdat): Removed.
10411         * layout.h (struct Kept_section): Move out of class Layout.
10412         Remove trailing underscores from field names.  Add group_sections
10413         field.  Rename group_ field to is_group.  Change all uses.
10414         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10415         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10416         comdat_groups_ field.
10417         (Sized_relobj::include_section_group): Use
10418         find_or_add_kept_section and Kept_section::group_sections.
10419         (Sized_relobj::include_linkonce_section): Likewise.
10420         * object.cc (class Sized_relobj): Don't define Comdat_group or
10421         Comdat_group_table.  Remove find_comdat_group and
10422         add_comdat_group.  Remove comdat_groups_ field.
10423         * plugin.cc (include_comdat_group): Use
10424         Layout::find_or_add_kept_section.
10425
10426 2009-02-28  Ian Lance Taylor  <iant@google.com>
10427
10428         * README: --gc-sections and map files are now supported.  Document
10429         some build requirements.
10430
10431         PR 6992
10432         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10433         relocatable link set the value of the section symbol to zero.
10434         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10435         relocatable link don't include the section address in the local
10436         symbol value.
10437
10438 2009-02-27  Ian Lance Taylor  <iant@google.com>
10439
10440         PR 6811
10441         * options.h (class Search_directory): Add is_system_directory.
10442         (class General_options): Declare is_in_system_directory.
10443         * options.cc (get_relative_sysroot): Make static.
10444         (get_default_sysroot): Make static.
10445         (General_optoins::is_in_system_directory): New function.
10446         * fileread.cc (Input_file::is_in_system_directory): New function.
10447         * fileread.h (class Input_file): Declare is_in_system_directory.
10448         * object.h (class Object): Add is_in_system_directory.
10449         (class Input_objects): Remove system_library_directory_ field.
10450         * object.cc (Input_objects::add_object): Don't set
10451         system_library_directory_.
10452         (input_objects::found_in_system_library_directory): Remove.
10453         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10454         parameter.  Change all callers.
10455         (Symbol_table::sized_write_globals): Likewise.
10456         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10457         Call Object::is_in_system_directory.
10458         * symtab.h (class Symbol_table): Update declarations.
10459
10460         PR 5990
10461         * descriptors.h (Open_descriptor): Add is_on_stack field.
10462         * descriptors.cc (Descriptors::open): If the descriptor is on the
10463         top of the stack, remove it.  Initialize is_on_stack field.
10464         (Descriptors::release): Only add pod to stack if it is not on the
10465         stack already.
10466         (Descriptors::close_some_descriptor): Clear stack_next and
10467         is_on_stack fields.
10468
10469         PR 7091
10470         * output.cc (Output_section::find_starting_output_address): Rename
10471         from starting_output_address; add PADDR parameter; change return
10472         type.
10473         * output.h (class Output_section): Declare
10474         find_starting_output_address instead of starting_output_address.
10475         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10476         section symbol for which we can't find a merge section.
10477
10478         PR 9836
10479         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10480         hidden or internal, force the symbol to be local.
10481         * resolve.cc (Symbol::override_visibility): Define.
10482         (Symbol::override_base): Use override_visibility.
10483         (Symbol_table::resolve): Likewise.
10484         (Symbol::override_base_with_special): Likewise.
10485         (Symbol_table::override_with_special): If the visibility is hidden
10486         or internal, force the symbol to be local.
10487         * symtab.h (class Symbol): Add set_visibility and
10488         override_visibility.
10489         * testsuite/ver_test_1.sh: New file.
10490         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10491         (check_DATA): Add ver_test_1.syms.
10492         (ver_test_1.syms): New target.
10493         * testsuite/Makefile.in: Rebuild.
10494
10495 2009-02-25  Cary Coutant  <ccoutant@google.com>
10496
10497         * layout.cc (Layout::choose_output_section): Don't rename sections
10498         when using a linker script that has a SECTIONS clause.
10499         * Makefile.in: Regenerate.
10500
10501         * testsuite/Makefile.am (script_test_5.sh): New test case.
10502         * testsuite/Makefile.in: Regenerate.
10503         * testsuite/script_test_5.cc: New file.
10504         * testsuite/script_test_5.sh: New file.
10505         * testsuite/script_test_5.t: New file.
10506
10507 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10508
10509         * archive.cc (Archive::include_member): Update calls to add_symbols.
10510         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10511         the Layout argument.
10512         * dynobj.h (do_add_symbols): Add the Layout argument.
10513         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10514         Layout argument.
10515         * object.h (Object::add_symbols): Add the Layout argument.
10516         (Object::do_add_symbols): Add the Layout argument.
10517         (Sized_relobj::do_add_symbols): Add the Layout argument.
10518         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10519         Unify the two versions.
10520         (Add_plugin_symbols): Remove.
10521         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10522         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10523         (Add_plugin_symbols): Remove.
10524         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10525         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10526         (Add_symbols::run): Make it work with Pulginobj.
10527
10528 2009-02-06  Ian Lance Taylor  <iant@google.com>
10529
10530         * object.cc (Sized_relobj::do_layout): Make info message start
10531         with lower case letter.
10532
10533 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10534
10535         * binary.cc: Fix file comment.
10536
10537         * options.h (enum Incremental_disposition): Define.
10538         (class General_options): Add new options: --incremental,
10539         --incremental_changed, --incremental_unchanged,
10540         --incremental_unknown.  Add incremental_disposition_ and
10541         implicit_incremental_ fields.
10542         (General_options::incremental_disposition): New function.
10543         (class Position_dependent_options): Add incremental_disposition
10544         option.
10545         (Position_dependent_options::copy_from_options): Set incremental
10546         dispositions.
10547         * options.cc (General_options::parse_incremental_changed): New
10548         function.
10549         (General_options::parse_incremental_unchanged): New function.
10550         (General_options::parse_incremental_unknown): New function.
10551         (General_options::General_options): Initialize new fields
10552         incremental_disposition_ and implicit_incremental_.
10553         (General_options::finalize): Check for uasge of --incremental-*
10554         without --incremental.
10555
10556 2009-02-06  Chris Demetriou  <cgd@google.com>
10557
10558         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10559         pointer and to report location as the file name associated with
10560         the symbol.
10561         (gold_undefined_symbol_at_location): New function to replace the
10562         old gold_undefined_symbol functionality.
10563         * target-reloc.h (relocate_section): Update to use
10564         gold_undefined_symbol_at_location.
10565         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10566         Call gold_undefined_symbol function rather than gold_error.
10567         * errors.h (Errors::undefined_symbol): Take location as a
10568         string, rather than calculating it from a relocation.
10569         * errors.cc (Errors::fatal): Print "fatal error:" before the
10570         formatted message.
10571         (Errors::error, Errors::error_at_location): Print "error: "
10572         before the formatted message.
10573         (Errors::undefined_symbol): Take location as a string, rather
10574         than calculating it from a relocation.
10575         (gold_undefined_symbol_at_location): New function akin to
10576         old gold_undefined_symbol, calculates location from relocation.
10577         (gold_undefined_symbol): Change to take only a Symbol pointer
10578         and to report location as the file name associated with the symbol.
10579         * testsuite/debug_msg.sh: Update for changed error messages.
10580         * testsuite/undef_symbol.sh: Likewise.
10581
10582 2009-02-04  Duncan Sands  <baldrick@free.fr>
10583
10584         PR 9812
10585         * reduced_debug_output.h
10586         (Output_reduced_debug_abbrev_section::failed): Use format for
10587         gold_warning.
10588         (Output_reduced_debug_info_section::faild): Likewise.
10589
10590 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10591
10592         * script.cc (Lazy_demangler): New class.
10593         (Version_script_info::get_symbol_version_helper): Demangle a
10594         symbol only once.
10595
10596 2009-01-29  Cary Coutant  <ccoutant@google.com>
10597
10598         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10599         to __tls_get_addr.
10600         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10601
10602 2009-01-28  Ian Lance Taylor  <iant@google.com>
10603
10604         * version.cc (version_string): Bump to 1.9.
10605
10606         * gold.h: Include <cstring> and <stdint.h>.
10607         * version.cc: Include <cstdio>.
10608         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10609         warning.
10610         * reduced_debug_output.cc (insert_into_vector): Rename from
10611         Insert_into_vector; change all callers.  Use Swap_unaligned to
10612         avoid aliasing issue; remove union since it is unnecessary.
10613
10614 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10615
10616         * Makefile.am (CCFILES): Add gc.cc.
10617         (HFILES): Add gc.h.
10618         * Makefile.in: Regenerate.
10619         * gold.cc (Gc_runner): New class.
10620         (queue_initial_tasks): Call garbage collection related tasks
10621         when corresponding options are invoked.
10622         (queue_middle_gc_tasks): New function.
10623         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10624         processed early before laying out sections during garbage collection.
10625         * gold.h (queue_middle_gc_tasks): New function.
10626         (is_prefix_of): Move from "layout.cc".
10627         * i386.cc (Target_i386::gc_process_relocs): New function.
10628         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10629         * main.cc (main): Create object of class "Garbage_collection".
10630         * object.cc (Relobj::copy_symbols_data): New function.
10631         (Relobj::is_section_name_included): New function.
10632         (Sized_relobj::do_layout): Allow this function to be called twice
10633         during garbage collection and defer layout of section during the
10634         first call.
10635         * object.h (Relobj::get_symbols_data): New function.
10636         (Relobj::is_section_name_included): New function.
10637         (Relobj::copy_symbols_data): New function.
10638         (Relobj::set_symbols_data): New function.
10639         (Relobj::get_relocs_data): New function.
10640         (Relobj::set_relocs_data): New function.
10641         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10642         (Relobj::gc_process_relocs): New function.
10643         (Relobj::do_gc_process_relocs): New pure virtual function.
10644         (Relobj::sd_): New data member.
10645         (Sized_relobj::is_output_section_offset_invalid): New function.
10646         (Sized_relobj::do_gc_process_relocs): New function.
10647         * options.h (General_options::gc_sections): Modify to not be a no-op.
10648         (General_options::print_gc_sections): New option.
10649         * plugin.cc (Plugin_finish::run): Remove function call to
10650         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10651         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10652         * reloc.cc (Read_relocs::run): Add task to process relocs and
10653         determine unreferenced sections when doing garbage collection.
10654         (Gc_process_relocs): New class.
10655         (Sized_relobj::do_gc_process_relocs): New function.
10656         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10657         sections that are garbage collected.
10658         * reloc.h (Gc_process_relocs): New class.
10659         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10660         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10661         symbols whose corresponding sections are garbage collected.
10662         (Symbol_table::Symbol_table): Add new parameter for the garbage
10663         collection object.
10664         (Symbol_table::gc_mark_undef_symbols): New function.
10665         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10666         (Symbol_table::gc_mark_dyn_syms): New function.
10667         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10668         as garbage.
10669         (Symbol_table::add_from_object): Likewise.
10670         (Symbol_table::add_from_relobj): When building shared objects, do not
10671         treat externally visible symbols as garbage.
10672         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10673         table information for static and relocatable links.
10674         * symtab.h (Symbol_table::set_gc): New function.
10675         (Symbol_table::gc): New function.
10676         (Symbol_table::gc_mark_undef_symbols): New function.
10677         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10678         (Symbol_table::gc_mark_dyn_syms): New function.
10679         (Symbol_table::gc_): New data member.
10680         * target.h (Sized_target::gc_process_relocs): New pure virtual
10681         function.
10682         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10683         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10684
10685 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10686
10687         * options.h (General_options::gc_sections): Define as a no-op for now.
10688         (General_options::no_keep_memory): Ditto.
10689         (General_options::Bshareable): Define.
10690         * options.cc (General_options::finalize): Honor -Bshareable.
10691
10692 2009-01-20  Andreas Schwab  <schwab@suse.de>
10693
10694         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10695         read the value in the contents, since we don't use it.  Use the
10696         template endianness when writing.
10697         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10698
10699 2009-01-19  Andreas Schwab  <schwab@suse.de>
10700
10701         * configure.tgt (powerpc64-*): Fix targ_obj.
10702
10703 2009-01-15  Ian Lance Taylor  <iant@google.com>
10704
10705         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10706         local symbols when stripping all symbols.
10707
10708 2009-01-14  Cary Coutant  <ccoutant@google.com>
10709
10710         * output.cc (Output_reloc): Add explicit instantiations.
10711
10712 2009-01-14  Cary Coutant  <ccoutant@google.com>
10713
10714         * archive.cc (Archive::get_elf_object_for_member): Remove call
10715         to File_read::claim_for_plugin.
10716         * descriptors.cc (Descriptors::open): Remove reference to
10717         is_claimed.
10718         (Descriptors::claim_for_plugin): Remove.
10719         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10720         (Descriptors::is_claimed): Remove.
10721         (claim_descriptor_for_plugin): Remove.
10722         * fileread.cc (File_read::claim_for_plugin): Remove.
10723         * fileread.h (File_read::claim_for_plugin): Remove.
10724         (File_read::descriptor): Reopen descriptor if necessary.
10725         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10726         (Plugin_manager::all_symbols_read): Add task parameter. Change
10727         all callers.
10728         (Plugin_manager::get_input_file): New function.
10729         (Plugin_manager::release_input_file): New function.
10730         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10731         corresponding data member.
10732         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10733         and pass to base constructor. Change all callers.
10734         (get_input_file, release_input_file): New functions.
10735         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10736         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10737         (Plugin_manager::all_symbols_read): Add task parameter.
10738         (Plugin_manager::get_input_file): New function.
10739         (Plugin_manager::release_input_file): New function.
10740         (Plugin_manager::task_): New data member.
10741         (Pluginobj::Pluginobj): Add filesize parameter.
10742         (Pluginobj::filename): New function.
10743         (Pluginobj::descriptor): New function.
10744         (Pluginobj::filesize): New function.
10745         (Pluginobj::filesize_): New data member.
10746         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10747         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10748         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10749
10750         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10751         with archive libraries.
10752         * testsuite/Makefile.in: Regenerate.
10753         * testsuite/plugin_test.c (struct sym_info): New type.
10754         (get_input_file, release_input_file): New static variables.
10755         (onload): Capture new transfer vector entries.
10756         (claim_file_hook): Stop reading at end of file according to filesize.
10757         Factor out parsing of readelf output into separate function.
10758         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10759         APIs and get the source file name from the symbol table.  Convert
10760         source file name to corresponding object file name.  Print info
10761         message when adding new input files.
10762         (parse_readelf_line): New function.
10763         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10764         * testsuite/plugin_test_2.sh: Likewise.
10765         * testsuite/plugin_test_3.sh: Likewise.
10766         * testsuite/plugin_test_4.sh: New test case.
10767
10768 2009-01-07  Ian Lance Taylor  <iant@google.com>
10769
10770         * version.cc (version_string): Bump to 1.8.
10771
10772 2008-12-23  Cary Coutant  <ccoutant@google.com>
10773
10774         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10775         * plugin.cc (Plugin_manager::finish): Rename as
10776         layout_deferred_objects.  Move cleanup to separate function.
10777         (Plugin_manager::cleanup): New function.
10778         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10779         separately.
10780         * plugin.h (Plugin_manager::finish): Rename as
10781         layout_deferred_objects.
10782         (Plugin_manager::cleanup): New function.
10783         (Plugin_manager::cleanup_done): New field.
10784
10785 2008-12-23  Cary Coutant  <ccoutant@google.com>
10786
10787         * plugin.cc (is_visible_from_outside): New function.
10788         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10789         so we don't return "IR only" status for exported symbols or -r links.
10790
10791         * testsuite/Makefile.am (plugin_test_3): New test case.
10792         * testsuite/Makefile.in: Regenerate.
10793         * testsuite/plugin_test_3.sh: New file.
10794
10795 2008-12-22  Cary Coutant  <ccoutant@google.com>
10796
10797         * object.cc (Sized_relobj::layout_section): New function.
10798         (Sized_relobj::do_layout): Defer layout of input sections until after
10799         plugin has provided replacement files.
10800         (Sized_relobj::do_layout_deferred_sections): New function.
10801         * object.h (Relobj::set_section_offset): Remove virtual keyword.
10802         (Relobj::layout_deferred_sections): New function.
10803         (Relobj::do_layout_deferred_sections): New function.
10804         (Sized_relobj::do_layout_deferred_sections): New function.
10805         (Sized_relobj::layout_section): New function.
10806         (Sized_relobj::Deferred_layout): New structure.
10807         (Sized_relobj::deferred_layout_): New field.
10808         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
10809         Change all callers.  Layout deferred sections.
10810         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
10811         references.
10812         (Plugin_hook::run): Move code from do_plugin_hook inline.
10813         (Plugin_hook::do_plugin_hook): Remove.
10814         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
10815         (Plugin_manager::finish): Renamed, was cleanup.
10816         (Plugin_manager::should_defer_layout): New function.
10817         (Plugin_manager::add_deferred_layout_object): New function.
10818         (Plugin_manager::Deferred_layout_list): New type.
10819         (Plugin_manager::deferred_layout_objects_): New field.
10820         (Plugin_hook::do_plugin_hook): Remove.
10821
10822 2008-12-17  Ian Lance Taylor  <iant@google.com>
10823
10824         * options.h (class General_options): Add --no case for
10825         --export-dynamic.
10826
10827 2008-12-16  Cary Coutant  <ccoutant@google.com>
10828
10829         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
10830         vector.
10831         (Plugin_manager::claim_file): Create plugin object even if
10832         plugin did not call the add_symbols callback.
10833         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
10834         asking for more symbols than were added.
10835         * testsuite/Makefile.am (plugin_test_1): Add test case with
10836         no global symbols.
10837         (empty.syms): New target.
10838         * testsuite/Makefile.in: Regenerate.
10839         * testsuite/plugin_test.c (claim_file_hook): Add new debug
10840         message. Don't call add_symbols if no globals.
10841         (all_symbols_read_hook): Don't provide replacement for empty
10842         claimed file.
10843
10844 2008-12-12  Ian Lance Taylor  <iant@google.com>
10845
10846         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
10847         r_type == 0 for a local symbol with r_sym == 0.
10848         (scan_relocatable_relocs): Pass r_sym to
10849         local_non_section_strategy.
10850         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
10851         r_sym parameter.
10852
10853         * configure.ac: Update test for TLS descriptors: they are
10854         supported as of glibc 2.9.
10855         * configure: Rebuild.
10856
10857 2008-12-11  Ian Lance Taylor  <iant@google.com>
10858
10859         PR 7091
10860         * target-reloc.h (Default_scan_relocatable_relocs): For each
10861         function, map r_type == 0 to RELOC_DISCARD.
10862
10863 2008-12-10  Cary Coutant  <ccoutant@google.com>
10864
10865         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
10866         object to override a kept COMDAT group from a plugin object.
10867
10868 2008-12-09  Ian Lance Taylor  <iant@google.com>
10869
10870         PR 7088
10871         * yyscript.y (file_cmd): Handle INPUT.
10872
10873         * testsuite/initpri1.c: Change all declarations to be full
10874         prototypes by adding void, to avoid compiler warnings.
10875
10876 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
10877
10878         * options.cc (General_options::parse_plugin_opt): New.
10879         (General_options::add_plugin): The argument now is just the filename.
10880         (General_options::add_plugin_option): New.
10881         * options.h (plugin_opt): New.
10882         (add_plugin): Change argument name.
10883         (add_plugin_option): New.
10884         * plugin.cc (Plugin::load): Don't parse the plugin option.
10885         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
10886         (Plugin::add_option): New.
10887         (Plugin::args_): Change type.
10888         (Plugin::filename_): New.
10889         (Plugin_manager::add_plugin_option): New.
10890         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
10891         * testsuite/Makefile.in: Regenerate.
10892
10893 2008-12-05  Cary Coutant  <ccoutant@google.com>
10894
10895         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
10896         Handle --strip-lto-sections option.
10897         * options.h (strip_lto_sections): New option.
10898
10899 2008-12-01  Cary Coutant  <ccoutant@google.com>
10900
10901         * plugin.cc (ld_plugin_message): Change format parameter to const.
10902         Fix mismatch between new[] and delete.
10903
10904 2008-11-14  Cary Coutant  <ccoutant@google.com>
10905
10906         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
10907         instead of -1U.
10908
10909 2008-11-05  Craig Silverstein  <csilvers@google.com>
10910
10911         * options.cc (General_options::parse_dynamic_list): New function.
10912         * options.h (General_options): New flags dynamic_list,
10913         dynamic_list_data, dynamic_list_cpp_new, and
10914         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
10915         (General_options::in_dynamic_list): New function.
10916         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
10917         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
10918         (Lex::can_continue_name): Likewise.
10919         (yylex): Likewise.
10920         (read_script_file): New parameter script_options.
10921         (read_dynamic_list): New function.
10922         (Script_options::define_dynamic_list): New function.
10923         (dynamic_list_keyword_parsecodes): New variable.
10924         (dynamic_list_keywords): New variable.
10925         * script.h (Script_options::define_dynamic_list): New function
10926         prototype.
10927         (read_dynamic_list): New function prototype.
10928         * symtab.cc (strprefix): New macro.
10929         (Symbol::should_add_dynsym_entry): Support dynamic_list,
10930         dynamic_list_data, dynamic_list_cpp_new, and
10931         dynamic_list_cpp_typeinfo.
10932         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
10933         (dynamic_list_expr): New rule.
10934         (dynamic_list_nodes): Likewise.
10935         (dynamic_list_node): Likewise.
10936         * testsuite/Makefile.am (dynamic_list): New test.
10937         * testsuite/Makefile.in: Regenerated.
10938         * testsuite/dynamic_list.t: New file.
10939         * testsuite/dynamic_list.sh: New file.
10940
10941 2008-11-05  Craig Silverstein  <csilvers@google.com>
10942
10943         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
10944         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
10945         (t11_last): Likewise.
10946         * testsuite/ver_test_6.c (main): Likewise.
10947
10948 2008-10-07  Cary Coutant  <ccoutant@google.com>
10949
10950         * options.c (General_options::finalize): Add check for -static and
10951         -shared.
10952         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
10953         is not empty.
10954
10955 2008-10-02  Cary Coutant  <ccoutant@google.com>
10956
10957         * plugin.cc (make_sized_plugin_object): Fix conditional
10958         compilation to work when not all targets are enabled.
10959
10960 2008-09-29  Cary Coutant  <ccoutant@google.com>
10961
10962         * archive.cc (Archive::get_file_and_offset): Use filename instead
10963         of name to get library path.
10964         (Archive::include_member): Unlock external member of a thin archive.
10965
10966         * testsuite/Makefile.am (TEST_AR): New variable.
10967         (thin_archive_test_1): New test.
10968         (thin_archive_test_2): New test.
10969         * testsuite/Makefile.in: Regenerate.
10970         * testsuite/thin_archive_main.cc: New file.
10971         * testsuite/thin_archive_test_1.cc: New file.
10972         * testsuite/thin_archive_test_2.cc: New file.
10973         * testsuite/thin_archive_test_3.cc: New file.
10974         * testsuite/thin_archive_test_4.cc: New file.
10975
10976 2008-09-29  Cary Coutant  <ccoutant@google.com>
10977
10978         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
10979         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
10980         instead of -1U.
10981         (Sized_relobj::do_finalize_local_symbols): Likewise.
10982         (Sized_relobj::map_to_kept_section): Likewise.
10983         * object.h (Sized_relobj::invalid_address): New constant.
10984         (Sized_relobj::do_output_section_offset): Check for invalid_address
10985         and return -1ULL.
10986         * output.cc (Output_reloc::local_section_offset): Use constant
10987         invalid_address instead of -1U.
10988         (Output_reloc::get_address): Likewise.
10989         (Output_section::output_address): Change -1U to -1ULL.
10990         * output.h (Output_reloc::invalid_address): New constant.
10991         * reloc.cc (Sized_relobj::write_sections): Use constant
10992         invalid_address instead of -1U.
10993         (Sized_relobj::relocate_sections): Likewise.
10994         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
10995         values for merge sections.
10996         * target-reloc.h (relocate_for_relocatable): Use constant
10997         invalid_address instead of -1U.
10998
10999 2008-09-19  Cary Coutant  <ccoutant@google.com>
11000
11001         Add plugin functionality for link-time optimization (LTO).
11002         * configure.ac (plugins): Add --enable-plugins option.
11003         * configure: Regenerate.
11004         * config.in: Regenerate.
11005         * Makefile.am (LIBDL): New variable.
11006         (CCFILES): Add plugin.cc.
11007         (HFILES): Add plugin.h.
11008         (ldadd_var): Add LIBDL.
11009         * Makefile.in: Regenerate.
11010
11011         * archive.cc: Include "plugin.h".
11012         (Archive::setup): Don't preread archive symbols when using a plugin.
11013         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11014         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11015         files.
11016         (Archive::include_member): Add symbols from plugin objects.
11017         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11018         * descriptors.cc (Descriptors::open): Check for file descriptors
11019         abandoned by plugins.
11020         (Descriptors::claim_for_plugin): New function.
11021         * descriptors.h (Descriptors::claim_for_plugin): New function.
11022         (Open_descriptor::is_claimed): New field.
11023         (claim_descriptor_for_plugin): New function.
11024         * fileread.cc (File_read::claim_for_plugin): New function.
11025         * fileread.h (File_read::claim_for_plugin): New function.
11026         (File_read::descriptor): New function.
11027         * gold.cc: Include "plugin.h".
11028         (queue_initial_tasks): Add task to call plugin hooks for generating
11029         new object files.
11030         * main.cc: Include "plugin.h".
11031         (main): Load plugin libraries.
11032         * object.h (Pluginobj): Declare.
11033         (Object::pluginobj): New function.
11034         (Object::do_pluginobj): New function.
11035         (Object::set_target): New function.
11036         * options.cc: Include "plugin.h".
11037         (General_options::parse_plugin): New function.
11038         (General_options::General_options): Initialize plugins_ field.
11039         (General_options::add_plugin): New function.
11040         * options.h (Plugin_manager): Declare.
11041         (General_options): Add --plugin option.
11042         (General_options::has_plugins): New function.
11043         (General_options::plugins): New function.
11044         (General_options::add_plugin): New function.
11045         (General_options::plugins_): New field.
11046         * plugin.cc: New file.
11047         * plugin.h: New file.
11048         * readsyms.cc: Include "plugin.h".
11049         (Read_symbols::do_read_symbols): Check for archive before checking
11050         for ELF file.  Call plugin hooks to claim files.
11051         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11052         from a real object file; force override when processing replacement
11053         files.
11054         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11055         (Symbol::init_base_object): Likewise.
11056         (Symbol::init_base_output_data): Likewise.
11057         (Symbol::init_base_output_segment): Likewise.
11058         (Symbol::init_base_constant): Likewise.
11059         (Symbol::init_base_undefined): Likewise.
11060         (Symbol::output_section): Assert that object is not a plugin.
11061         (Symbol_table::add_from_pluginobj): New function.
11062         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11063         undefined.
11064         (Symbol_table::sized_write_globals): Likewise.
11065         (Symbol_table::add_from_pluginobj): Instantiate template.
11066         * symtab.h (Sized_pluginobj): Declare.
11067         (Symbol::in_real_elf): New function.
11068         (Symbol::set_in_real_elf): New function.
11069         (Symbol::in_real_elf_): New field.
11070         (Symbol_table::add_from_pluginobj): New function.
11071
11072         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11073         (LIBDL): New variable.
11074         (LDADD): Add LIBDL.
11075         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11076         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11077         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11078         (MOSTLYCLEANFILES): Likewise.
11079         * testsuite/Makefile.in: Regenerate.
11080         * testsuite/plugin_test.c: New file.
11081         * testsuite/plugin_test_1.sh: New file.
11082         * testsuite/plugin_test_2.sh: New file.
11083
11084 2008-09-16  Ian Lance Taylor  <iant@google.com>
11085
11086         * target-reloc.h (relocate_section): Check whether a symbol is
11087         defined by the ABI before reporting an undefined symbol error.
11088         * target.h (Target::is_defined_by_abi): Make parameter const.
11089         (Target::do_is_defined_by_abi): Likewise.
11090         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11091         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11092         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11093         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11094         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11095         * testsuite/Makefile.in: Rebuild.
11096
11097         * fileread.cc (make_view): Add casts to avoid warning.
11098
11099 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11100
11101         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11102         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11103
11104 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11105
11106         * options.h (General_options::output_is_executable): New.
11107         (General_options::output_is_pie): New.
11108         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11109         for shared libraries.
11110         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11111
11112 2008-09-11  Chris Demetriou  <cgd@google.com>
11113
11114         * options.h (origin): New -z option.
11115         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11116         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11117         in DT_FLAGS_1.
11118
11119 2008-09-05  Cary Coutant  <ccoutant@google.com>
11120
11121         * fileread.cc (File_read::make_view): Add check for attempt to map
11122         beyond end of file.
11123
11124 2008-09-05  Cary Coutant  <ccoutant@google.com>
11125
11126         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11127         explicit instantiations.
11128
11129 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11130
11131         PR gold/6858
11132         * options.cc (General_options::finalize): Allow undefined symbols
11133         in shlibs if linking -shared.
11134
11135         PR gold/6859
11136         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11137         symbols as not needing a dynsym entry.
11138
11139 2008-08-20  Craig Silverstein  <csilvers@google.com>
11140
11141         * fileread.cc (File_read::open): Do not lock the file unless it
11142         was successfully opened.
11143
11144 2008-08-14  Cary Coutant  <ccoutant@google.com>
11145
11146         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11147         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11148         * testsuite/tls_test.cc (struct int128): 128-bit struct
11149         for testing TLS relocs with non-zero addend.
11150         (v12): New TLS variable.
11151         (t12): New test.
11152         (t_last): Add check for v12.
11153         * testsuite/tls_test.h (t12): New function.
11154         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11155
11156 2008-08-13  Ian Lance Taylor  <iant@google.com>
11157
11158         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11159         set tls_segment_ or relro_segment_.
11160         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11161         when appropriate.
11162         * output.h (Output_section::clear_is_relro): New function.
11163         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11164         sections specially even when output_data_ is empty.
11165         (Output_segment::maximum_alignment): When first section is relro,
11166         only force alignment for PT_LOAD segments.
11167         * script.cc (script_data_segment_align): New function.
11168         (script_data_segment_relro_end): New function.
11169         * script-c.h (script_data_segment_align): Declare.
11170         (script_data_segment_relro_end): Declare.
11171         * script-sections.h (class Script_sections): Declare
11172         data_segment_align and data_segment_relro_end.  Add fields
11173         segment_align_index_ and saw_relro_end_.
11174         * script-sections.cc (class Sections_element): Add set_is_relro
11175         virtual function.  Add new bool* parameter to place_orphan_here.
11176         Add get_output_section virtual function.
11177         (class Output_section_definition): Add set_is_relro.  Add new
11178         bool* parameter to place_orphan_here.  Add get_output_section.
11179         Add is_relro_ field.
11180         (Output_section_definition::Output_section_definition): Initialize
11181         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11182         and is_relro_ fields.
11183         (Output_section_definition::place_orphan_here): Add is_relro
11184         parameter.
11185         (Output_section_definition::set_section_addresses): Set relro for
11186         output section.
11187         (Output_section_definition::alternate_constraint): Likewise.
11188         (class Orphan_output_section): Add new bool* parameter to
11189         place_orphan_here.  Add get_output_section.
11190         (Orphan_output_section::place_orphan_here): Add is_relro
11191         parameter.
11192         (Script_sections::Script_sections): Initialize
11193         data_segment_align_index_ and saw_relro_end_.
11194         (Script_sections::data_segment_align): New function.
11195         (Script_sections::data_segment_relro_end): New function.
11196         (Script_sections::place_orphan): Set or clear is_relro.
11197         (Script_sections::set_section_addresses): Force alignment of first
11198         TLS section.
11199         * yyscript.y (exp): Call script_data_segment_align and
11200         script_data_segment_relro_end.
11201         * testsuite/relro_script_test.t: New file.
11202         * testsuite/relro_test.cc (using_script): Declare.
11203         (t1, t2): Test using_script.
11204         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11205         (relro_script_test_SOURCES): Define.
11206         (relro_script_test_DEPENDENCIES): Define.
11207         (relro_script_test_LDFLAGS): Define.
11208         (relro_script_test_LDADD): Define.
11209         (relro_script_test.so): New target.
11210         * testsuite/Makefile.in: Rebuild.
11211
11212 2008-08-06  Cary Coutant <ccoutant@google.com>
11213
11214         * archive.cc (Archive::total_archives, Archive::total_members)
11215         (Archive::total_members_loaded): New variables.
11216         (Archive::setup): Add parameter.  Add option to preread
11217         archive symbols.
11218         (Archive::read_armap): Add counter.
11219         (Archive::get_file_and_offset): New function.
11220         (Archive::get_elf_object_for_member): New function.
11221         (Archive::read_all_symbols): New function.
11222         (Archive::read_symbols): New function.
11223         (Archive::add_symbols): Add counters.
11224         (Archive::include_all_members): Use armap to find members if it's
11225         already built.
11226         (Archive::include_member): Skip reading symbols if already read.
11227         Factored code into Archive::get_file_and_offset and
11228         Archive::get_elf_object_for_member.  Changed call to
11229         Mapfile::report_include_archive_member.
11230         (Archive::print_stats): New function.
11231         * archive.h: Declare Object and Read_symbols_data classes.
11232         (Archive::Archive): Add initializers for new members.
11233         (Archive::setup): Add parameter.
11234         (Archive::print_stats): New function.
11235         (Archive::total_archives, Archive::total_members)
11236         (Archive::total_members_loaded): New variables.
11237         (Archive::get_file_and_offset): New function.
11238         (Archive::get_elf_object_for_member): New function.
11239         (Archive::read_all_symbols): New function.
11240         (Archive::read_symbols): New function.
11241         (Archive::Archive_member): New class.
11242         (Archive::members_): New member.
11243         (Archive::num_members_): New member.
11244         * main.cc: Include archive.h.
11245         (main): Call Archive::print_stats.
11246         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11247         archive parameter; member_name is now the fully-decorated name.
11248         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11249         * options.h: (General_options): Add --preread-archive-symbols option.
11250         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11251         Archive::setup.
11252
11253 2008-08-04  Ian Lance Taylor  <iant@google.com>
11254
11255         * symtab.h (Symbol::use_plt_offset): New function.
11256         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11257         * powerpc.cc (Relocate::relocate): Likewise.
11258         * sparc.cc (Relocate::relocate): Likewise.
11259         * x86_64.cc (Relocate::relocate): Likewise.
11260         * testsuite/weak_plt.sh: New test.
11261         * testsuite/weak_plt_main.cc: New test.
11262         * testsuite/weak_plt_shared.cc: New test.
11263         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11264         (check_PROGRAMS): Add weak_plt.
11265         (check_DATA): Add weak_plt_shared.so.
11266         (weak_plt_main_pic.o, weak_plt): New targets.
11267         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11268         * testsuite/Makefile.in: Rebuild.
11269
11270         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11271         gcctestdir/ld.
11272         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11273         * testsuite/Makefile.in: Rebuild.
11274
11275 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11276
11277         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11278         * Makefile.in: Regenerate.
11279         * po/POTFILES.in: Regenerate.
11280
11281 2008-07-29  Ian Lance Taylor  <iant@google.com>
11282
11283         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11284         symbols before other symbols.
11285         * testsuite/script_test_2.cc (test_addr): Declare.
11286         (test_addr_alias): Declare.
11287         (main): Check that test_addr and test_addr_alias have the right
11288         values.
11289         * testsuite/script_test_2.t: Define test_addr_alias and
11290         test_addr.
11291
11292 2008-07-24  Ian Lance Taylor  <iant@google.com>
11293
11294         PR 5990
11295         * descriptors.cc: New file.
11296         * descriptors.h: New file.
11297         * gold-threads.h (class Hold_optional_lock): New class.
11298         * fileread.cc: Include "descriptors.h".
11299         (File_read::~File_read): Release descriptor rather than closing
11300         it.
11301         (File_read::open) [file]: Call open_descriptor rather than open.
11302         Set is_descriptor_opened_.
11303         (File_read::open) [memory]: Assert that descriptor is not open.
11304         (File_read::reopen_descriptor): New function.
11305         (File_read::release): Release descriptor.
11306         (File_read::do_read): Make non-const.  Reopen descriptor.
11307         (File_read::read): Make non-const.
11308         (File_read::make_view): Reopen descriptor.
11309         (File_read::do_readv): Likewise.
11310         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11311         Update declarations.
11312         * layout.cc: Include "descriptors.h".
11313         (Layout::create_build_id): Use open_descriptor rather than open.
11314         * output.cc: Include "descriptors.h".
11315         (Output_file::open): Use open_descriptor rather than open.
11316         * archive.cc (Archive::const_iterator): Change Archive to be
11317         non-const.
11318         (Archive::begin, Archive::end): Make non-const.
11319         (Archive::count_members): Likewise.
11320         * archive.h (class Archive): Update declarations.
11321         * object.h (Object::read): Make non-const.
11322         * Makefile.am (CCFILES): Add descriptors.cc.
11323         (HFILES): Add descriptors.h.
11324         * Makefile.in: Rebuild.
11325
11326         PR 6716
11327         * gold.h: Always include <clocale>.  Add Solaris workarounds
11328         following code in binutils/sysdep.h.
11329
11330         PR 6048
11331         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11332         this->eh_frame_hdr_ is NULL before using it.
11333
11334         * dynobj.cc (Versions::Versions): Update comment.
11335
11336         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11337         the base version name.
11338
11339         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11340         array size plus one.
11341         (Stringpool_template::set_string_offsets): Subtract one from key
11342         before using it as an array index.
11343         (Stringpool_template::get_offset_with_length): Likewise.
11344         (Stringpool_template::write_to_buffer): Likewise.
11345         * stringpool.h (Stringpool_template::get_offset_from_key):
11346         Likewise.
11347
11348 2008-07-23  Ian Lance Taylor  <iant@google.com>
11349
11350         PR 6658
11351         * object.h (Merged_symbol_value::value): Do our best to handle a
11352         negative addend.
11353
11354         PR 6647
11355         * script.cc (Version_script_info::get_versions): Don't add empty
11356         version tag to return value.
11357         (Version_script_info::get_symbol_version_helper): Change return
11358         type to bool.  Add pversion parameter.  Change all callers.
11359         (script_register_vers_node): Don't require a non-NULL tag.
11360         * script.h (class Version_script_info): Update declarations.
11361         (Version_script_info::get_symbol_version): Change return type to
11362         bool.  Add version parameter.  Change all callers.
11363         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11364         handling.  Handle an empty version from a version script.
11365         (Symbol_table::define_special_symbol): Likewise.
11366         * testsuite/ver_test_10.script: New file.
11367         * testsuite/ver_test_10.sh: New file.
11368         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11369         (check_DATA): Add ver_test_10.syms.
11370         (ver_test_10.syms, ver_test_10.so): New target.
11371         * testsuite/Makefile.in: Rebuild.
11372
11373 2008-07-23  Simon Baldwin  <simonb@google.com>
11374
11375         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11376         to zero for undefined symbols from dynamic libraries.
11377
11378 2008-07-23  Ian Lance Taylor  <iant@google.com>
11379
11380         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11381         Change all callers.
11382         * symtab.h (class Symbol_table): Update declaration.
11383         * testsuite/ver_test_9.cc: New file.
11384         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11385         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11386         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11387         (ver_test_9.so, ver_test_9.o): New targets.
11388         * testsuite/Makefile.in: Rebuild.
11389
11390 2008-07-22  Ian Lance Taylor  <iant@google.com>
11391
11392         * options.h (class General_options): Define --check-sections.
11393         * layout.cc (Layout::set_segment_offsets): Handle
11394         --check-sections.
11395
11396         * options.h (class General_options): Define -n/--nmagic and
11397         -N/--omagic.
11398         * options.cc (General_options::finalize): For -n/--nmagic or
11399         -N/--omagic, set -static.
11400         * layout.cc (Layout::attach_allocated_section_to_segment): If
11401         -N/--omagic, don't put read-only and read-write sections in
11402         different segments.
11403         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11404         finding a read-only segment.
11405         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11406         don't set the minimum segment alignment to the common page size,
11407         and don't set the file offset to the address modulo the page size.
11408         * script-sections.cc (Script_sections::create_segments): If
11409         -n/--omagic, don't put read-only and read-write sections in
11410         different segments.
11411
11412         * cref.cc: New file.
11413         * cref.h: New file.
11414         * options.h (class General_options): Add --print-symbol-counts.
11415         * main.cc (main): Issue defined symbol report if requested.
11416         * archive.cc (Archive::interpret_header): Make into a const member
11417         function.
11418         (Archive::add_symbols): Call Input_objects::archive_start and
11419         archive_stop.
11420         (Archive::const_iterator): Define new class.
11421         (Archive::begin, Archive::end): New functions.
11422         (Archive::include_all_members): Rewrite to use iterator.
11423         (Archive::count_members): New function.
11424         * archive.h (class Archive): Update declarations.
11425         (Archive::filename): New function.
11426         * object.cc: Include "cref.h".
11427         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11428         (Sized_relobj::do_get_global_symbol_counts): New function.
11429         (Input_objects::add_object): Add object to cross-referencer.
11430         (Input_objects::archive_start): New function.
11431         (Input_objects::archive_stop): New function.
11432         (Input_objects::print_symbol_counts): New function.
11433         * object.h: Declare Cref and Archive.
11434         (Object::get_global_symbol_counts): New function.
11435         (Object::do_get_global_symbol_counts): New pure virtual function.
11436         (class Sized_relobj): Add defined_count_ field.  Update
11437         declarations.
11438         (class Input_objects): Add cref_ field.  Update constructor.
11439         Update declarations.
11440         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11441         defined_count_.
11442         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11443         symbol counts.
11444         (Sized_dynobj::do_get_global_symbol_counts): New function.
11445         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11446         defined_count_.  Update declarations.  Define Symbols typedef.
11447         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11448         parameter.  Change all callers.
11449         (Symbol_table::add_from_dynobj): Add sympointers and defined
11450         parameters.  Change all callers.
11451         * symtab.h (class Symbol_table): Update declarations.
11452         * Makefile.am (CCFILES): Add cref.cc.
11453         (HFILES): Add cref.h.
11454         * Makefile.in: Rebuild.
11455
11456 2008-07-22  Simon Baldwin  <simonb@google.com>
11457
11458         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11459         to zero when writing undefined symbols.
11460
11461 2008-07-22  Ian Lance Taylor  <iant@google.com>
11462
11463         * output.cc (Output_section::add_input_section): Don't try to
11464         merge empty merge sections.
11465
11466 2008-07-21  Craig Silverstein  <csilvers@google.com>
11467
11468         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11469         Include symbol version in error message.
11470
11471 2008-07-20  Chris Demetriou  <cgd@google.com>
11472
11473         * configure.ac (gold_cv_c_random_seed): New configured variable.
11474         (RANDOM_SEED_CFLAGS): New substituted variable.
11475         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11476         * configure: Rebuild.
11477         * Makefile.in: Likewise.
11478         * testsuite/Makefile.in: Likewise.
11479
11480 2008-07-18  Ian Lance Taylor  <iant@google.com>
11481
11482         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11483         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11484         * testsuite/ver_test_main.cc (main): Call t4.
11485         (t4, t4_2a): Define.
11486         * testsuite/ver_test_2.cc (t4_2): Define.
11487         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11488         * testsuite/ver_test_4.cc (t4_2a): Define.
11489         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11490         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11491
11492 2008-07-17  Ian Lance Taylor  <iant@google.com>
11493
11494         * dynobj.cc (Versions::add_def): If we give an error about a
11495         missing version, go ahead and create the version anyhow.
11496
11497 2008-07-10  Ian Lance Taylor  <iant@google.com>
11498
11499         Handle output sections with more than 0x7fffffff bytes.
11500         * object.h (class Relobj): Change map_to_output_ to
11501         output_sections_, and just keep a section pointer.  Change all
11502         uses.  Move comdat group support to Sized_relobj.
11503         (Relobj::is_section_specially_mapped): Remove.
11504         (Relobj::output_section): Remove poff parameter.  Change all
11505         callers.
11506         (Relobj::output_section_offset): New function.
11507         (Relobj::set_section_offset): Rewrite.
11508         (Relobj::map_to_output): Remove.
11509         (Relobj::output_sections): New function.
11510         (Relobj::do_output_section_offset): New pure virtual function.
11511         (Relobj::do_set_section_offset): Likewise.
11512         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11513         group support from Relobj.  Update declarations.
11514         (Sized_relobj::get_output_section_offset): New function.
11515         (Sized_relobj::do_output_section_offset): New function.
11516         (Sized_relobj::do_set_section_offset): New function.
11517         * object.cc (Relobj::output_section_address): Remove.
11518         (Sized_relobj::Sized_relobj): Initialize new fields.
11519         (Sized_relobj::include_section_group): Cast find_kept_object to
11520         Sized_relobj.
11521         (Sized_relobj::include_linkonce_section): Likewise.
11522         (Sized_relobj::do_layout): Use separate arrays for output section
11523         and output offset.
11524         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11525         output_sections.
11526         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11527         output_sections and section_offsets.
11528         (Sized_relobj::write_local_symbols): Likewise.
11529         (map_to_kept_section): Compute output address directly.
11530         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11531         output_sections and section_offsets.
11532         (Sized_relobj::write_sections): Likewise.
11533         (Sized_relobj::relocate_sections): Likewise.
11534         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11535         * output.h (class Output_reloc): Update declarations.  Change
11536         u2_.relobj to Sized_relobj*.
11537         (class Output_data_reloc): Change add functions to use
11538         Sized_relobj*.
11539         * output.cc (Output_reloc::Output_reloc): Change relobj to
11540         Sized_relobj*.
11541         (Output_reloc::local_section_offset): Change return type to
11542         Elf_Addr.  Use get_output_section_offset.
11543         (Output_reloc::get_address): Likewise.
11544         (Output_section::is_input_address_mapped): Don't call
11545         is_section_specially_mapped.
11546         (Output_section::output_offset): Likewise.
11547         (Output_section::output_address): Likewise.
11548         (Output_section::starting_output_address): Likewise.
11549         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11550         parameter to Sized_relobj*.
11551         (Copy_relocs::need_copy_reloc): Likewise.
11552         (Copy_relocs::save): Likewise.
11553         * copy-relocs.h (class Copy_relocs): Update declarations.
11554         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11555         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11556         * target-reloc.h (relocate_for_relocatable): Change
11557         offset_in_output_section type to Elf_Addr.  Change code that uses
11558         it as well.
11559         * layout.cc (Layout::layout): Always set *off.
11560         * mapfile.cc (Mapfile::print_input_section): Use
11561         output_section_offset.
11562         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11563         Sized_relobj*.
11564         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11565         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11566         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11567
11568 2008-07-03  Ian Lance Taylor  <iant@google.com>
11569
11570         * layout.cc (Layout::include_section): Do not discard unrecognized
11571         SHT_STRTAB sections.
11572
11573 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11574
11575         * script.cc (Lex::can_continue_name): Make '?' allowable in
11576         version-script names.
11577         * testsuite/version_script.map: Change glob pattern to use '?'
11578
11579 2008-06-30  Manish Singh  <yosh@gimp.org>
11580
11581         PR 6585
11582         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11583         Correct typo.
11584
11585 2008-06-30  Ian Lance Taylor  <iant@google.com>
11586
11587         PR 6660
11588         PR 6682
11589         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11590         versions]: Don't try to read the value in the contents, since we
11591         don't use it.  Use the template endianness when writing.
11592
11593 2008-06-25  Cary Coutant  <ccoutant@google.com>
11594
11595         * fileread.cc (File_read::make_view): Assert on zero-length view.
11596         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11597         symbol table when there are no symbols to read.
11598
11599 2008-06-23  Craig Silverstein  <csilvers@google.com>
11600
11601         * version.cc (version_string): Bump to 1.7
11602
11603 2008-06-18  Craig Silverstein  <csilvers@google.com>
11604
11605         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11606         constant 0xFFFF to type Valtype.
11607         (Powerpc_relocate_functions::rel16_ha): Likewise.
11608
11609 2008-06-17  Ian Lance Taylor  <iant@google.com>
11610
11611         * output.h (Output_section::Input_section): Initialize p2align_ to
11612         zero for Output_section_data constructors.
11613         (Output_section::Input_section::addralign): If not an input
11614         section, return the alignment of the Output_section_data.
11615         * testsuite/copy_test.cc: New file.
11616         * testsuite/copy_test_1.cc: New file.
11617         * testsuite/copy_test_2.cc: New file.
11618         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11619         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11620         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11621         (copy_test_1_pic.o, copy_test_1.so): New targets.
11622         (copy_test_2_pic.o, copy_test_2.so): New targets.
11623         * testsuite/Makefile.in: Rebuild.
11624
11625         * script-sections.cc (Script_sections::place_orphan): Initialize
11626         local variable exact.
11627
11628 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11629
11630         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11631
11632 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11633             David S. Miller  <davem@davemloft.net>
11634
11635         * powerpc.cc: New file.
11636         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11637         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11638         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11639         * Makefile.in: Rebuild.
11640
11641 2008-06-09  Ian Lance Taylor  <iant@google.com>
11642
11643         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11644         <exception>.
11645         (throwing, orig_terminate): New static variables.
11646         (terminate_handler): New static function.
11647         (t2): Set terminate handler.
11648
11649 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11650
11651         PR 6584
11652         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11653         alignment.
11654
11655 2008-05-30  Cary Coutant  <ccoutant@google.com>
11656
11657         * archive.cc (Archive::include_all_members) Correct to step
11658         over symbol table and extended name table in thin archives.
11659
11660 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11661
11662         PR 6407
11663         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11664         calculation.
11665
11666 2008-05-28  Caleb Howe  <cshowe@google.com>
11667
11668         * reduced_debug_output.cc: New file.
11669         * reduced_debug_output.h: New file.
11670         * options.h (class General_options): Add --strip-debug-non-line.
11671         * options.cc (General_options::finalize): Add strip_debug_non_line
11672         to the strip heirarchy.
11673         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11674         fields.
11675         * layout.cc: Include "reduced_debug_output.h".
11676         (Layout::Layout): Initialize new fields.
11677         (line_only_debug_sections): New static array.
11678         (is_lines_only_debug_sections): New static inline function.
11679         (Layout::include_section): Handle --strip-debug-non-line.
11680         (Layout::make_output_section): If --strip-debug-non-line, build
11681         new output sections for .debug_abbrev and .debug_info.
11682         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11683         gold.  Warn about possible overflow.
11684         (read_signed_LEB_128): Likewise.
11685         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11686         (read_signed_LEB_128): Declare.
11687         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11688         (HFILES): Add reduced_debug_output.h.
11689         * Makefile.in: Rebuild.
11690
11691 2008-05-21  Ian Lance Taylor  <iant@google.com>
11692
11693         * mapfile.cc: New file.
11694         * mapfile.h: New file.
11695         * options.h (class General_options): Add -M/--print-map and -Map.
11696         * options.cc (General_options::finalize): Make -M equivalent to
11697         -Map -.
11698         * main.cc: Include <cstdio> and "mapfile.h".
11699         (main): Open mapfile if requested.
11700         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11701         constructor.  Change caller.
11702         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11703         (queue_middle_tasks): Likewise.
11704         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11705         declarations.
11706         * archive.cc: Include "mapfile.h".
11707         (Archive::add_symbols): Add mapfile parameter.  Change all
11708         callers.  Pass mapfile, symbol, and reason to include_member.
11709         (Archive::include_all_members): Add mapfile parameter.  Change all
11710         callers.
11711         (Archive::include_member): Add mapfile, sym, and why parameters.
11712         Change all callers.  Report inclusion to map file.
11713         * archive.h: Include "fileread.h".
11714         (class Archive): Update declarations.
11715         (Archive::file): New const method.
11716         (class Add_archive_symbols): Add mapfile_ field.  Update
11717         constructor.  Change all callers.
11718         * readsyms.h (class Read_symbols): Likewise.
11719         (class Finish_group): Likewise.
11720         (class Read_script): Likewise.
11721         * common.cc: Include "mapfile.h".
11722         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11723         all callers.
11724         (Symbol_table::do_allocate_commons): Likewise.
11725         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11726         symbol allocation to mapfile.
11727         * common.h (class Allocate_commons_task): Add mapfile_ field.
11728         Update constructor.  Change all callers.
11729         * symtab.h (class Symbol_table): Update declarations.
11730         * layout.cc: Include "mapfile.h".
11731         (Layout_task_runner::run): Print information to mapfile.
11732         (Layout::create_gold_note): Change Output_data_fixed_space to
11733         Output_data_zero_fill.
11734         (Layout::create_build_id): Likewise.
11735         (Layout::print_to_mapfile): New function.
11736         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11737         constructor.  Change caller.
11738         (class Layout): Declare print_to_mapfile.
11739         * output.cc (Output_section::Input_section::print_to_mapfile): New
11740         function.
11741         (Output_section::add_input_section): If producing a map, always
11742         add to input_sections_ list.
11743         (Output_section::do_print_to_mapfile): New function.
11744         (Output_segment::print_sections_to_mapfile): New function.
11745         (Output_segment::print_section_list_to_mapfile): New function.
11746         * output.h: Include "mapfile.h".
11747         (Output_data::print_to_mapfile): New function.
11748         (Output_data::do_print_to_mapfile): New virtual function.
11749         (Output_segment_headers::do_print_to_mapfile): New function.
11750         (Output_file_header::do_print_to_mapfile): New function.
11751         (Output_data_const::do_print_to_mapfile): New function.
11752         (class Output_data_const_buffer): Add map_name_ field.  Update
11753         constructor.  Change all callers.  Add do_print_to_mapfile
11754         function.
11755         (class Output_data_fixed_space): Likewise.
11756         (class Output_data_space): Likewise.
11757         (class Output_data_zero_fill): New class.
11758         (Output_data_strtab::do_print_to_mapfile): New function.
11759         (Output_data_reloc_base::do_print_to_mapfile): New function.
11760         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11761         (Output_data_group::do_print_to_mapfile): New function.
11762         (Output_data_got::do_print_to_mapfile): New function.
11763         (Output_data_dynamic::do_print_to_mapfile): New function.
11764         (Output_symtab_xindex::do_print_to_mapfile): New function.
11765         (class Output_section): Declare do_print_to_mapflie.  Declare
11766         print_to_mapfile in Input_section.
11767         (class Output_segment): Declare new functions.
11768         * object.h (Sized_relobj::symbol_count): New function.
11769         * script-sections.cc
11770         (Output_section_element_dot_assignment::set_section_addresses):
11771         Change Output_data_fixed_space to Output_data_zero_fill.
11772         (Output_data_expression::do_print_to_mapfile): New function.
11773         * script.cc (read_input_script): Add mapfile parameter.  Change
11774         all callers.
11775         * script.h (read_input_script): Update declaration.
11776         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11777         (Eh_frame::do_print_to_mapfile): New function.
11778         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11779         (Output_merge_string::do_print_to_mapfile): New function.
11780         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11781         function.
11782         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11783         function.
11784         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11785         function.
11786         * Makefile.am (CCFILES): Add mapfile.cc.
11787         (HFILES): Add mapfile.h.
11788         * Makefile.in: Rebuild.
11789
11790 2008-05-19  Ian Lance Taylor  <iant@google.com>
11791
11792         * options.h (class General_options): Add -z relro.
11793         * layout.cc (Layout::Layout): Initialize relro_segment_.
11794         (Layout::add_output_section_data): Return the output section.
11795         (Layout::make_output_section): Rcognize relro sections and mark
11796         them appropriately.
11797         (Layout::attach_allocated_section_to_segment): Put relro sections
11798         in a PT_GNU_RELRO segment.
11799         (Layout::create_initial_dynamic_sections): Mark the .dynamic
11800         section as relro.
11801         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
11802         PT_TLS segments.
11803         (Layout::linkonce_mapping): Map d.rel.ro.local to
11804         .data.rel.ro.local.
11805         (Layout::output_section_name): Us .data.rel.ro.local for any
11806         section which begins with that.
11807         * layout.h (class Layout): Update add_output_section_data
11808         declaration.  Add relro_segment_ field.
11809         * output.cc (Output_section::Output_section): Initialize is_relro_
11810         and is_relro_local_ fields.
11811         (Output_segment::add_output_section): Group relro sections.
11812         (Output_segment::is_first_section_relro): New function.
11813         (Output_segment::maximum_alignment): If there is a relro section,
11814         align the segment to the common page size.
11815         (Output_segment::set_section_addresses): Track whether we are
11816         looking at relro sections.  If the last section is a relro
11817         section, align to the common page size.
11818         (Output_segment::set_section_list_addresses): Add in_relro
11819         parameter.  Change all callers.  Align to the page size when
11820         moving from relro to non-relro section.
11821         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
11822         segment.
11823         * output.h (class Output_section): Add is_relro_ and
11824         is_relro_local_ fields.
11825         (Output_section::is_relro): New function.
11826         (Output_section::set_is_relro): New function.
11827         (Output_section::is_relro_local): New function.
11828         (Output_section::set_is_relro_local): New function.
11829         (class Output_segment): Update declarations.
11830         * i386.cc (Target_i386::got_section): Mark .got section as relro.
11831         * sparc.cc (Target_sparc::got_section): Likewise.
11832         * x86_64.cc (Target_x86_64::got_section): Likewise.
11833         * testsuite/relro_test_main.cc: New file.
11834         * testsuite/relro_test.cc: New file.
11835         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
11836         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
11837         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
11838         (relro_test.so, relro_test_pic.o): New targets.
11839         * testsuite/Makefile.in: Rebuild.
11840
11841 2008-05-16  Ian Lance Taylor  <iant@google.com>
11842
11843         * output.cc (Output_segment::add_output_section): Remove front
11844         parameter.
11845         * output.h (class Output_segment): Remove
11846         add_initial_output_section and overloaded add_output_section.
11847         Update declaration of remaining add_output_section.
11848         * layout.cc (Layout::create_interp): Call add_output_section
11849         rather than add_initial_output_section.
11850         (Layout::finish_dynamic_section): Likewise.
11851
11852         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
11853         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
11854         know the dynamic type.
11855         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
11856         field.  Initialize it in constructor.
11857         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
11858         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
11859         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
11860         reloc.
11861
11862         * output.cc (Output_reloc::get_address): Change return type to
11863         Elf_Addr.
11864         * output.h (class Output_reloc): Update get_address declaration.
11865         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
11866         for section addresses.
11867
11868 2008-05-09  Ian Lance Taylor  <iant@google.com>
11869
11870         PR 6493
11871         * gold.cc (gold_nomem): Use return value of write.
11872
11873 2008-05-08  Ian Lance Taylor  <iant@google.com>
11874
11875         * symtab.c (Symbol::init_base_output_data): Add version
11876         parameter.  Change all callers.
11877         (Symbol::init_base_output_segment): Likewise.
11878         (Symbol::init_base_constant): Likewise.
11879         (Symbol::init_base_undefined): Likewise.
11880         (Sized_symbol::init_output_data): Likewise.
11881         (Sized_symbol::init_output_segment): Likewise.
11882         (Sized_symbol::init_constant): Likewise.
11883         (Sized_symbol::init_undefined): Likewise.
11884         (Symbol_table::do_define_in_output_data): If the new symbol has a
11885         version, mark it as the default.
11886         (Symbol_table::do_define_in_output_segment): Likewise.
11887         (Symbol_table::do_define_as_constant): Likewise.
11888         * symtab.h (class Symbol): Update declarations.
11889         (class Sized_symbol): Likewise.
11890         * resolve.cc (Symbol::override_version): New function.
11891         (Symbol::override_base): Call override_version.
11892         (Symbol::override_base_with_special): Likewise.
11893         * testsuite/ver_script_8.script: New file.
11894         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
11895         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
11896         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
11897         (ver_test_8_1.so, ver_test_8_2.so): New targets.
11898
11899 2008-05-06  Ian Lance Taylor  <iant@google.com>
11900
11901         PR 6049
11902         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
11903         functions.
11904         (class General_options): Remove existing --undefined, and add
11905         --no-undefined instead.  Add new --undefined as synonym for -u.
11906         * archive.cc (Archive::add_symbols): Check whether symbol was
11907         named with -u.
11908         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
11909         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
11910         all uses.  Add IS_UNDEFINED.  Update declarations to split
11911         different versions of init_base.  Declare init_base_undefined.
11912         (Symbol::is_defined): Handle IS_UNDEFINED.
11913         (Symbol::is_undefined): Likewise.
11914         (Symbol::is_weak_undefined): Call is_undefined.
11915         (Symbol::is_absolute): Handle IS_CONSTANT.
11916         (class Sized_symbol): Update declarations to split different
11917         versions of init.  Declare init_undefined.
11918         (class Symbol_table): Declare new functions.
11919         * symtab.cc (Symbol::init_base_object): Rename from init_base.
11920         Change all callers.
11921         (Symbol::init_base_output_data): Likewise.
11922         (Symbol::init_base_output_segment): Likewise.
11923         (Symbol::init_base_constant): Likewise.
11924         (Symbol::init_base_undefined): New function.
11925         (Sized_symbol::init_object): Rename from init.  Change all
11926         callers.
11927         (Sized_symbol::init_output_data): Likewise.
11928         (Sized_symbol::init_output_segment): Likewise.
11929         (Sized_symbol::init_constant): Likewise.
11930         (Sized_symbol::init_undefined): New function.
11931         (Symbol_table::add_undefined_symbols_from_command_line): New
11932         function.
11933         (Symbol_table::do_add_undefined_symbols_from_command_line): New
11934         function.
11935         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
11936         (Symbol::output_section): Likewise.
11937         (Symbol::set_output_section): Likewise.
11938         (Symbol_table::sized_finalize_symbol): Likewise.
11939         (Symbol_table::sized_write_globals): Likewise.
11940         * resolve.cc (Symbol_table::should_override): Likewise.
11941         (Symbol::override_base_with_special): Likewise.
11942
11943         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
11944         symbol, change it to have default visibility.
11945         * testsuite/protected_1.cc: New file.
11946         * testsuite/protected_2.cc: New file.
11947         * testsuite/protected_3.cc: New file.
11948         * testsuite/protected_main_1.cc: New file.
11949         * testsuite/protected_main_2.cc: New file.
11950         * testsuite/protected_main_3.cc: New file.
11951         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
11952         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
11953         (protected_1_LDFLAGS, protected_1_LDADD): Define.
11954         (protected_1.so): New target.
11955         (protected_1_pic.o, protected_2_pic.o): New targets.
11956         (protected_3_pic.o): New target.
11957         (check_PROGRAMS): Add protected_2.
11958         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
11959         (protected_2_LDFLAGS, protected_2_LDADD): Define.
11960         * testsuite/Makefile.in: Rebuild.
11961
11962         * options.h (DEFINE_var): Add set_user_set_##varname__.
11963         (DEFINE_bool_alias): New macro.
11964         (class General_options): Define -Bstatic using DEFINE_bool_alias
11965         rather than DEFINE_special.  Add --undefined as an alias for -z
11966         defs.
11967         * options.cc (General_options::parse_Bstatic): Remove.
11968
11969         * options.h (class General_options): Add --fatal-warnings.
11970         * main.cc (main): Implement --fatal-warnings.
11971         * errors.h (Errors::warning_count): New function.
11972
11973         * options.h (class General_options): Add -Bsymbolic-functions.
11974         * symtab.h (Symbol::is_preemptible): Check for
11975         -Bsymbolic-functions.
11976
11977 2008-05-05  Ian Lance Taylor  <iant@google.com>
11978
11979         * options.h (DEFINE_bool): For DASH_Z, create the negative option
11980         as noVARNAME rather than no-VARNAME.
11981         (class General_options): Add option -z combreloc.
11982         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
11983         get_address.
11984         (Output_reloc::sort_before) [SHT_REL]: New function.
11985         (Output_reloc::sort_before) [SHT_RELA]: New function.
11986         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
11987         Sort_relocs_comparison.
11988         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
11989         parameter.  Change all callers.
11990         (Output_data_reloc::Output_data_reloc) [both versions]: Add
11991         sort_relocs parameter.  Change all callers.
11992         * output.cc (Output_reloc::get_address): New function, broken out
11993         of write_rel.
11994         (Output_reloc::write_rel): Call it.
11995         (Output_reloc::compare): New function.
11996         (Output_data_reloc_base::do_write): Optionally sort relocs.
11997
11998         * configure.ac: If targ_extra_obj is set, link it in.
11999         * configure.tgt: Initialize all variables.
12000         (x86_64*): Set targ_extra_obj and targ_extra_size.
12001         * configure: Rebuild.
12002
12003         * object.cc (Sized_relobj::include_section_group): Adjust section
12004         indexes read from group data.  Build vector to pass to
12005         layout_group.
12006         * layout.cc (Layout::layout_group): Add flags and shndxes
12007         parameters.  Remove contents parameter.  Change caller.  Update
12008         explicit instantiations.
12009         * layout.h (class Layout): Update layout_group declaration.
12010         * output.cc (Output_data_group::Output_data_group): Add flags and
12011         input_shndxes parameters.  Remove contents parameter.  Change
12012         caller.
12013         (Output_data_group::do_write): Change input_sections_ to
12014         input_shndxes_.
12015         * output.h (class Output_data_group): Update constructor
12016         declaration.  Rename input_sections_ to input_shndxes_.
12017         * testsuite/many_sections_test.cc: Add template.
12018
12019 2008-04-30  Cary Coutant  <ccoutant@google.com>
12020
12021         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12022
12023         * layout.cc (Layout::include_section): Refactored check for debug
12024         info section.
12025         (Layout::add_comdat): Add new parameters.  Change type
12026         of signature parameter.  Add object and shndx to signatures table.
12027         (Layout::find_kept_object): New function.
12028         * layout.h: Include <cstring>.
12029         (Layout::is_debug_info_section): New function.
12030         (Layout::add_comdat): Add new parameters.
12031         (Layout::find_kept_object): New function.
12032         (Layout::Kept_section): New struct.
12033         (Layout::Signatures): Change type of map range.
12034         * object.cc (Relobj::output_section_address): New function.
12035         (Sized_relobj::include_section_group): Add new parameters.  Change
12036         calls to Layout::add_comdat.  Change to build table of kept comdat
12037         groups and table mapping discarded sections to kept sections.
12038         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12039         (Sized_relobj::do_layout): Change calls to include_section_group and
12040         include_linkonce_section.
12041         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12042         value to zero when section is discarded.
12043         (Sized_relobj::map_to_kept_section): New function.
12044         * object.h (Relobj::output_section_address): New function.
12045         (Relobj::Comdat_group): New type.
12046         (Relobj::find_comdat_group): New function.
12047         (Relobj::Comdat_group_table): New type.
12048         (Relobj::Kept_comdat_section): New type.
12049         (Relobj::Kept_comdat_section_table): New type.
12050         (Relobj::add_comdat_group): New function.
12051         (Relobj::set_kept_comdat_section): New function.
12052         (Relobj::get_kept_comdat_section): New function.
12053         (Relobj::comdat_groups_): New field.
12054         (Relobj::kept_comdat_sections_): New field.
12055         (Symbol_value::input_value): Update comment.
12056         (Sized_relobj::map_to_kept_section) New function.
12057         (Sized_relobj::include_linkonce_section): Add new parameter.
12058         * target-reloc.h (Comdat_behavior): New type.
12059         (get_comdat_behavior): New function.
12060         (relocate_section): Add code to map a discarded section to the
12061         corresponding kept section when applying a relocation.
12062
12063 2008-04-30  Craig Silverstein  <csilvers@google.com>
12064
12065         * dwarf_reader.cc (next_generation_count): New static var.
12066         (Addr2line_cache_entry): New struct.
12067         (addr2line_cache): New static var.
12068         (Dwarf_line_info::one_addr2line): Added caching.
12069         (Dwarf_line_info::clear_addr2line_cache): New function.
12070         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12071         cache-size parameter.
12072         (Dwarf_line_info::one_addr2line_cache): New function.
12073         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12074         new cache-size argument to one_addr2line(), and clear cache.
12075
12076 2008-04-28  Cary Coutant  <ccoutant@google.com>
12077
12078         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12079         R_386_PC8 relocations.
12080
12081 2008-04-23  Ian Lance Taylor  <iant@google.com>
12082
12083         * object.cc (Sized_relobj::include_section_group): Check for
12084         invalid section group.
12085
12086         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12087         header size.
12088
12089         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12090         than read for file header.
12091         * archive.cc (Archive::include_member): Likewise.
12092
12093 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12094
12095         * aclocal.m4: Regenerate.
12096         * configure: Regenerate.
12097
12098 2008-04-19  Ian Lance Taylor  <iant@google.com>
12099
12100         * version.cc (version_string): Bump to 1.6.
12101
12102         * testsuite/Makefile.am (many_sections_r_test): New target.
12103         (many_sections_r_test_SOURCES): Remove.
12104         (many_sections_r_test_DEPENDENCIES): Remove.
12105         (many_sections_r_test_LDFLAGS): Remove.
12106         (many_sections_r_test_LDADD): Remove.
12107
12108         * object.cc (Sized_relobj::do_add_symbols): Always pass
12109         local_symbol_count_ to add_from_relobj.
12110
12111         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12112         every thousand variables.
12113         * testsuite/Makefile.in: Rebuild.
12114
12115         * object.cc (Xindex::initialize_symtab_xindex): New function.
12116         (Xindex::read_symtab_xindex): New function.
12117         (Xindex::sym_xindex_to_shndx): New function.
12118         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12119         available.
12120         (Sized_relobj::do_initialize_xindex): New function.
12121         (Sized_relobj::do_read_symbols): Adjust section links.
12122         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12123         parameter.  Change all callers.
12124         (Sized_relobj::include_section_group): Adjust section links and
12125         symbol section indexes.
12126         (Sized_relobj::do_layout): Adjust section links.
12127         (Sized_relobj::do_count_local_symbols): Adjust section links and
12128         symbol section indexes.
12129         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12130         ordinary and special symbols.
12131         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12132         dynsym_xindex parameters.  Change all callers.  Adjust section
12133         links.  Use SHN_XINDEX when needed.
12134         (Sized_relobj::get_symbol_location_info): Adjust section links.
12135         Don't get fooled by special symbols.
12136         * object.h (class Xindex): Define.
12137         (class Object): Add xindex_ parameter.  Declare virtual functoin
12138         do_initialize_xindex.
12139         (Object::adjust_sym_shndx): New function.
12140         (Object::set_xindex): New protected function.
12141         (class Symbol_value): Add is_ordinary_shndx_ field.
12142         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12143         (Symbol_value::value): Assert ordinary section.
12144         (Symbol_value::initialize_input_to_output_map): Likewise.
12145         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12146         Change all callers.
12147         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12148         all callers.
12149         (class Sized_relobj): Update declarations.
12150         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12151         parameter.  Change all callers.
12152         (Sized_relobj::adjust_shndx): New function.
12153         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12154         field.
12155         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12156         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12157         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12158         (Sized_dynobj::read_dynsym_section): Adjust section links.
12159         (Sized_dynobj::read_dynamic): Likewise.
12160         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12161         section links.
12162         (Sized_dynobj::do_initialize_xindex): New function.
12163         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12164         do_initialize_xindex.
12165         (Sized_dynobj::adjust_shndx): New function.
12166         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12167         dynsym_xindex_ fields.
12168         (Layout::finalize): Add a call to set_section_indexes before
12169         creating the symtab sections.
12170         (Layout::set_section_indexes): Don't do anything if the section
12171         already has a section index.
12172         (Layout::create_symtab_sections): Add shnum parameter.  Change
12173         caller.  Create .symtab_shndx section if needed.
12174         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12175         caller.
12176         (Layout::allocated_output_section_count): New function.
12177         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12178         needed.
12179         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12180         fields.  Update declarations.
12181         (Layout::symtab_xindex): New function.
12182         (Layout::dynsym_xindex): New function.
12183         (class Write_symbols_task): Add layout_ field.
12184         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12185         Change caller.
12186         * output.cc (Output_section_headers::Output_section_headers): Add
12187         shstrtab_section parameter.  Change all callers.
12188         (Output_section_headers::do_sized_write): Store overflow values
12189         for section count and section string table section index in
12190         section header zero.
12191         (Output_file_header::do_sized_write): Check for overflow of
12192         section count and section string table section index.
12193         (Output_symtab_xindex::do_write): New function.
12194         (Output_symtab_xindex::endian_do_write): New function.
12195         * output.h (class Output_section_headers): Add shstrtab_section_.
12196         Update declarations.
12197         (class Output_symtab_xindex): Define.
12198         (Output_section::has_out_shndx): New function.
12199         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12200         field.
12201         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12202         Change all callers.
12203         (Sized_symbol::init): Likewise.
12204         (Symbol::output_section): Check for ordinary symbol.
12205         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12206         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12207         callers.
12208         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12209         Change all callers.  Simplify handling of symbols from sections
12210         not included in the link.
12211         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12212         distinction.
12213         (Weak_alias_sorter::operator()): Assert that symbols are
12214         ordinary.
12215         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12216         distinction.
12217         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12218         parameters.  Change all callers.
12219         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12220         symbol distinction.  Use SHN_XINDEX when needed.
12221         (Symbol_table::write_section_symbol): Add symtab_xindex
12222         parameter.  Change all callers.
12223         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12224         SHN_XINDEX when needed.
12225         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12226         declarations.
12227         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12228         (Symbol::is_defined): Check is_ordinary.
12229         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12230         (Symbol::is_absolute, Symbol::is_common): Likewise.
12231         (class Sized_symbol): Update declarations.
12232         (class Symbol_table): Update declarations.
12233         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12234         parameters.  Change all callers.
12235         (Sized_symbol::override): Likewise.
12236         (Symbol_table::override): Likewise.
12237         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12238         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12239         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12240         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12241         to be in an ordinary section.
12242         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12243         object and is_ordinary parameters.  Change all callers.
12244         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12245         Change all callers.  Don't add undefined or non-ordinary symbols
12246         to reloc_map_.
12247         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12248         Change all callers.
12249         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12250         declarations.
12251         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12252         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12253         (Sized_relobj::relocate_sections): Likewise.
12254         * target-reloc.h (scan_relocs): Adjust section symbol index.
12255         (scan_relocatable_relocs): Likewise.
12256         * i386.cc (Scan::local): Check for ordinary symbols.
12257         * sparc.cc (Scan::local): Likewise.
12258         * x86_64.cc (Scan::local): Likewise.
12259         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12260         to symbol_section_and_value.
12261         * testsuite/many_sections_test.cc: New file.
12262         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12263         (check_PROGRAMS): Add many_sections_test.
12264         (many_sections_test_SOURCES): Define.
12265         (many_sections_test_DEPENDENCIES): Define.
12266         (many_sections_test_LDFLAGS): Define.
12267         (BUILT_SOURCES): Add many_sections_define.h.
12268         (many_sections_define.h): New target.
12269         (BUILT_SOURCES): Add many_sections_check.h.
12270         (many_sections_check.h): New target.
12271         (check_PROGRAMS): Add many_sections_r_test.
12272         (many_sections_r_test_SOURCES): Define.
12273         (many_sections_r_test_DEPENDENCIES): Define.
12274         (many_sections_r_test_LDFLAGS): Define.
12275         (many_sections_r_test_LDADD): Define.
12276         (many_sections_r_test.o): New target.
12277         * testsuite/Makefile.in: Rebuild.
12278
12279 2008-04-17  Cary Coutant  <ccoutant@google.com>
12280
12281         * errors.cc (Errors::info): New function.
12282         (gold_info): New function.
12283         * errors.h (Errors::info): New function.
12284         * gold.h (gold_info): New function.
12285         * object.cc (Input_objects::add_object): Print trace output.
12286         * options.cc (options::parse_set): New function.
12287         (General_options::parse_wrap): Deleted.
12288         (General_options::General_options): Deleted initializer.
12289         * options.h (options::String_set): New typedef.
12290         (options::parse_set): New function.
12291         (DEFINE_set): New macro.
12292         (General_options::wrap): Changed to use DEFINE_set. Changed
12293         callers of any_wrap_symbols and is_wrap_symbol.
12294         (General_options::trace, General_options::trace_symbol):
12295         New options.
12296         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12297         (General_options::wrap_symbols_): Deleted.
12298         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12299
12300 2008-04-17  David S. Miller  <davem@davemloft.net>
12301
12302         * options.cc (General_options::parse_V): New function.
12303         * options.h: Add entries for -V and -Qy.
12304
12305 2008-04-17  Ian Lance Taylor  <iant@google.com>
12306
12307         * common.cc (Symbol_table::allocate_commons): Remove options
12308         parameter.  Change caller.
12309         (Symbol_table::do_allocate_commons): Remove options parameter.
12310         Change caller.  Just call do_allocate_commons_list twice.
12311         (Symbol_table::do_allocate_commons_list): New function, broken out
12312         of do_allocate_commons.
12313         * common.h (class Allocate_commons_task): Remove options_ field.
12314         Update constructor.
12315         * symtab.cc (Symbol_table::Symbol_table): Initialize
12316         tls_commons_.
12317         (Symbol_table::add_from_object): Put TLS common symbols on
12318         tls_commons_ list.
12319         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12320         which are IN_OUTPUT_DATA.
12321         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12322         allocate_commons and do_allocate_commons declarations.  Declare
12323         do_allocate_commons_list.
12324         * gold.cc (queue_middle_tasks): Update creation of
12325         Allocate_commons_task to not pass options.
12326         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12327         (TLS_TEST_C_FLAGS): New variable.
12328         (tls_test_c_pic.o): New target.
12329         (tls_test_shared.so): Link in tls_test_c_pic.o.
12330         (tls_test_c_pic_ie.o): New target.
12331         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12332         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12333         (tls_test_c.o): New target.
12334         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12335         (tls_pic_test_LDADD): Likewise.
12336         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12337         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12338         (tls_test_c_gnu2.o): New target.
12339         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12340         tls_test_c_gnu2.o.
12341         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12342         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12343         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12344         * testsuite/tls_test.cc: Include "config.h".
12345         (t_last): Call t11_last.
12346         * testsuite/tls_test.h (t11, t11_last): Declare.
12347         * testsuite/tls_test_c.c: New file.
12348         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12349         * configure.ac: Check for OpenMP support.
12350         * configure, config.in, Makefile.in: Rebuild.
12351         * testsuite/Makefile.in: Rebuild.
12352
12353 2008-04-16  Cary Coutant  <ccoutant@google.com>
12354
12355         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12356         (Target_i386::tls_base_symbol_defined_): New field.
12357         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12358         (Target_i386::Scan::global): Likewise.
12359         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12360         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12361         (Target_x86_64::tls_base_symbol_defined_): New field.
12362         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12363         (Target_x86_64::Scan::global): Likewise.
12364
12365 2008-04-16  Cary Coutant  <ccoutant@google.com>
12366
12367         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12368         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12369         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12370         building shared libraries.
12371         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12372         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12373         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12374         * testsuite/Makefile.in: Rebuild.
12375         * testsuite/weak_undef.h: New file.
12376         * testsuite/weak_undef_file1.cc: Add extra test cases.
12377         * testsuite/weak_undef_file2.cc: Likewise.
12378         * testsuite/weak_undef_test.cc: Likewise.
12379
12380 2008-04-16  David S. Miller  <davem@davemloft.net>
12381
12382         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12383         Add issued_non_pic_error_ field.  Declare check_non_pic.
12384         (Target_sparc::Scan::check_non_pic): New function.
12385         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12386         (Target_sparc::Scan::global): Likewise.
12387
12388         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12389         * configure: Rebuild.
12390
12391         * options.h (DEFINE_enable): New macro.
12392         (new_dtags): New enable option.
12393         (initfirst, interpose, loadfltr, nodefaultlib,
12394         nodelete, nodlopen, nodump): New -z options.
12395         * layout.cc (Layout:finish_dynamic_section): If new
12396         dtags enabled, emit DT_RUNPATH.  Also, emit a
12397         DT_FLAGS_1 containing any specified -z flags.
12398
12399 2008-04-16  Ian Lance Taylor  <iant@google.com>
12400
12401         * copy-relocs.cc: New file.
12402         * copy-relocs.h: New file.
12403         * reloc.cc: Remove Copy_relocs code.
12404         * reloc.h: Likewise.
12405         * reloc-types.h (struct Reloc_types) [both versions]: Add
12406         get_reloc_addend_noerror.
12407         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12408         variants of add_global which take an addend which must be zero.
12409         * i386.cc: Include "copy-relocs.h".
12410         (class Target_i386): Change type of copy_relocs_ to variable,
12411         update initializer.
12412         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12413         Change all callers.
12414         (Target_i386::do_finalize_sections): Change handling of
12415         copy_relocs_.
12416         * sparc.cc: Include "copy-relocs.h".
12417         (class Target_sparc): Change type of copy_relocs_ to variable,
12418         update initializer.
12419         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12420         Change all callers.
12421         (Target_sparc::do_finalize_sections): Change handling of
12422         copy_relocs_.
12423         * x86_64.cc: Include "copy-relocs.h".
12424         (class Target_x86_64): Change type of copy_relocs_ to variable,
12425         update initializer.
12426         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12427         class.  Change all callers.
12428         (Target_x86_64::do_finalize_sections): Change handling of
12429         copy_relocs_.
12430         * Makefile.am (CCFILES): Add copy-relocs.cc.
12431         (HFILES): Add copy-relocs.h.
12432
12433         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12434
12435         * testsuite/script_test_4.sh: Permit leading zeroes.
12436
12437 2008-04-15  Ian Lance Taylor  <iant@google.com>
12438
12439         * script-sections.cc (Script_sections::create_segments): Use
12440         header_size_adjustment even when there is enough room for the
12441         headers.
12442         * testsuite/script_test_4.sh: New file.
12443         * testsuite/script_test_4.t: New file.
12444         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12445         (check_DATA): Add script_test_4.stdout.
12446         (MOSTLYCLEANFILES): Likewise.
12447         (script_test_4): New target.
12448         (script_test_4.stdout): New target.
12449         * testsuite/Makefile.in: Rebuild.
12450
12451         * sparc.cc: Add definitions for Output_data_plt_sparc class
12452         constants.
12453
12454 2008-04-14  David S. Miller  <davem@davemloft.net>
12455
12456         * sparc.cc: New file.
12457         * Makefile.am (TARGETSOURCES): Add sparc.cc
12458         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12459         * configure.tgt: Document targ_extra_size and
12460         targ_extra_big_endian.  Add entries for sparc-* and
12461         sparc64-*.
12462         * configure.ac: Handle targ_extra_size and
12463         targ_extra_big_endian.
12464         * Makefile.in: Rebuild.
12465         * configure: Likewise.
12466         * po/POTFILES.in: Likewise.
12467         * po/gold.pot: Likewise.
12468
12469 2008-04-14  Ian Lance Taylor  <iant@google.com>
12470
12471         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12472         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12473         in the name/type/flags to section mapping.  Don't call
12474         allocate_output_section.
12475         (Layout::choose_output_section): Change parameter from adjust_name
12476         to is_input_section.  Don't permit input sections after sections
12477         are attached to segments.  Don't call allocate_output_section.
12478         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12479         not write_enable_output_section.
12480         (Layout::make_output_section): Don't push to
12481         unattached_section_list_ nor call attach_to_segment.  Call
12482         attach_section_to_segment if sections are attached.
12483         (Layout::attach_sections_to_segments): New function.
12484         (Layout::attach_section_to_segment): New function.
12485         (Layout::attach_allocated_section_to_segment): Rename from
12486         attach_to_segment.  Remove flags parameter.
12487         (Layout::allocate_output_section): Remove function.
12488         (Layout::write_enable_output_section): Remove function.
12489         * layout.h (class Layout): Update for above changes.  Add new
12490         field sections_are_attached_.
12491         * output.h (Output_section::update_flags_for_input_section): New
12492         function.
12493         * output.cc (Output_section::add_input_section): Call
12494         update_flags_for_input_section.
12495         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12496
12497 2008-04-11  Cary Coutant  <ccoutant@google.com>
12498
12499         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12500         thought unnecessary.
12501         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12502
12503 2008-04-11  Ian Lance Taylor  <iant@google.com>
12504
12505         * output.h (class Output_section_data): Remove inline definition
12506         of set_addralign.
12507         * output.cc (Output_section_data::set_addralign): New function.
12508
12509 2008-04-11  Cary Coutant  <ccoutant@google.com>
12510
12511         Add support for TLS descriptors for i386 and x86_64.
12512         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12513         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12514         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12515         GOT_TYPE_TLS_DESC.
12516         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12517         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12518         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12519         relocations.
12520         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12521         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12522         Fix problem with initial-exec relocations.
12523         (Target_i386::Relocate::relocate_tls): Likewise.
12524         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12525         relaxation.
12526         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12527         support for section-plus-offset dynamic table entries.
12528         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12529         (Output_data_dynamic::Dynamic_entry): Add support for
12530         section-plus-offset dynamic table entries.
12531         (Output_data_dynamic::Classification): Likewise.
12532         (Output_data_dynamic::classification_): Renamed offset_.
12533         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12534         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12535         (Target_x86_64::make_plt_section): New function.
12536         (Target_x86_64::reserve_tlsdesc_entries): New function.
12537         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12538         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12539         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12540         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12541         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12542         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12543         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12544         add extra PLT entry for TLS descriptors.
12545         (Output_data_plt_x86_64::got_): New field.
12546         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12547         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12548         fields.
12549         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12550         descriptors.
12551         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12552         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12553         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12554         R_386_TLS_DESC_CALL relocations.
12555         (Target_x86_64::Scan::global): Likewise.
12556         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12557         for TLS descriptors.
12558         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12559         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12560         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12561         GD-to-IE relaxation.
12562         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12563         and TLS_DESCRIPTORS.
12564         * Makefile.in: Rebuild.
12565         * configure: Rebuild.
12566         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12567         (tls_test_shared2.so): New target.
12568         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12569         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12570         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12571         (tls_shared_gd_to_ie_test_LDADD): New variable.
12572         (tls_shared_gnu2_gd_to_ie_test): New target.
12573         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12574         New targets.
12575         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12576         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12577         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12578         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12579         (tls_shared_gnu2_test): New target.
12580         (tls_test_gnu2_shared.so): New target.
12581         (tls_shared_gnu2_test_SOURCES): New variable.
12582         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12583         (tls_shared_gnu2_test_LDFLAGS): New variable.
12584         (tls_shared_gnu2_test_LDADD): New variable.
12585         * testsuite/Makefile.in: Rebuild.
12586         * testsuite/Makefile.
12587
12588 2008-04-11  Ian Lance Taylor  <iant@google.com>
12589
12590         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12591         justsyms.t.
12592         * testsuite/Makefile.in: Rebuild.
12593
12594         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12595         long.
12596         * testsuite/script_test_2.cc (main): Adjust test.
12597
12598 2008-04-11  David S. Miller  <davem@davemloft.net>
12599             Ian Lance Taylor  <iant@google.com>
12600
12601         * options.h (General_options): Add entries for '-Y' and
12602         '-relax'.
12603         * options.cc (General_options:finalize): If -Y was used, add those
12604         entries to the library path instead of the default "/lib" and
12605         "/usr/lib".
12606
12607 2008-04-11  David S. Miller  <davem@davemloft.net>
12608
12609         * testsuite/justsyms.t: Start at 0x100.
12610         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12611         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12612         long.
12613         * testsuite/script_test_2.cc: Adjust string and section length
12614         checks.
12615
12616 2008-04-09  Ian Lance Taylor  <iant@google.com>
12617
12618         PR gold/5996
12619         * script-sections.cc (Sections_element::allocate_to_segment): Add
12620         orphan parameter.
12621         (Output_section_definition::allocate_to_segment): Likewise.
12622         (Orphan_output_section::allocate_to_segment): Likewise.
12623         (Script_sections::attach_sections_using_phdrs_clause): Don't
12624         propagate non-PT_LOAD segments to orphan sections.
12625         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12626         readelf rather than objdump.
12627         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12628         .interp section and PT_INTERP segment are the same size.
12629         * testsuite/Makefile.in: Rebuild.
12630
12631         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12632         aliases for symbols defined in the same object.
12633         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12634         (weak_alias_test_SOURCES): New variable.
12635         (weak_alias_test_DEPENDENCIES): New variable.
12636         (weak_alias_test_LDFLAGS): New variable.
12637         (weak_alias_test_LDADD): New variable.
12638         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12639         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12640         (weak_alias_test_3.o): New target.
12641         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12642         * testsuite/weak_alias_test_main.cc: New file.
12643         * testsuite/weak_alias_test_1.cc: New file.
12644         * testsuite/weak_alias_test_2.cc: New file.
12645         * testsuite/weak_alias_test_3.cc: New file.
12646
12647 2008-04-08  Ian Lance Taylor  <iant@google.com>
12648
12649         * options.h (class General_options): Add --noinhibit-exec option.
12650         * main.cc (main): Check --noinhibit-exec.
12651
12652         * options.h (class General_options): Define --wrap as a special
12653         option.  Add wrap_symbols_ field.
12654         (General_options::any_wrap_symbols): New function.
12655         (General_options::is_wrap_symbol): New function.
12656         * options.cc (General_options::parse_wrap): New function.
12657         (General_options::General_options): Initialize wrap_symbols_.
12658         * symtab.cc (Symbol_table::wrap_symbol): New function.
12659         (Symbol_table::add_from_object): Handle --wrap.
12660         * symtab.h (class Symbol_table): Declare wrap_symbol.
12661         * target.h (Target::wrap_char): New function.
12662         (Target::Target_info): Add wrap_char field.
12663         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12664         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12665         * testsuite/testfile.cc (Target_test::test_target_info):
12666         Likewise.
12667
12668         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12669         there is one.
12670
12671         * layout.h (class Layout): Add added_eh_frame_data_ field.
12672         * layout.cc (Layout::Layout): Initialize new field.
12673         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12674         output section until we find a section we merged successfully.
12675         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12676         that the size be non-zero.
12677
12678         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12679         qualifier.
12680
12681 2008-04-08  Craig Silverstein  <csilvers@google.com>
12682
12683         * configure.ac: Export new conditional variable HAVE_ZLIB.
12684         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12685         on HAVE_ZLIB.
12686         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12687         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12688
12689 2008-04-07  Ian Lance Taylor  <iant@google.com>
12690
12691         * version.cc (version_string): Set to "1.5".
12692
12693         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12694         Add issued_non_pic_error_ field.  Declare check_non_pic.
12695         (Target_x86_64::Scan::check_non_pic): New function.
12696         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12697         (Target_x86_64::Scan::global): Likewise.
12698
12699         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12700         addend parameter.  Change caller.  Handle merge sections.
12701         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12702         Address to Addend.  Don't add in the result of
12703         local_section_offset, pass down the addend and use the returned
12704         value.
12705         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12706         Update declarations of local_section_offset and symbol_value.
12707         * testsuite/two_file_test_1.cc (t18): New function.
12708         * testsuite/two_file_test_2.cc (f18): New function.
12709         * testsuite/two_file_test_main.cc (main): Call t18.
12710         * testsuite/two_file_test.h (t18, f18): Declare.
12711
12712         * configure.ac: Don't test for objdump, c++filt, or readelf.
12713         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12714         conditionals.
12715         (TEST_READELF): New variable.
12716         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12717         (check_PROGRAMS): Add two_file_strip_test.
12718         (two_file_strip_test): New target.
12719         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12720         (two_file_same_shared_strip_test_SOURCES): New variable.
12721         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12722         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12723         (two_file_same_shared_strip_test_LDADD): New variable.
12724         (two_file_shared_strip.so): New target.
12725         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12726         (ver_test_5.syms, ver_test_7.syms): Likewise.
12727         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12728         (strip_test_3.stdout): Use TEST_OBJDUMP.
12729         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12730
12731 2008-04-04  Cary Coutant  <ccoutant@google.com>
12732
12733         * symtab.h (Symbol::is_weak_undefined): New function.
12734         (Symbol::is_strong_undefined): New function.
12735         (Symbol::is_absolute): New function.
12736         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12737         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12738         absolute symbols.
12739         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12740         (weak_undef_test): New target.
12741         * testsuite/Makefile.in: Rebuild.
12742         * testsuite/weak_undef_file1.cc: New file.
12743         * testsuite/weak_undef_file2.cc: New file.
12744         * testsuite/weak_undef_test.cc: New file.
12745
12746 2008-04-03  Craig Silverstein  <csilvers@google.com>
12747
12748         * compressed_output.h (class Output_compressed_section): Use
12749         unsigned buffer.
12750         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12751         add zlib header.
12752         (zlib_compressed_suffix): Removed.
12753         (Output_compressed_section::set_final_data_size): Use unsigned
12754         buffers.
12755         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12756         Fix linker invocation.
12757         (flagstest_o_specialfile_and_compress_debug_sections):
12758         Likewise.
12759         * testsuite/Makefile.in: Regenerated.
12760
12761 2008-04-02  David S. Miller  <davem@davemloft.net>
12762
12763         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12764         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12765
12766 2008-04-02  Craig Silverstein  <csilvers@google.com>
12767
12768         * TODO: New file.
12769
12770 2008-04-02  Ian Lance Taylor  <iant@google.com>
12771
12772         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12773         parameters.  Update for new key type to views_.  Change all
12774         callers.
12775         (File_read::read): Adjust for byteshift in returned view.
12776         (File_read::add_view): New function, broken out of
12777         find_and_make_view.
12778         (File_read::make_view): New function, broken out of
12779         find_and_make_view.
12780         (File_read::find_or_make_view): Add offset and aligned
12781         parameters.  Rewrite accordingly.  Change all callers.
12782         (File_read::get_view): Add offset and aligned parameters.  Adjust
12783         for byteshift in return value.
12784         (File_read::get_lasting_view): Likewise.
12785         * fileread.h (class File_read): Update declarations.
12786         (class File_read::View): Add byteshift_ field.  Add byteshift to
12787         constructor.  Add byteshift method.
12788         * archive.h (Archive::clear_uncached_views): New function.
12789         (Archive::get_view): Add aligned parameter.  Change all callers.
12790         * object.h (Object::get_view): Add aligned parameter.  Change all
12791         callers.
12792         (Object::get_lasting_view): Likewise.
12793
12794         * fileread.cc (File_read::release): Don't call clear_views if
12795         there are multiple objects.
12796         * fileread.h (File_read::clear_uncached_views): New function.
12797         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
12798         on the archive.
12799
12800 2008-03-31  Cary Coutant  <ccoutant@google.com>
12801
12802         Add thin archive support.
12803         * archive.cc (Archive::armagt): New const.
12804         (Archive::setup): Remove task parameter and calls to unlock.
12805         (Archive::unlock_nested_archives): New function.
12806         (Archive::read_header): Add nested_off parameter. Change
12807         all callers.
12808         (Archive::interpret_header): Likewise.
12809         (Archive::include_all_members): Change to handle thin
12810         archives.
12811         (Archive::include_member): Likewise.
12812         * archive.h (Archive::Archive): Add new parameters and
12813         initializers.
12814         (Archive::armagt): New const.
12815         (Archive::setup): Remove task parameter.
12816         (Archive::unlock_nested_archives): New function.
12817         (Archive::read_header): Add nested_off parameter.
12818         (Archive::interpret_header): Likewise.
12819         (Archive::Nested_archive_table): New typedef.
12820         (Archive::is_thin_archive_): New field.
12821         (Archive::nested_archives_): New field.
12822         (Archive::options_): New field.
12823         (Archive::dirpath_): New field.
12824         (Archive::task_): New field.
12825         * readsyms.cc (Read_symbols::do_read_symbols): Add check
12826         for thin archives.  Pass additional parameters to
12827         Archive::Archive.  Unlock the archive file after calling
12828         Archive::setup.
12829
12830 2008-03-29  Ian Lance Taylor  <iant@google.com>
12831
12832         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
12833         version symbol to be local.
12834         * testsuite/ver_test_4.sh: New file.
12835         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
12836         (check_DATA): Add ver_test_4.syms.
12837         (ver_test_4.syms): New target.
12838         * testsuite/Makefile.in: Rebuild.
12839
12840         * output.cc
12841         (Output_section::Input_section_sort_entry::has_priority): New
12842         function.
12843         (Output_section::Input_section_sort_entry::match_file_name): New
12844         function.
12845         (Output_section::Input_section_sort_entry::match_section_name):
12846         Remove.
12847         (Output_section::Input_section_sort_entry::match_section_name_prefix):
12848         Remove.
12849         (Output_section::Input_section_sort_entry::match_section_file):
12850         Remove.
12851         (Output_section::Input_section_sort_compare::operator()): Rewrite
12852         using new Input_section_sort_entry functions.  Sort crtbegin and
12853         crtend first.  Sort sections with no priority before sections with
12854         a priority.
12855         * testsuite/initpri1.c (d3): Check j != 4.
12856         (cd5): New constructor/destructor function.
12857         (main): Check j != 2.
12858
12859         * symtab.cc (Symbol_table::add_from_object): If we don't use the
12860         new symbol when resolving, don't call set_is_default.
12861         * testsuite/ver_test_7.cc: New file.
12862         * testsuite/ver_test_7.sh: New file.
12863         * testsuite/Makefile.am (ver_test_7.so): New target.
12864         (ver_test_7.o): New target.
12865         (check_SCRIPTS): Add ver_test_7.sh.
12866         (check_DATA): Add ver_test_7.syms.
12867         (ver_test_7.syms): New target.
12868
12869 2008-03-28  Ian Lance Taylor  <iant@google.com>
12870
12871         * layout.cc (Layout::layout): If we see an input section with a
12872         name that needs sorting, set the must_sort flag for the output
12873         section.
12874         (Layout::make_output_section): If the name of the output section
12875         indicates that it might require sorting, set the may_sort flag.
12876         * output.h (Output_section::may_sort_attached_input_sections): New
12877         function.
12878         (Output_section::set_may_sort_attached_input_sections): New
12879         function.
12880         (Output_section::must_sort_attached_input_sections): New
12881         function.
12882         (Output_section::set_must_sort_attached_input_sections): New
12883         function.
12884         (class Output_section): Declare Input_section_sort_entry.  Define
12885         Input_section_sort_compare.  Declare
12886         sort_attached_input_sections.  Add new fields:
12887         may_sort_attached_input_sections_,
12888         must_sort_attached_input_sections_,
12889         attached_input_sections_are_sorted_.
12890         * output.cc (Output_section::Output_section): Initialize new
12891         fields.
12892         (Output_section::add_input_section): Add an entry to
12893         input_sections_ if may_sort or must_sort are true.
12894         (Output_section::set_final_data_size): Call
12895         sort_attached_input_sections if necessary.
12896         (Output_section::Input_section_sort_entry): Define new class.
12897         (Output_section::Input_section_sort_compare::operator()): New
12898         function.
12899         (Output_section::sort_attached_input_sections): New function.
12900         * configure.ac: Check whether the compiler supports constructor
12901         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
12902         * testsuite/initpri1.c: New file.
12903         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
12904         CONSTRUCTOR_PRIORITY.
12905         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
12906         (initpri1_LDFLAGS): New variable.
12907         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12908
12909 2008-03-27  Ian Lance Taylor  <iant@google.com>
12910
12911         * common.cc (Sort_commons::operator): Correct sorting algorithm.
12912         * testsuite/common_test_1.c: New file.
12913         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
12914         (common_test_1_SOURCES): New variable.
12915         (common_test_1_DEPENDENCIES): New variable.
12916         (common_test_1_LDFLAGS): New variable.
12917
12918         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
12919         and commons_ correctly when NAME/VERSION does not override
12920         NAME/NULL.
12921         * testsuite/ver_test_6.c: New file.
12922         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
12923         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
12924         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
12925
12926 2008-03-26  Ian Lance Taylor  <iant@google.com>
12927
12928         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
12929         of an undefined symbol from a version script.
12930         * testsuite/Makefile.am (ver_test_5.so): New target.
12931         (ver_test_5.o): New target.
12932         (check_SCRIPTS): Add ver_test_5.sh.
12933         (check_DATA): Add ver_test_5.syms.
12934         (ver_test_5.syms): New target.
12935         * testsuite/ver_test_5.cc: New file.
12936         * testsuite/ver_test_5.script: New file.
12937         * testsuite/ver_test_5.sh: New file.
12938         * Makefile.in, testsuite/Makefile.in: Rebuild.
12939
12940         PR gold/5986
12941         Fix problems building gold with gcc 4.3.0.
12942         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
12943         (gold_error_at_location, gold_warning_at_location): Use it.
12944         * configure.ac: Check whether we can compile and use a template
12945         function with a printf attribute.
12946         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
12947         when jumping over bytes.
12948         * object.cc: Instantiate Object::read_section_data.
12949         * debug.h: Include <cstring>
12950         * dwarf_reader.cc: Include <algorithm>
12951         * main.cc: Include <cstring>.
12952         * options.cc: Include <cstring>.
12953         * output.cc: Include <cstring>.
12954         * script.cc: Include <cstring>.
12955         * script.h: Include <string>.
12956         * symtab.cc: Include <cstring> and <algorithm>.
12957         * target-select.cc: Include <cstring>.
12958         * version.cc: Include <string>.
12959         * testsuite/testmain.cc: Include <cstdlib>.
12960         * configure, config.in: Rebuild.
12961
12962 2008-03-25  Ian Lance Taylor  <iant@google.com>
12963
12964         * options.cc: Include "../bfd/bfdver.h".
12965         (options::help): Print bug reporting address.
12966
12967         * version.cc (print_version): Adjust output for current value of
12968         BFD_VERSION_STRING.
12969
12970         * NEWS: New file.
12971
12972         * options.cc (options::help): Print list of supported targets.
12973         * target-select.h: Include <vector>.
12974         (class Target_selector): Make machine_, size_, and is_big_endian_
12975         fields const.  Add bfd_name_ and instantiated_target_ fields.
12976         (Target_selector::Target_selector): Add bfd_name parameter.
12977         (Target_selector::recognize): Make non-virtual, call
12978         do_recognize.
12979         (Target_selector::recognize_by_name): Make non-virtual, call
12980         do_recognize_by_name.
12981         (Target_selector::supported_names): New function.
12982         (Target_selector::bfd_name): New function.
12983         (Target_selector::do_instantiate_target): New pure virtual
12984         function.
12985         (Target_selector::do_recognize): New virtual function.
12986         (Target_selector::do_recognize_by_name): New virtual function.
12987         (Target_selector::instantiate_target): New private function.
12988         (supported_target_names): Declare.
12989         * target-select.cc (Target_selector::Target_selector): Update for
12990         new parameter and fields.
12991         (select_target_by_name): Check that the name matches before
12992         calling recognize_by_name.
12993         (supported_target_names): New function.
12994         * i386.cc (class Target_selector_i386): Update Target_selector
12995         constructor call.  Remove recognize and recognize_by_name.  Add
12996         do_instantiate_target.
12997         * x86_64.cc (class Target_selector_x86_64): Likewise.
12998         * testsuite/testfile.cc (class Target_selector_test): Update for
12999         changes to Target_selector.
13000
13001         * README: Rewrite, with some notes on unsupported features.
13002
13003 2008-03-24  Cary Coutant  <ccoutant@google.com>
13004
13005         * i386.cc (Target_i386::Got_type): New enum declaration.
13006         (Target_i386::Scan::local): Updated callers of Output_data_got
13007         member functions.
13008         (Target_i386::Scan::global): Likewise.
13009         (Target_i386::Relocate::relocate): Likewise.
13010         (Target_i386::Relocate::relocate_tls): Likewise.
13011         * object.h (Got_offset_list): New class.
13012         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13013         (Sized_relobj::local_got_offset): Likewise.
13014         (Sized_relobj::set_local_got_offset): Likewise.
13015         (Sized_relobj::local_has_tls_got_offset): Removed.
13016         (Sized_relobj::local_tls_got_offset): Removed.
13017         (Sized_relobj::set_local_tls_got_offset): Removed.
13018         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13019         * output.cc (Output_data_got::add_global): Added got_type parameter.
13020         (Output_data_got::add_global_with_rel): Likewise.
13021         (Output_data_got::add_global_with_rela): Likewise.
13022         (Output_data_got::add_global_pair_with_rel): New function.
13023         (Output_data_got::add_global_pair_with_rela): New function.
13024         (Output_data_got::add_local): Added got_type parameter.
13025         (Output_data_got::add_local_with_rel): Likewise.
13026         (Output_data_got::add_local_with_rela): Likewise.
13027         (Output_data_got::add_local_pair_with_rel): New function.
13028         (Output_data_got::add_local_pair_with_rela): New function.
13029         (Output_data_got::add_global_tls): Removed.
13030         (Output_data_got::add_global_tls_with_rel): Removed.
13031         (Output_data_got::add_global_tls_with_rela): Removed.
13032         (Output_data_got::add_local_tls): Removed.
13033         (Output_data_got::add_local_tls_with_rel): Removed.
13034         (Output_data_got::add_local_tls_with_rela): Removed.
13035         * output.h (Output_data_got::add_global): Added got_type parameter.
13036         (Output_data_got::add_global_with_rel): Likewise.
13037         (Output_data_got::add_global_with_rela): Likewise.
13038         (Output_data_got::add_global_pair_with_rel): New function.
13039         (Output_data_got::add_global_pair_with_rela): New function.
13040         (Output_data_got::add_local): Added got_type parameter.
13041         (Output_data_got::add_local_with_rel): Likewise.
13042         (Output_data_got::add_local_with_rela): Likewise.
13043         (Output_data_got::add_local_pair_with_rel): New function.
13044         (Output_data_got::add_local_pair_with_rela): New function.
13045         (Output_data_got::add_global_tls): Removed.
13046         (Output_data_got::add_global_tls_with_rel): Removed.
13047         (Output_data_got::add_global_tls_with_rela): Removed.
13048         (Output_data_got::add_local_tls): Removed.
13049         (Output_data_got::add_local_tls_with_rel): Removed.
13050         (Output_data_got::add_local_tls_with_rela): Removed.
13051         * resolve.cc (Symbol::override_base_with_special): Removed
13052         reference to has_got_offset_ field.
13053         * symtab.cc (Symbol::init_fields): Replaced initialization
13054         of got_offset_ with got_offsets_.  Removed initialization
13055         of has_got_offset_
13056         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13057         (Symbol::got_offset): Likewise.
13058         (Symbol::set_got_offset): Likewise.
13059         (Symbol::has_tls_got_offset): Removed.
13060         (Symbol::tls_got_offset): Removed.
13061         (Symbol::set_tls_got_offset): Removed.
13062         (Symbol::got_offset_): Removed.
13063         (Symbol::tls_mod_got_offset_): Removed.
13064         (Symbol::tls_pair_got_offset_): Removed.
13065         (Symbol::got_offsets_): New field.
13066         (Symbol::has_got_offset): Removed.
13067         (Symbol::has_tls_mod_got_offset): Removed.
13068         (Symbol::has_tls_pair_got_offset): Removed.
13069         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13070         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13071         member functions.
13072         (Target_x86_64::Scan::global): Likewise.
13073         (Target_x86_64::Relocate::relocate): Likewise.
13074         (Target_x86_64::Relocate::relocate_tls): Likewise.
13075
13076 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13077
13078         * yyscript.y: Fix spelling error in comment.
13079
13080 2008-03-24  Ian Lance Taylor  <iant@google.com>
13081
13082         * options.h (class General_options): Define build_id option.
13083         * layout.h (class Layout): Declare write_build_id, create_note,
13084         create_build_id.  Add build_id_note_ member.
13085         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13086         "libiberty.h", "md5.h", "sha1.h".
13087         (Layout::Layout): Initialize eh_frame_data_,
13088         eh_frame_hdr_section_, and build_id_note_.
13089         (Layout::finalize): Call create_build_id.
13090         (Layout::create_note): New function, broken out of
13091         Layout::create_gold_note.
13092         (Layout::create_gold_note): Call create_note.
13093         (Layout::create_build_id): New function.
13094         (Layout::write_build_id): New function.
13095         (Close_task_runner::run): Call write_build_id.
13096
13097         * x86_64.cc: Correct license to GPLv3.
13098
13099 2008-03-23  Ian Lance Taylor  <iant@google.com>
13100
13101         * options.cc: Include "demangle.h".
13102         (parse_optional_string): New function.
13103         (parse_long_option): Handle takes_optional_argument.
13104         (parse_short_option): Update dash_z initializer.  Handle
13105         takes_optional_argument.
13106         (General_options::General_options): Initialize do_demangle_.
13107         (General_options::finalize): Set do_demangle_.  Handle demangling
13108         style.
13109         * options.h (parse_optional_string): Declare.
13110         (struct One_option): Add optional_arg field.  Update constructor.
13111         Update call constructor calls.  Add takes_optional_argument
13112         function.
13113         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13114         (DEFINE_optional_string): Define.
13115         (General_options::demangle): Change from DEFINE_bool to
13116         DEFINE_optional_string.
13117         (General_options::no_demangle): New function.
13118         (General_options::do_demangle): New function.
13119         (General_options::set_do_demangle): New function.
13120         (General_options::execstack_status_): Move definition to end of
13121         class definition.
13122         (General_options::static_): Likewise.
13123         (General_options::do_demangle_): New field.
13124         * object.cc (big_endian>::get_symbol_location_info): Call
13125         Options::do_demangle, not Options::demangle.
13126         * symtab.cc (demangle): Likewise.
13127
13128 2008-03-22  Ian Lance Taylor  <iant@google.com>
13129
13130         * gold.h: Include <cstddef> and <sys/types.h>
13131         * options.h: Include <cstring>.
13132
13133 2008-03-21  Ian Lance Taylor  <iant@google.com>
13134
13135         * Added source code to GNU binutils.