]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/binutils-tumbl.git/blob - gold/ChangeLog
Change cond. branching to BRC/BRCI and add CLZ instruction
[fpga/lx-cpu1/binutils-tumbl.git] / gold / ChangeLog
1 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2
3         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
4         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
5         * aclocal.m4: Regenerate.
6         * configure: Regenerate.
7         * Makefile.in: Regenerate.
8         * testsuite/Makefile.in: Regenerate.
9
10 2012-12-07  Roland McGrath  <mcgrathr@google.com>
11
12         * testsuite/binary_unittest.cc (Sized_binary_test):
13         Use open_descriptor rather than ::open.
14
15 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
16
17         PR gold/14858
18         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
19
20 2012-11-14  Roland McGrath  <mcgrathr@google.com>
21
22         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
23         than bfc instruction for data sandboxing.
24
25 2012-11-07  Roland McGrath  <mcgrathr@google.com>
26
27         * i386.cc (Target_i386::relocate_for_relocatable): Remove extraneous
28         typename from last change.
29
30         * target.h (Sized_target::relocate_for_relocatable): Use Elf_Off
31         for offset_in_output_section parameter.
32         (Sized_target::relocate_special_relocatable): Likewise.
33         * arm.cc (Target_arm::relocate_for_relocatable): Likewise.
34         (Target_arm::relocate_special_relocatable): Likewise.
35         * i386.cc (Target_i386::relocate_for_relocatable): Likewise.
36         * powerpc.cc (Target_powerpc::relocate_for_relocatable): Likewise.
37         * sparc.cc (Target_sparc::relocate_for_relocatable): Likewise.
38         * target-reloc.h (relocate_for_relocatable): Likewise.
39         * testsuite/testfile.cc (Target_test): Likewise.
40         * tilegx.cc (Target_tilegx::relocate_for_relocatable): Likewise.
41         * x86_64.cc (Target_x86_64::relocate_for_relocatable): Likewise.
42
43         * gold.h: Move inclusion of <clocale> to after <libintl.h> in
44         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
45
46         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
47         parameter, which is unused in the [!F_SETFD] case.
48
49         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
50         SYMNDX to off_t before comparing it to this->data_size().
51         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
52         * incremental.cc (Output_section_incremental_inputs::do_write):
53         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
54
55         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
56
57 2012-11-05  Alan Modra  <amodra@gmail.com>
58
59         * configure.ac: Apply 2012-09-10 change to config.in here.
60
61 2012-09-10  Matthias Klose  <doko@ubuntu.com>
62
63         * config.in: Disable sanity check for kfreebsd.
64
65 2012-08-09  Nick Clifton  <nickc@redhat.com>
66
67         * po/vi.po: Updated Vietnamese translation.
68
69 2012-07-30  Nick Clifton  <nickc@redhat.com>
70
71         * po/gold.pot: Updated template.
72         * po/es.po: Updated Spanish translation.
73
74 2012-07-18  Cary Coutant  <ccoutant@google.com>
75
76         PR gold/14344
77         * configure.ac: Add check for -gpubnames support.
78         * configure: Regenerate.
79         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
80         support; force -gno-pubnames.
81         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
82         support.
83         (gdb_index_test_4): New test.
84         * testsuite/Makefile.in: Regenerate.
85         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
86         * testsuite/gdb_index_test_2.sh: Likewise.
87         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
88         * testsuite/gdb_index_test_4.sh: New script.
89         * testsuite/gdb_index_test_comm.sh: New script with common code;
90         don't look for space after colon.
91
92 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
93
94         * gold.cc (queue_middle_tasks): Update function order only after
95         deferred objects due to plugins are processed.
96
97 2012-07-11  Ian Lance Taylor  <iant@google.com>
98
99         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
100         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
101         (Target_arm::scan_reloc_for_stub): Likewise.
102         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
103         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
104         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
105         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
106         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
107
108 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
109             Ian Lance Taylor  <iant@google.com>
110
111         PR gold/14309
112         * configure.ac: Test whether std::tr1::hash<off_t> works.
113         * gold.h: Add a specialization for std::tr1::hash<off_t> if
114         needed.
115         * output.h (class Output_fill): Add virtual destructor.
116         * configure, config.in: Rebuild.
117
118 2012-06-22  Roland McGrath  <mcgrathr@google.com>
119
120         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
121
122 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
123
124         * plugin.cc (Plugin::load): Handle position independent executables.
125
126 2012-06-06  Cary Coutant  <ccoutant@google.com>
127
128         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
129         add .debug_macro.
130         (lines_only_debug_sections): Likewise.
131         (gdb_fast_lookup_sections): New static array.
132         (is_gdb_debug_section): Rename formal parameter.
133         (is_lines_only_debug_section): Likewise.
134         (is_gdb_fast_lookup_section): New function.
135         (Layout::include_section): Check for ".zdebug_" prefix; pass
136         section name suffix to is_gdb_debug_section, et al.; check for
137         fast-lookup sections when building .gdb_index.
138         * options.h (--strip-debug-gdb): Update GDB version number.
139
140 2012-06-06  Cary Coutant  <ccoutant@google.com>
141
142         * configure.ac: Add check for fallocate.
143         * configure: Regenerate.
144         * config.in: Regenerate.
145
146         * options.h (class General_options): Add --mmap-output-file and
147         --posix-fallocate options.
148         * output.cc: (posix_fallocate): Remove; replace with...
149         (gold_fallocate): New function.
150         (Output_file::map_no_anonymous): Call gold_fallocate.
151         (Output_file::map): Check --mmap-output-file option.
152
153 2012-06-05  Jing Yu  <jingyu@google.com>
154
155         * gold.h (textdomain): Add do {} to empty while(0).
156         (bindtextdomain): Likewise.
157
158 2012-06-04  Cary Coutant  <ccoutant@google.com>
159
160         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
161         has_dynsym_index.
162
163 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
164
165         * symtab.cc (Symbol_table::define_special_symbol):
166         Initialize *poldsym to prevent uninitialized variable errors.
167
168 2012-05-23  Cary Coutant  <ccoutant@google.com>
169
170         * layout.cc (Layout::section_name_mapping): Add rules to handle
171         exact match on .data.rel.ro.local or .data.rel.ro.
172         (Layout::output_section_name): Check for exact matches.
173
174 2012-05-23  Cary Coutant  <ccoutant@google.com>
175
176         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
177         more carefully.
178
179 2012-05-22  Cary Coutant  <ccoutant@google.com>
180
181         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
182         object before exporting symbol.
183
184 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
185
186         * testsuite/tls_test.cc: Include "config.h" first.
187         * testsuite/tls_test_c.c: Likewise.
188
189 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
190             Nick Clifton  <nickc@redhat.com>
191
192         PR 14072
193         * configure.in: Add check that sysdep.h has been included before
194         any system header files.
195         * configure: Regenerate.
196         * config.in: Regenerate.
197
198 2012-05-14  Cary Coutant  <ccoutant@google.com>
199
200         * layout.cc (Layout::make_output_section): Mark .tdata section
201         as RELRO.
202         * testsuite/relro_test.cc: Add a TLS variable.
203
204 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
205
206         PR gold/14091
207         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
208         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
209         R_X86_64_64.
210
211 2012-05-08  Cary Coutant  <ccoutant@google.com>
212
213         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
214         (lines_only_debug_sections): Likewise.
215
216 2012-05-02  Roland McGrath  <mcgrathr@google.com>
217
218         * nacl.cc: New file.
219         * nacl.h: New file.
220         * Makefile.am (CCFILES, HFILES): Add them.
221         * Makefile.in: Regenerate.
222         * i386.cc (Output_data_plt_i386_nacl): New class.
223         (Output_data_plt_i386_nacl_exec): New class.
224         (Output_data_plt_i386_nacl_dyn): New class.
225         (Target_i386_nacl): New class.
226         (Target_selector_i386_nacl): New class.
227         (target_selector_i386): Use it instead of Target_selector_i386.
228         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
229         (Target_x86_64_nacl): New class.
230         (Target_selector_x86_64_nacl): New class.
231         (target_selector_x86_64, target_selector_x32): Use it instead of
232         Target_selector_x86_64.
233         * arm.cc (Output_data_plt_arm_nacl): New class.
234         (Target_arm_nacl): New class.
235         (Target_selector_arm_nacl): New class.
236         (target_selector_arm, target_selector_armbe): Use it instead of
237         Target_selector_arm.
238
239         * target-select.cc (select_target): Take new Input_file* and off_t
240         arguments, pass them on to recognize method of selector.
241         * object.cc (make_elf_sized_object): Update caller.
242         * parameters.cc (parameters_force_valid_target): Likewise.
243         * incremental.cc (make_sized_incremental_binary): Likewise.
244         * target-select.h: Update decl.
245         (Target_selector::recognize): Take new Input_file* argument,
246         pass it on to do_recognize.
247         (Target_selector::do_recognize): Take new Input_file* argument.
248         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
249         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
250         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
251         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
252
253         * target.h (Target::Target_info): New members isolate_execinstr
254         and rosegment_gap.
255         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
256         * arm.cc (Target_arm::arm_info): Update initializer.
257         * i386.cc (Target_i386::i386_info): Likewise.
258         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
259         * sparc.cc (Target_sparc::sparc_info): Likewise.
260         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
261         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
262         * layout.cc (Layout::attach_allocated_section_to_segment):
263         Take new const Target* argument.  If target->isolate_execinstr(), act
264         like --rosegment.
265         (Layout::find_first_load_seg): Take new const Target* argument;
266         if target->isolate_execinstr(), reject PF_X segments.
267         (Layout::relaxation_loop_body): Update caller.
268         (Layout::set_segment_offsets): If target->isolate_execinstr(),
269         reset file offset to zero when we hit LOAD_SEG, and then do a second
270         loop over the segments before LOAD_SEG to reassign offsets after
271         addresses have been determined.  Handle target->rosegment_gap().
272         (Layout::attach_section_to_segment): Take new const Target* argument;
273         pass it to attach_allocated_section_to_segment.
274         (Layout::make_output_section): Update caller.
275         (Layout::attach_sections_to_segments): Take new const Target* argument;
276         pass it to attach_section_to_segment.
277         * gold.cc (queue_middle_tasks): Update caller.
278         * layout.h (Layout): Update method decls with new arguments.
279
280         * arm.cc (Target_arm::Target_arm): Take optional argument for the
281         Target_info pointer to use.
282         (Target_arm::do_make_data_plt): New virtual method.
283         (Target_arm::make_data_plt): New method that calls it.
284         (Target_arm::make_plt_entry): Use it.
285         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
286         for the section alignment.
287         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
288         method.
289         (Output_data_plt_arm::first_plt_entry_offset): Call it.
290         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
291         method.
292         (Output_data_plt_arm::get_plt_entry_size): Call it.
293         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
294         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
295         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
296         method.
297         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
298         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
299         method instead of sizeof(plt_entry).
300         (Output_data_plt_arm::add_entry): Likewise.
301         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
302         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
303         than static method.
304         (Target_arm::plt_entry_size): Likewise.
305         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
306         Move to ...
307         (Output_data_plt_arm_standard): ... here, new class.
308         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
309         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
310         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
311
312         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
313         Take additional argument for the PLT entry size.
314         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
315         Use get_plt_entry_size method rather than plt_entry_size variable.
316         (Output_data_plt_x86_64::reserve_slot): Likewise.
317         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
318         (Output_data_plt_x86_64::add_entry): Likewise.
319         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
320         (Output_data_plt_x86_64::address_for_global): Likewise.
321         (Output_data_plt_x86_64::address_for_local): Likewise.
322         (Output_data_plt_x86_64::set_final_data_size): Likewise.
323         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
324         Make method non-static.
325         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
326         method.
327         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
328         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
329         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
330         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
331         virtual method.
332         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
333         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
334         virtual method.
335         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
336         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
337         virtual method.
338         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
339         (Output_data_plt_x86_64::plt_entry_size)
340         (Output_data_plt_x86_64::first_plt_entry)
341         (Output_data_plt_x86_64::plt_entry)
342         (Output_data_plt_x86_64::tlsdesc_plt_entry)
343         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
344         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
345         (Output_data_plt_x86_64_standard): ... here, new class.
346         (Target_x86_64::Target_x86_64): Take optional argument for the
347         Target_info pointer to use.
348         (Target_x86_64::do_make_data_plt): New virtual method.
349         (Target_x86_64::make_data_plt): New method to call it.
350         (Target_x86_64::init_got_plt_for_update): Use that.
351         Call this->plt_->add_eh_frame method here.
352         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
353         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
354         rather than static method.
355         (Target_x86_64::plt_entry_size): Likewise.
356         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
357         rather than plt_entry_size variable.  Move guts of PLT filling to...
358         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
359         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
360         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
361
362         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
363         additional argument for the section alignment.
364         Don't do add_eh_frame_for_plt here.
365         (Output_data_plt_i386::first_plt_entry_offset): Make the method
366         non-static.  Use get_plt_entry_size method rather than plt_entry_size
367         variable.
368         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
369         method.
370         (Output_data_plt_i386::get_plt_entry_size): Call it.
371         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
372         (Output_data_plt_i386::add_eh_frame): New method to call it.
373         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
374         method.
375         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
376         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
377         method.
378         (Output_data_plt_i386::fill_plt_entry): New method to call it.
379         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
380         method instead of plt_entry_size.
381         (Output_data_plt_i386::plt_entry_size)
382         (Output_data_plt_i386::plt_eh_frame_fde_size)
383         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
384         (Output_data_plt_i386_standard): ... here, new class.
385         (Output_data_plt_i386_exec): New class.
386         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
387         (Output_data_plt_i386_exec::first_plt_entry): ... here.
388         (Output_data_plt_i386::exec_plt_entry): Move to ...
389         (Output_data_plt_i386_exec::plt_entry): ... here.
390         (Output_data_plt_i386_dyn): New class.
391         (Output_data_plt_i386::first_plt_entry): Move to ...
392         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
393         (Output_data_plt_i386::dyn_plt_entry): Move to ...
394         (Output_data_plt_i386_dyn::plt_entry): ... here.
395         (Target_i386::Target_i386): Take optional argument for the Target_info
396         pointer to use.
397         (Target_i386::do_make_data_plt): New virtual method.
398         (Target_i386::make_data_plt): New method to call it.
399         (Target_i386::make_plt_section): Use that.
400         Call this->plt_->add_eh_frame method here.
401         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
402         rather than plt_entry_size variable.
403         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
404         (Output_data_plt_i386::address_for_local): Likewise.
405         (Output_data_plt_i386::do_write): Likewise.
406         Move guts of PLT filling to...
407         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
408         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
409         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
410         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
411
412 2012-05-01  Cary Coutant  <ccoutant@google.com>
413
414         * dwarf_reader.cc (Dwarf_die::read_attributes)
415         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
416         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
417         * reduced_debug_output.cc
418         (Output_reduced_debug_info_section::get_die_end): Remove
419         DW_FORM_GNU_ref_index.  Add default case.
420
421 2012-04-26  Mark Wielaard  <mjw@redhat.com>
422
423         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
424         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
425         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
426         DW_AT_high_pc as offset from DW_AT_low_pc.
427
428         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
429         * testsuite/Makefile.in: Regenerate.
430         * testsuite/gdb_index_test_3.c: New test source file.
431         * testsuite/gdb_index_test_3.sh: New test source file.
432
433 2012-04-25  Ian Lance Taylor  <iant@google.com>
434
435         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
436         pointer.
437         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
438         as a class, not a struct.
439         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
440         (Target_arm::apply_cortex_a8_workaround): Likewise.
441         * gc.h: Declare Reloc_types as a struct, not a class.
442         * object.h: Declare Symbols_data as a struct.
443         * reloc.h: Declare Read_relocs_data as a struct.
444         * target.h: Declare Relocate_info as a struct.
445
446 2012-04-24  David S. Miller  <davem@davemloft.net>
447
448         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
449         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
450         and R_SPARC_WPLT30.
451
452 2012-04-24  Cary Coutant  <ccoutant@google.com>
453
454         * incremental-dump.cc (find_input_containing_global): Replace
455         magic number with symbolic constant.
456         (dump_incremental_inputs): Update version number.
457         * incremental.cc (Output_section_incremental_inputs): Update version
458         number; import symbolic constants from Incremental_inputs_reader.
459         (Incremental_inputs::create_data_sections): Align relocations
460         section correctly for 64-bit targets.
461         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
462         constants; add padding.
463         (Output_section_incremental_inputs::write_header): Add assert for
464         header_size.
465         (Output_section_incremental_inputs::write_input_files): Add assert
466         for input_entry_size.
467         (Output_section_incremental_inputs::write_info_blocks): Add padding;
468         add assert for object_info_size, input_section_entry_size,
469         global_sym_entry_size.
470         * incremental.h (Incremental_inputs_reader): Add symbolic constants
471         for data structure sizes; use them.
472         (Incremental_input_entry_reader): Import symbolic constants from
473         Incremental_inputs_reader; use them.
474
475 2012-04-23  David S. Miller  <davem@davemloft.net>
476
477         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
478         and elf_flags_set_.
479         (Target_sparc::Target_sparc): Initialize new fields.
480         (Target_sparc::do_make_elf_object): New function.
481         (Target_sparc::do_adjust_elf_header): New function.
482
483 2012-04-23  Cary Coutant  <ccoutant@google.com>
484
485         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
486         CU range table of gdb index.
487
488 2012-04-20  David S. Miller  <davem@davemloft.net>
489
490         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
491         instead of false.
492
493 2012-04-16  David S. Miller  <davem@davemloft.net>
494
495         * sparc.cc (Target_sparc::got_address): New function.
496         (Sparc_relocate_functions::gdop_hix22): New function.
497         (Sparc_relocate_functions::gdop_lox10): New function.
498         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
499         relocs.
500         (Target_sparc::Scan::local): Likewise if the global symbol is not
501         preemptible and is not IFUNC.
502         (Target_sparc::Relocate::relocate): Perform GOTDATA code
503         transformations for local and non-preemptible non-IFUNC global
504         symbols.
505
506         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
507         writing out 64-bit part of ranges.
508
509         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
510         -fpic and -fpie respectively.
511         * Makefile.in: Regenerate.
512
513         * sparc.cc (class Target_sparc): Add rela_ifunc_.
514         (Target_sparc::Target_sparc): Initialize new field.
515         (Target_sparc::do_plt_section_for_global): New function.
516         (Target_sparc::do_plt_section_for_local): New function.
517         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
518         (Target_sparc::make_plt_section): New function, broken out of
519         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
520         (Target_sparc::make_plt_entry): Call make_plt_section.
521         (Target_sparc::make_local_ifunc_plt_entry): New function.
522         (Target_sparc::rela_ifunc_section): New function.
523         (Target_sparc::plt_section): Remove const.
524         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
525         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
526         and ifunc_count_ fields.
527         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
528         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
529         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
530         (Output_data_plt_sparc::rela_ifunc): New function.
531         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
532         (Output_data_plt_sparc::has_ifunc_section): New function.
533         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
534         (Output_data_plt_sparc::address_for_global): New function.
535         (Output_data_plt_sparc::address_for_local): New function.
536         (Output_data_plt_sparc::plt_index_to_offset): New function.
537         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
538         and entry_count.
539         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
540         entry_count.
541         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
542         R_SPARC_JMP_IREL to switch.
543         (Target_sparc::Scan::check_non_pic): Likewise.
544         (Target_sparc::Scan::local): Handle IFUNC symbols.
545         (Target_sparc::Scan::local): Likewise.
546         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
547         and plt_address_for_local.
548         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
549         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
550
551         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
552         (class Output_data_reloc): Adjust calls to Output_reloc_type.
553         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
554         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
555         global relocs too.
556         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
557         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
558         calls.
559         * sparc.cc (Target_sparc::Scan::global): Likewise.
560         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
561
562 2012-04-16  Cary Coutant  <ccoutant@google.com>
563
564         * archive.cc (Library_base::should_include_member): Check for
565         --export-dynamic-symbol.
566         * options.h (class General_options): Add --export-dynamic-symbol.
567         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
568         --export-dynamic-symbol.
569         (Symbol_table::gc_mark_undef_symbols): Likewise.
570         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
571
572 2012-04-12  David S. Miller  <davem@davemloft.net>
573
574         * sparc.cc (Reloc::wdisp10): New relocation method.
575         (Reloc::h34): Likewise.
576         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
577         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
578         R_SPARC_WDISP10.
579         (Target_sparc::Scan::local): Likewise.
580         (Target_sparc::Scan::global): Likewise.
581         (Target_sparc::Relocate::relocate): Likewise.
582
583 2012-04-09  Cary Coutant  <ccoutant@google.com>
584
585         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
586         low_pc == 0.
587
588 2012-04-06  Ian Lance Taylor  <iant@google.com>
589
590         * timer.cc: #include <unistd.h>.
591
592 2012-04-06  Roland McGrath  <mcgrathr@google.com>
593
594         * configure.in (AC_CHECK_HEADERS): Add locale.h.
595         * config.in: Regenerate.
596         * configure: Regenerate.
597
598 2012-04-05  Nick Clifton  <nickc@redhat.com>
599
600         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
601         (AM_LC_MESSAGES): Add.
602         * aclocal.m4: Regenerate.
603         * config.in: Regenerate.
604         * configure: Regenerate.
605
606 2012-03-21  Cary Coutant  <ccoutant@google.com>
607
608         * Makefile.am: Add gdb-index.cc, gdb-index.h.
609         * Makefile.in: Regenerate.
610         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
611         (Sized_elf_reloc_mapper::symbol_section): New function.
612         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
613         (make_elf_reloc_mapper): New function.
614         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
615         (Dwarf_abbrev_table::do_read_abbrevs): New function.
616         (Dwarf_abbrev_table::do_get_abbrev): New function.
617         (Dwarf_ranges_table::read_ranges_table): New function.
618         (Dwarf_ranges_table::read_range_list): New function.
619         (Dwarf_pubnames_table::read_section): New function.
620         (Dwarf_pubnames_table::read_header): New function.
621         (Dwarf_pubnames_table::next_name): New function.
622         (Dwarf_die::Dwarf_die): New function.
623         (Dwarf_die::read_attributes): New function.
624         (Dwarf_die::skip_attributes): New function.
625         (Dwarf_die::set_name): New function.
626         (Dwarf_die::set_linkage_name): New function.
627         (Dwarf_die::attribute): New function.
628         (Dwarf_die::string_attribute): New function.
629         (Dwarf_die::int_attribute): New function.
630         (Dwarf_die::uint_attribute): New function.
631         (Dwarf_die::ref_attribute): New function.
632         (Dwarf_die::child_offset): New function.
633         (Dwarf_die::sibling_offset): New function.
634         (Dwarf_info_reader::check_buffer): New function.
635         (Dwarf_info_reader::parse): New function.
636         (Dwarf_info_reader::do_parse): New function.
637         (Dwarf_info_reader::do_read_string_table): New function.
638         (Dwarf_info_reader::lookup_reloc): New function.
639         (Dwarf_info_reader::get_string): New function.
640         (Dwarf_info_reader::visit_compilation_unit): New function.
641         (Dwarf_info_reader::visit_type_unit): New function.
642         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
643         Sized_elf_reloc_mapper.
644         (Sized_dwarf_line_info::symbol_section): Remove function.
645         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
646         (Sized_dwarf_line_info::read_line_mappings): Remove object
647         parameter, adjust callers.
648         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
649         * dwarf_reader.h: Include <sys/types.h>.
650         (class Track_relocs): Remove forward declaration.
651         (class Elf_reloc_mapper): New class.
652         (class Sized_elf_reloc_mapper): New class.
653         (class Dwarf_abbrev_table): New class.
654         (class Dwarf_range_list): New class.
655         (class Dwarf_ranges_table): New class.
656         (class Dwarf_pubnames_table): New class.
657         (class Dwarf_die): New class.
658         (class Dwarf_info_reader): New class.
659         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
660         (Sized_dwarf_line_info::symbol_section): Remove member function.
661         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
662         base class.
663         * gdb-index.cc: New source file.
664         * gdb-index.h: New source file.
665         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
666         and .debug_types sections, call Layout::add_to_gdb_index.
667         (Sized_relobj_incr::do_section_name): Implement.
668         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
669         return type; Implement.
670         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
671         return type.
672         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
673         parameter list and return type.
674         (Sized_incr_dynobj::do_section_contents): Likewise.
675         * layout.cc: Include gdb-index.h.
676         (Layout::Layout): Initialize gdb_index_data_.
677         (Layout::init_fixed_output_section): Check for .gdb_index section.
678         (Layout::add_to_gdb_index): New function. Instantiate.
679         * layout.h: Add forward declaration for class Gdb_index.
680         (Layout::add_to_gdb_index): New member function.
681         (Layout::gdb_index_data_): New data member.
682         * main.cc: Include gdb-index.h.
683         (main): Print statistics for gdb index.
684         * object.cc (Object::section_contents): Move code into
685         do_section_contents.
686         (need_decompressed_section): Check for sections needed when building
687         gdb index.
688         (build_compressed_section_map): Likewise.
689         (Sized_relobj_file::do_read_symbols): Need local symbols when building
690         gdb index.
691         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
692         sections; call Layout::add_to_gdb_index.
693         (Sized_relobj_file::do_decompressed_section_contents): Call
694         do_section_contents directly.
695         * object.h (Object::do_section_contents): Adjust parameter list and
696         return type.
697         (Object::do_decompressed_section_contents): Call do_section_contents
698         directly.
699         (Sized_relobj_file::do_section_contents): Adjust parameter list and
700         return type.
701         * options.h (class General_options): Add --gdb-index option.
702         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
703         list and return type.
704         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
705         * reloc.h (Track_relocs::checkpoint): New function.
706         (Track_relocs::reset): New function.
707
708         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
709         New test cases.
710         * testsuite/Makefile.in: Regenerate.
711         * testsuite/gdb_index_test.cc: New test source file.
712         * testsuite/gdb_index_test_1.sh: New test source file.
713         * testsuite/gdb_index_test_2.sh: New test source file.
714
715 2012-03-19  Doug Kwan  <dougkwan@google.com>
716
717         * arm.cc (Target_arm::do_define_standard_symbols): New method.
718         (Target_arm::do_finalize_sections): Remove code which defines
719         __exidx_start and __exidx_end.  Make symbol table parameter
720         anonymous as it is not used.
721         * gold.cc (queue_middle_tasks): Call target hook to define any
722         target-specific symbols.
723         * target.h (Target::define_standard_symbols): New method.
724         (Target::do_define_standard_symbols): Same.
725         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
726         * testsuite/Makefile.in: Regenerate.
727         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
728         and __exidx_end.
729         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
730         relocations are generated for __exidx_start and __exidx_end.
731
732 2012-03-16  Doug Kwan  <dougkwan@google.com>
733
734         * testsuite/Makefile.am: Disable test initpri3b.
735         * testsuite/Makefile.in: Regenerate.
736
737 2012-03-15  Doug Kwan  <dougkwan@google.com>
738
739         * arm.cc (Target_arm::got_section): Make .got section read-only
740         if -z now is given.
741
742 2012-03-15  Ian Lance Taylor  <iant@google.com>
743
744         PR gold/13850
745         * layout.cc (Layout::make_output_section): Correctly mark
746         SHT_INIT_ARRAY, et. al., as relro.
747
748 2012-03-14  Doug Kwan  <dougkwan@google.com>
749
750         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
751         dynamic relocations for protected symbols in shared objects.
752
753 2012-03-13  Ian Lance Taylor  <iant@google.com>
754
755         * resolve.cc (Symbol_table::resolve): When merging common symbols,
756         keep the larger alignment.
757
758 2012-03-12  Cary Coutant  <ccoutant@google.com>
759
760         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
761         handling of DW_LNE_define_file.
762
763 2012-03-12  Cary Coutant  <ccoutant@google.com>
764
765         * reduced_debug_output.cc
766         (Output_reduced_debug_info_section::get_die_end): Add new FORM
767         codes to switch.
768
769 2012-02-29  Cary Coutant  <ccoutant@google.com>
770
771         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
772
773 2012-02-29  Cary Coutant  <ccoutant@google.com>
774
775         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
776         Call Object::decompressed_section_contents.
777         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
778         New dtor.
779         (Sized_dwarf_line_info::buffer_start_): New data member.
780         * merge.cc (Output_merge_data::do_add_input_section): Call
781         Object::decompressed_section_contents.
782         (Output_merge_string::do_add_input_section): Likewise.
783         * object.cc (need_decompressed_section): New function.
784         (build_compressed_section_map): Decompress sections needed later.
785         (Sized_relobj_file::do_decompressed_section_contents): New function.
786         (Sized_relobj_file::do_discard_decompressed_sections): New function.
787         * object.h (Object::decompressed_section_contents): New function.
788         (Object::discard_decompressed_sections): New function.
789         (Object::do_decompressed_section_contents): New function.
790         (Object::do_discard_decompressed_sections): New function.
791         (Compressed_section_info): New type.
792         (Compressed_section_map): Include decompressed section contents.
793         (Sized_relobj_file::do_decompressed_section_contents): New function.
794         (Sized_relobj_file::do_discard_decompressed_sections): New function.
795
796 2012-02-16  Cary Coutant  <ccoutant@google.com>
797
798         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
799         * testsuite/Makefile.in: Regenerate.
800
801 2012-02-14  Cary Coutant  <ccoutant@google.com>
802
803         * options.cc (General_options::finalize): Disallow -pie and -static.
804
805 2012-02-03  Doug Kwan  <dougkwan@google.com>
806
807         * arm.cc (Arm_relocate_functions::abs8,
808         Arm_relocate_functions::abs16): Use
809         Bits::has_signed_unsigned_overflow32.
810         (Arm_relocate_functions::thm_abs8): Correct range of
811         overflow check.
812         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
813         in assertions.
814
815 2012-02-02  Doug Kwan  <dougkwan@google.com>
816
817         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
818         position independent outputs, not just shared objects.
819
820 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
821
822         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
823         * configure: Regenerated.
824
825 2012-01-27  Ian Lance Taylor  <iant@google.com>
826
827         * reloc.h (Bits): New class with static functions, copied from
828         namespace utils in arm.cc.
829         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
830         instead.
831
832 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
833
834         * incremental.cc (write_info_blocks): Correct relocation offset.
835
836 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
837
838         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
839         (Relocate::tls_gd_to_le): Likewise.
840
841 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
842
843         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
844
845 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
846
847         * configure.ac: Check if -mcmodel=medium works.
848         * configure: Regenerated.
849
850 2012-01-24  Cary Coutant  <ccoutant@google.com>
851
852         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
853         definition and ...
854         (read_unsigned_LEB_128_x): ... this new function.
855         (read_signed_LEB_128): Replaced with inline definition and ...
856         (read_signed_LEB_128_x): ... this new function.
857         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
858         (read_unsigned_LEB_128): Add inline definition.
859         (read_signed_LEB_128_x): New function.
860         (read_signed_LEB_128): Add inline definition.
861         * testsuite/Makefile.am (leb128_unittest): New unit test.
862         * testsuite/Makefile.in: Regenerate.
863         * testsuite/leb128_unittest.cc: New unit test.
864
865 2012-01-23  Ian Lance Taylor  <iant@google.com>
866
867         PR gold/13617
868         * i386.cc (Target_i386::do_code_fill): When using a jmp
869         instruction, pad with nop instructions.
870         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
871
872 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
873
874         * x86_64.cc (gc_process_relocs): Add typename on types used in
875         template.
876         (scan_relocs): Likewise.
877         (relocate_section): Likewise.
878         (apply_relocation): Likewise.
879
880 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
881
882         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
883         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
884         under x32.
885
886 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
887
888         * x86_64.cc: Initial support for x32.
889
890 2012-01-03  Cary Coutant  <ccoutant@google.com>
891
892         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
893         Use abstract base class for GOT.
894         * gold/output.h (class Output_data_got_base): New abstract base class.
895         (class Output_data_got): Derive from new base class, adjust ctors.
896         (Output_data_got::reserve_slot): Make virtual; rename to
897         do_reserve_slot; Adjust callers.
898         * gold/target.h (Sized_target::init_got_plt_for_update): Return
899         pointer to abstract base class.
900         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
901
902 2011-12-18  Ian Lance Taylor  <iant@google.com>
903
904         * object.h (Relobj::local_symbol_value): New function.
905         (Relobj::local_plt_offset): New function.
906         (Relobj::local_has_got_offset): New function.
907         (Relobj::local_got_offset): New function.
908         (Relobj::set_local_got_offset): New function.
909         (Relobj::do_local_symbol_value): New pure virtual function.
910         (Relobj::do_local_plt_offset): Likewise.
911         (Relobj::do_local_has_got_offset): Likewise.
912         (Relobj::do_local_got_offset): Likewise.
913         (Relobj::do_set_local_got_offset): Likewise.
914         (Sized_relobj::do_local_has_got_offset): Rename from
915         local_has_got_offset.
916         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
917         (Sized_relobj::do_set_local_got_offset): Rename from
918         set_local_got_offset.
919         (Sized_relobj_file::do_local_plt_offset): Rename from
920         local_plt_offset.
921         (Sized_relobj_file::do_local_symbol_value): New function.
922         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
923         local_plt_offset.
924         * output.cc (Output_data_got::Got_entry::write): Change object to
925         Relobj.  Use local_symbol_value.
926         (Output_data_got::add_global_with_rel): Change rel_dyn to
927         Output_data_reloc_generic*.  Use add_global_generic.
928         (Output_data_got::add_global_with_rela): Remove.  Change all
929         callers to use add_global_with_rel.
930         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
931         Output_data_reloc_generic*.  Use add_global_generic.
932         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
933         callers to use add_global_pair_with_rel.
934         (Output_data_got::add_local): Change object to Relobj*.
935         (Output_data_got::add_local_plt): Likewise.
936         (Output_data_got::add_local_with_rel): Change object to Relobj*,
937         change rel_dyn to Output_data_reloc_generic*.  Use
938         add_local_generic.
939         (Output_data_got::add_local_with_rela): Remove.  Change all
940         callers to use all_local_with_rel.
941         (Output_data_got::add_local_pair_with_rel): Change object to
942         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
943         add_output_section_generic.
944         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
945         callers to use add_local_pair_with_rel.
946         (Output_data_got::reserve_local): Change object to Relobj*.
947         * output.h: (class Output_data_reloc_generic): Add pure virtual
948         declarations for add_global_generic, add_local_generic,
949         add_output_section_generic.
950         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
951         functions for Output_data_reloc_generic.  Update declarations for
952         changes listed in output.cc.
953         (class Output_data_got): Change template parameter to got_size.
954         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
955         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
956         function.
957         (Sized_relobj_incr::do_local_plt_offset): New function.
958         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
959         add_global_generic.
960
961 2011-12-17  Cary Coutant  <ccoutant@google.com>
962
963         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
964         * resolve.cc (Symbol_table::resolve): Likewise.
965         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
966         arrays.
967         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
968
969 2011-12-16  Ian Lance Taylor  <iant@google.com>
970
971         * output.h (Output_data_reloc_generic::add): Only call
972         add_dynamic_reloc if this is a dynamic reloc section.
973
974 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
975
976         PR gold/13505
977         * target-reloc.h (apply_relocation): Replace <64, false> with
978         <size, big_endian>.
979
980 2011-11-25  Nick Clifton  <nickc@redhat.com>
981
982         * po/it.po: New Italian translation.
983
984 2011-11-17  Sterling Augustine  <saugustine@google.com>
985
986         * script.cc (script_include_directive): Implement.
987         (read_script_file): New local variables name and search_path. Update
988         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
989         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
990         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
991
992 2011-11-11  Sterling Augustine  <saugustine@google.com>
993
994         * yyscript.y (section_cmd): Add support for INCLUDE directive.
995         (file_or_sections_cmd): Likewise.
996
997 2011-11-11  Doug Kwan  <dougkwan@google.com>
998
999         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1000         if --just-symbols is given.
1001
1002 2011-11-10  Doug Kwan  <dougkwan@google.com>
1003
1004         PR gold/13362
1005         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1006         when processing data relocs.
1007         * reloc.h (Relocate_functions::rel_unaligned): New method.
1008         (Relocate_functions::pcrel_unaligned): Ditto.
1009         (Relocate_functions::rel32_unaligned): Ditto.
1010         (Relocate_functions::pcrel32_unaligned): Ditto.
1011
1012 2011-11-09  Doug Kwan  <dougkwan@google.com>
1013
1014         PR gold/13362
1015         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1016         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1017         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1018         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1019         (Relocate_functions::rel_unaligned): New.
1020         (Relocate_functions::rel32_unaligned): New.
1021         * target-reloc.h (relocate_for_relocatable): Add code to handle
1022         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1023         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1024         arm_unaligned_reloc_r): New targets.
1025         * testsuite/Makefile.in: Regenerate.
1026         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1027         linking.
1028
1029 2011-11-02  Ian Lance Taylor  <iant@google.com>
1030
1031         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1032         NATIVE_LINKER.
1033         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1034         * options.cc (General_options::finalize): Use library search path
1035         from configure script if specified.  If not native and no sysroot,
1036         only search TOOLLIBDIR.
1037         * options.h (Search_directory::Search_directory): Change name to
1038         const std::string&.
1039         (General_options::add_to_library_path_with_sysroot): Change arg to
1040         const std::string&.
1041         * configure, Makefile.in, config.in: Rebuild.
1042
1043 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1044
1045         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1046         we are working around the ARM1176 Erratum.
1047         * options.h (General_options::fix_arm1176): Add option.
1048         * testsuite/Makefile.am: Add testcases, and keep current ones
1049         working.
1050         * testsuite/Makefile.in: Regenerate.
1051         * testsuite/arm_fix_1176.s: New file.
1052         * testsuite/arm_fix_1176.sh: Likewise.
1053
1054 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1055
1056         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1057         may_use_blx_.
1058         (Target_arm::may_use_blx): Remove method.
1059         (Target_arm::set_may_use_blx): Likewise.
1060         (Target_arm::may_use_v4t_interworking): New method.
1061         (Target_arm::may_use_v5t_interworking): Likewise.
1062         (Target_arm::may_use_blx_): Remove member variable.
1063         (Arm_relocate_functions::arm_branch_common): Check for v5T
1064         interworking.
1065         (Arm_relocate_functions::thumb_branch_common): Likewise.
1066         (Reloc_stub::stub_type_for_reloc): Likewise.
1067         (Target_arm::do_finalize_sections): Correct interworking checks.
1068         * testsuite/Makefile.am: Add new tests.
1069         * testsuite/Makefile.in: Regenerate.
1070         * testsuite/arm_farcall_arm_arm.s: New test.
1071         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1072         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1073         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1074         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1075         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1076         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1077         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1078
1079 2011-10-31  Cary Coutant  <ccoutant@google.com>
1080
1081         PR gold/13023
1082         * expression.cc (Expression::eval_with_dot): Add
1083         is_section_dot_assignment parameter.
1084         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1085         absolute and assigning to dot within a section.
1086         * script-sections.cc
1087         (Output_section_element_assignment::set_section_addresses): Pass
1088         dot_section to set_if_absolute.
1089         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1090         as is_section_dot_assignment flag to eval_with_dot.
1091         (Output_section_element_dot_assignment::set_section_addresses):
1092         Likewise.
1093         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1094         parameter.  Also set value if relative to dot_section; set the
1095         symbol's output_section.
1096         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1097         parameter.  Adjust all callers.
1098         (Expression::eval_maybe_dot): Likewise.
1099         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1100         Adjust all callers.
1101         * testsuite/script_test_2.t: Test assignment of an absolute value
1102         to dot within an output section element.
1103
1104 2011-10-31  Cary Coutant  <ccoutant@google.com>
1105
1106         * options.h (class General_options): Add --[no-]gnu-unique options.
1107         * symtab.cc (Symbol_table::sized_write_globals): Convert
1108         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1109
1110 2011-10-31  Cary Coutant  <ccoutant@google.com>
1111
1112         PR gold/13359
1113         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1114         unnecessary assertion.
1115         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1116
1117 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1118
1119         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1120         gc_mark_symbol.
1121         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1122         gc_mark_symbol.
1123         Change to just keep the section associated with symbol.
1124         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1125         they are externally visible and --export-dynamic is turned on.
1126         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1127
1128 2011-10-19  Ian Lance Taylor  <iant@google.com>
1129
1130         PR gold/13163
1131         * script-sections.cc
1132         (Output_section_element_dot_assignment::needs_output_section): New
1133         function.
1134
1135 2011-10-19  Ian Lance Taylor  <iant@google.com>
1136
1137         PR gold/13204
1138         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1139         --section-start option was seen.
1140         * options.h (General_options::any_section_start): New function.
1141
1142 2011-10-18  David S. Miller  <davem@davemloft.net>
1143
1144         PR binutils/13301
1145         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1146         member to track relocation locations that have moved during TLS
1147         reloc optimizations.
1148         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1149         (Target_sparc::Relocate::relocate): Adjust view down by 4
1150         bytes if it matches reloc_adjust_addr_.
1151         (Target_sparc::Relocate::relocate_tls): Always move the
1152         __tls_get_addr call delay slot instruction forward 4 bytes when
1153         performing relaxation.
1154
1155 2011-10-18  Cary Coutant  <ccoutant@google.com>
1156
1157         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1158         (Output_file::map_no_anonymous): Check for non-zero
1159         return code from posix_fallocate.
1160
1161 2011-10-17  Cary Coutant  <ccoutant@google.com>
1162
1163         PR gold/13245
1164         * plugin.cc (is_visible_from_outside): Check for symbols
1165         referenced from dynamic objects.
1166         * resolve.cc (Symbol_table::resolve): Don't count references
1167         from dynamic objects as references from real ELF files.
1168         * testsuite/plugin_test_2.sh: Adjust expected result.
1169
1170 2011-10-17  Cary Coutant  <ccoutant@google.com>
1171
1172         * gold.cc: Include timer.h.
1173         (queue_middle_tasks): Stamp time.
1174         (queue_final_tasks): Likewise.
1175         * main.cc (main): Store timer in parameters.  Print timers
1176         for each pass.
1177         * parameters.cc (Parameters::Parameters): Initialize timer_.
1178         (Parameters::set_timer): New function.
1179         (set_parameters_timer): New function.
1180         * parameters.h (Parameters::set_timer): New function.
1181         (Parameters::timer): New function.
1182         (Parameters::timer_): New data member.
1183         (set_parameters_timer): New function.
1184         * timer.cc (Timer::stamp): New function.
1185         (Timer::get_pass_time): New function.
1186         * timer.h (Timer::stamp): New function.
1187         (Timer::get_pass_time): New function.
1188         (Timer::pass_times_): New data member.
1189
1190 2011-10-17  Cary Coutant  <ccoutant@google.com>
1191
1192         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1193         task for members of lib groups.
1194
1195 2011-10-17  Cary Coutant  <ccoutant@google.com>
1196
1197         PR gold/13288
1198         * fileread.cc (File_read::find_view): Add assert.
1199         (File_read::make_view): Move bounds check (replace with assert)...
1200         (File_read::find_or_make_view): ... to here.
1201
1202 2011-10-12  Cary Coutant  <ccoutant@google.com>
1203
1204         * output.cc (Output_file::open_base_file): Handle case where
1205         ::read returns less than requested size.
1206
1207 2011-10-10  Cary Coutant  <ccoutant@google.com>
1208
1209         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1210         Initialize defined_count_.
1211         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1212         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1213         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1214         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1215         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1216         * incremental.h (Sized_relobj_incr::defined_count_): New data
1217         member.
1218         (Sized_incr_dynobj::defined_count_): New data member.
1219         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1220         Return zeroes instead of internal error.
1221
1222 2011-10-10  Cary Coutant  <ccoutant@google.com>
1223
1224         PR gold/13249
1225         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1226         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1227         * output.h (class Output_reloc): Add use_plt_offset flag.
1228         (Output_reloc::type_): Adjust size of bit field.
1229         (Output_reloc::use_plt_offset_): New bit field.
1230         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1231         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1232         flag.  Adjust all callers.
1233         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1234         creating RELATIVE relocations.
1235
1236 2011-10-10  Nick Clifton  <nickc@redhat.com>
1237
1238         * po/es.po: Updated Spanish translation.
1239         * po/fi.po: Updated Finnish translation.
1240
1241 2011-10-03   Diego Novillo  <dnovillo@google.com>
1242
1243         * options.cc (parse_uint): Fix dereference of RETVAL.
1244
1245 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1246
1247         * layout.h (section_order_map_): New member.
1248         (get_section_order_map): New member function.
1249         * output.cc (Output_section::add_input_section): Check for patterns
1250         only when --section-ordering-file is specified.
1251         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1252         output_sections have been formed.
1253         * layout.cc (Layout_Layout): Initialize section_order_map_.
1254         * plugin.cc (update_section_order): Store order in order_map. Do not
1255         update the order.
1256         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1257         * testsuite/Makefile.in: Regenerate.
1258         * testsuite/plugin_section_order.c: New file.
1259         * testsuite/plugin_final_layout.cc: New file.
1260         * testsuite/plugin_final_layout.sh: New file.
1261
1262 2011-09-29  Cary Coutant  <ccoutant@google.com>
1263
1264         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1265         Check for NULL.
1266         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1267         symbols during incremental update.
1268         (Symbol_table::add_from_dynobj): Likewise.
1269
1270 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1271             Ian Lance Taylor  <iant@google.com>
1272
1273         * symtab.cc (Symbol_table::define_special_symbol): Always
1274         canonicalize version string.
1275
1276 2011-09-26  Cary Coutant  <ccoutant@google.com>
1277
1278         * gold.cc (queue_initial_tasks): Move option checks ...
1279         * options.cc (General_options::finalize): ... to here. Disable
1280         some options; make others fatal.
1281
1282 2011-09-26  Cary Coutant  <ccoutant@google.com>
1283
1284         gcc PR lto/47247
1285         * plugin.cc (get_symbols_v2): New function.
1286         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1287         (is_referenced_from_outside): New function.
1288         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1289         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1290         (get_symbols): Pass version parameter.
1291         (get_symbols_v2): New function.
1292         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1293         parameter.
1294         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1295         (onload): Add LDPT_GET_SYMBOLS_V2.
1296         (all_symbols_read_hook): Use get_symbols_v2; check for
1297         LDPR_PREVAILING_DEF_IRONLY_EXP.
1298         * testsuite/plugin_test_3.sh: Update expected results.
1299
1300 2011-09-23  Simon Baldwin  <simonb@google.com>
1301
1302         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1303         configuration options.
1304         * configure: Regenerate.
1305         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1306         * Makefile.in: Regenerate.
1307         * testsuite/Makefile.in: Regenerate.
1308
1309 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1310
1311         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1312
1313 2011-09-19  Cary Coutant  <ccoutant@google.com>
1314
1315         * incremental.cc (can_incremental_update): Fix typo in comment.
1316         * incremental.h (can_incremental_update): Likewise.
1317
1318 2011-09-18  Cary Coutant  <ccoutant@google.com>
1319
1320         * incremental.cc (can_incremental_update): New function.
1321         * incremental.h (can_incremental_update): New function.
1322         * layout.cc (Layout::init_fixed_output_section): Call it.
1323         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1324         * object.cc (Sized_relobj_file::do_layout): Call
1325         can_incremental_update.
1326
1327 2011-09-13  Cary Coutant  <ccoutant@google.com>
1328
1329         * configure.ac: Check for glibc support for gnu_indirect_function
1330         support with static linking, setting automake conditional
1331         IFUNC_STATIC.
1332         * Makefile.in: Regenerate.
1333         * configure: Regenerate.
1334
1335         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1336         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1337         for IFUNC_STATIC.
1338         * testsuite/Makefile.in: Regenerate.
1339
1340 2011-09-13  Cary Coutant  <ccoutant@google.com>
1341
1342         * incremental.cc (Sized_relobj_incr::do_layout): Call
1343         report_comdat_group for kept comdat sections.
1344         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1345         * testsuite/Makefile.in: Regenerate.
1346         * testsuite/incr_comdat_test_1.cc: New source file.
1347         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1348         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1349         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1350
1351 2011-09-13  Ian Lance Taylor  <iant@google.com>
1352
1353         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1354         variable external_symbols_offset.
1355
1356 2011-09-12  Ian Lance Taylor  <iant@google.com>
1357
1358         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1359         triggered if object has no symbols.
1360
1361 2011-09-09  David S. Miller  <davem@davemloft.net>
1362
1363         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1364         (Output_fill_debug_line::do_write): Likewise.
1365
1366 2011-08-29  Cary Coutant  <ccoutant@google.com>
1367
1368         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1369         casts to match formatting specs.
1370         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1371
1372 2011-08-26  Cary Coutant  <ccoutant@google.com>
1373
1374         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1375         remaining hole size when allocating.
1376         (Layout::make_output_section): Set fill methods for debug sections.
1377         * layout.h (Free_list::Free_list_node): Move from private to
1378         public.
1379         (Free_list::set_min_hole_size): New function.
1380         (Free_list::begin, Free_list::end): New functions.
1381         (Free_list::min_hole_): New data member.
1382         * output.cc: Include dwarf.h.
1383         (Output_fill_debug_info::do_minimum_hole_size): New function.
1384         (Output_fill_debug_info::do_write): New function.
1385         (Output_fill_debug_line::do_minimum_hole_size): New function.
1386         (Output_fill_debug_line::do_write): New function.
1387         (Output_section::Output_section): Initialize new data member.
1388         (Output_section::set_final_data_size): Ensure patch space is larger
1389         than minimum hole size.
1390         (Output_section::do_write): Fill holes in debug sections.
1391         * output.h (Output_fill): New class.
1392         (Output_fill_debug_info): New class.
1393         (Output_fill_debug_line): New class.
1394         (Output_section::set_free_space_fill): New function.
1395         (Output_section::free_space_fill_): New data member.
1396         * testsuite/Makefile.am (incremental_test_3): Add
1397         --incremental-patch option.
1398         (incremental_test_4): Likewise.
1399         (incremental_test_5): Likewise.
1400         (incremental_test_6): Likewise.
1401         (incremental_copy_test): Likewise.
1402         (incremental_common_test_1): Likewise.
1403         * testsuite/Makefile.in: Regenerate.
1404
1405 2011-08-26  Nick Clifton  <nickc@redhat.com>
1406
1407         * po/es.po: Updated Spanish translation.
1408
1409 2011-08-01  Cary Coutant  <ccoutant@google.com>
1410
1411         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1412         * gold/testsuite/Makefile.in: Regenerate.
1413         * gold/testsuite/justsyms_exec.c: New source file.
1414         * gold/testsuite/justsyms_lib.c: New source file.
1415
1416 2011-08-01  Cary Coutant  <ccoutant@google.com>
1417
1418         * layout.cc (Layout::set_segment_offsets): Don't realign text
1419         segment if -Ttext was specified.
1420         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1421         file type.
1422         * object.h (Sized_relobj_file::e_type): New function.
1423         (Sized_relobj_file::e_type_): New data member.
1424         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1425         base address for ET_EXEC files.
1426         * target.cc (Target::do_make_elf_object_implementation): Allow
1427         ET_EXEC files with --just-symbols option.
1428
1429 2011-07-28  Cary Coutant  <ccoutant@google.com>
1430
1431         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1432         Add thread_number parameter.
1433         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1434         * workqueue-threads.cc
1435         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1436         current thread if its thread number is greater than desired thread
1437         count.
1438         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1439         Add thread_number parameter.
1440         (Workqueue::should_cancel_thread): Likewise.
1441         (Workqueue::find_runnable_or_wait): Pass thread_number to
1442         should_cancel_thread.
1443         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1444         parameter.
1445
1446 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1447
1448         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1449         only after checking if it cannot be forced local.
1450         * symtab.h (is_externally_visible): Check if the symbol is not forced
1451         local.
1452
1453 2011-07-15  Ian Lance Taylor  <iant@google.com>
1454
1455         * options.h (class General_options): Add --print-output-format.
1456         Move -EL next to -EB, for  better --help output.
1457         * target-select.cc: Include <cstdio>, "options.h", and
1458         "parameters.h".
1459         (Target_selector::do_target_bfd_name): New function.
1460         (print_output_format): New function.
1461         * target-select.h (class Target_selector): Update declarations.
1462         (Target_selector::target_bfd_name): New function.
1463         (print_output_format): Declare.
1464         * main.cc: Include "target-select.h".
1465         (main): Handle --print-output-format.
1466         * gold.cc: Include "target-select.h".
1467         (queue_initial_tasks): Handle --print-output-format when there are
1468         no input files.
1469         * parameters.cc (parameters_force_valid_target): Give a better
1470         error message if -EB/-EL does not match target.
1471         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1472         function.
1473
1474 2011-07-15  Ian Lance Taylor  <iant@google.com>
1475
1476         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1477         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1478         (Output_data_plt_i386::do_write): Write address of .dynamic
1479         section to first entry in .got.plt section.
1480         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1481         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1482         Initialize layout_.
1483         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1484         section to first entry in .got.plt section.
1485         * layout.h (Layout::dynamic_section): New function.
1486
1487 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1488
1489         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1490         to claim_file call.
1491         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1492         input_section_position_, and input_section_glob_.
1493         (read_layout_from_file): Call function section_ordering_specified.
1494         * layout.h (is_section_ordering_specified): New function.
1495         (section_ordering_specified): New function.
1496         (section_ordering_specified_): New boolean member.
1497         * main.cc(main): Call load_plugins after layout object is defined.
1498         * output.cc (Output_section::add_input_section): Use
1499         function section_ordering_specified to check if section ordering is
1500         needed.
1501         * output.cc (Output_section::add_relaxed_input_section): Use
1502         function section_ordering_specified to check if section ordering is
1503         needed.
1504         (Output_section::update_section_layout): New function.
1505         (Output_section::sort_attached_input_sections): Check if input section
1506         must be reordered.
1507         * output.h (Output_section::update_section_layout): New function.
1508         * plugin.cc (get_section_count): New function.
1509         (get_section_type): New function.
1510         (get_section_name): New function.
1511         (get_section_contents): New function.
1512         (update_section_order): New function.
1513         (allow_section_ordering): New function.
1514         (Plugin::load): Add the new interfaces to the transfer vector.
1515         (Plugin_manager::load_plugins): New parameter.
1516         (Plugin_manager::all_symbols_read): New parameter.
1517         (Plugin_manager::claim_file): New parameter. Save the elf object for
1518         unclaimed objects.
1519         (Plugin_manager::get_elf_object): New function.
1520         (Plugin_manager::get_view): Change to directly use the bool to check
1521         if get_view is called from claim_file_hook.
1522         * plugin.h (input_objects): New function
1523         (Plugin__manager::load_plugins): New parameter.
1524         (Plugin_manager::claim_file): New parameter.
1525         (Plugin_manager::get_elf_object): New function.
1526         (Plugin_manager::in_claim_file_handler): New function.
1527         (Plugin_manager::in_claim_file_handler_): New member.
1528         (layout): New function.
1529         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1530         handler with an extra parameter. Make the elf object before calling
1531         claim_file handler.
1532         * testsuite/plugin_test.c (get_section_count): New function pointer.
1533         (get_section_type): New function pointer.
1534         (get_section_name): New function pointer.
1535         (get_section_contents): New function pointer.
1536         (update_section_order): New function pointer.
1537         (allow_section_ordering): New function pointer.
1538         (onload): Check if the new interfaces exist.
1539
1540 2011-07-13  Ian Lance Taylor  <iant@google.com>
1541
1542         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1543         relro section.
1544         * x86_64.cc (Target_x86_64::got_section): Likewise.
1545         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1546         (relro_now_test_SOURCES): New variable.
1547         (relro_now_test_DEPENDENCIES): New variable.
1548         (relro_now_test_LDFLAGS): New variable.
1549         (relro_now_test_LDADD): New variable.
1550         (relro_now_test.so): New target.
1551         * testsuite/Makefile.in: Rebuild.
1552
1553 2011-07-12  Ian Lance Taylor  <iant@google.com>
1554
1555         PR gold/12980
1556         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1557         GLOB_DAT relocation rather than a RELATIVE relocation for a
1558         protected symbol when creating a shared library.
1559         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1560         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1561         * testsuite/protected_main_1.cc (main): Test that protected
1562         function has same address.
1563
1564 2011-07-11  Ian Lance Taylor  <iant@google.com>
1565
1566         PR gold/12979
1567         * options.h (class General_options): Add -Bgroup.
1568         * options.cc (General_options::finalize): If -Bgroup is set,
1569         default to --unresolved-symbols=report-all.
1570         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1571         * target-reloc.h (issue_undefined_symbol_error): Handle
1572         --unresolved-symbols=report-all.
1573
1574 2011-07-08  Ian Lance Taylor  <iant@google.com>
1575
1576         PR gold/11985
1577         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1578         if linker script discards key sections.
1579         (Layout::create_dynamic_symtab): Likewise.
1580         (Layout::assign_local_dynsym_offsets): Likewise.
1581         (Layout::sized_create_version_sections): Likewise.
1582         (Layout::create_interp): Likewise.
1583         (Layout::finish_dynamic_section): Likewise.
1584         (Layout::set_dynamic_symbol_size): Likewise.
1585
1586 2011-07-08  Ian Lance Taylor  <iant@google.com>
1587
1588         PR gold/12386
1589         * options.h (class General_options): Add --unresolved-symbols.
1590         * target-reloc.h (issue_undefined_symbol_error): Check
1591         --unresolved-symbols.  Add comments.
1592
1593 2011-07-08  Ian Lance Taylor  <iant@google.com>
1594
1595         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1596         expression more complex.
1597
1598 2011-07-08  Ian Lance Taylor  <iant@google.com>
1599
1600         PR gold/11317
1601         * target-reloc.h (issue_undefined_symbol_error): New inline
1602         function, broken out of relocate_section.
1603         (relocate_section): Call issue_undefined_symbol_error.
1604         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1605         there is no TLS segment if we are about to issue an undefined
1606         symbol error.
1607         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1608
1609 2011-07-08  Ian Lance Taylor  <iant@google.com>
1610
1611         PR gold/12279
1612         * resolve.cc (Symbol_table::should_override): Add fromtype
1613         parameter.  Change all callers.  Give error when linking together
1614         TLS and non-TLS symbol.
1615         (Symbol_table::should_override_with_special): Add fromtype
1616         parameter.  Change all callers.
1617         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1618         there is no TLS segment if we have reported some errors.
1619         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1620
1621 2011-07-08  Ian Lance Taylor  <iant@google.com>
1622
1623         PR gold/12372
1624         * target.h (Target::plt_address_for_global): New function.
1625         (Target::plt_address_for_local): New function.
1626         (Target::plt_section_for_global): Remove.
1627         (Target::plt_section_for_local): Remove.
1628         (Target::do_plt_address_for_global): New virtual function.
1629         (Target::do_plt_address_for_local): New virtual function.
1630         (Target::do_plt_section_for_global): Remove.
1631         (Target::do_plt_section_for_local): Remove.
1632         (Target::register_global_plt_entry): Add Symbol_table and Layout
1633         parameters.
1634         * output.cc (Output_data_got::Got_entry::write): Use
1635         plt_address_for_global and plt_address_for_local.
1636         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1637         address of output section.
1638         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1639         got_irelative_, and irelative_count_ fields.  Update
1640         declarations.
1641         (Output_data_plt_i386::has_irelative_section): New function.
1642         (Output_data_plt_i386::entry_count): Add irelative_count_.
1643         (Output_data_plt_i386::set_final_data_size): Likewise.
1644         (class Target_i386): Add got_irelative_ and rel_irelative_
1645         fields.  Update declarations.
1646         (Target_i386::Target_i386): Initialize new fields.
1647         (Target_i386::do_plt_address_for_global): New function replacing
1648         do_plt_section_for_global.
1649         (Target_i386::do_plt_address_for_local): New function replacing
1650         do_plt_section_for_local.
1651         (Target_i386::got_section): Create got_irelative_.
1652         (Target_i386::rel_irelative_section): New function.
1653         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1654         fields.  Don't define __rel_iplt_{start,end}.
1655         (Output_data_plt_i386::add_entry): Add symtab and layout
1656         parameters.  Change all callers.  Use different PLT and GOT for
1657         IFUNC symbols.
1658         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1659         layout parameters.  Change all callers.  Use different PLT and
1660         GOT.
1661         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1662         (Output_data_plt_i386::rel_irelative): New function.
1663         (Output_data_plt_i386::address_for_global): New function.
1664         (Output_data_plt_i386::address_for_local): New function.
1665         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1666         IRELATIVE GOT when changing IFUNC GOT entries.
1667         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1668         reloc.
1669         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1670         if we didn't create an IRELATIVE GOT.
1671         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1672         plt_address_for_local.
1673         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1674         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1675         got_irelative_, and irelative_count_ fields.  Update
1676         declarations.
1677         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1678         Initialize new fields.  Remove symtab parameter.  Change all
1679         callers.
1680         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1681         irelative_count_.
1682         (Output_data_plt_x86_64::has_irelative_section): New function.
1683         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1684         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1685         fields.  Update declarations.
1686         (Target_x86_64::Target_x86_64): Initialize new fields.
1687         (Target_x86_64::do_plt_address_for_global): New function replacing
1688         do_plt_section_for_global.
1689         (Target_x86_64::do_plt_address_for_local): New function replacing
1690         do_plt_section_for_local.
1691         (Target_x86_64::got_section): Create got_irelative_.
1692         (Target_x86_64::rela_irelative_section): New function.
1693         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1694         all callers.  Don't create __rel_iplt_{start,end}.
1695         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1696         parameters.  Change all callers.  Use different PLT and GOT for
1697         IFUNC symbols.
1698         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1699         layout parameters.  Change all callers.  Use different PLT and
1700         GOT.
1701         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1702         parameters.  Change all callers.  Use different PLT and GOT for
1703         IFUNC symbols.
1704         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1705         (Output_data_plt_x86_64::rela_irelative): New function.
1706         (Output_data_plt_x86_64::address_for_global): New function.
1707         (Output_data_plt_x86_64::address_for_local): New function.
1708         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1709         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1710         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1711         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1712         parameters.
1713         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1714         reloc.
1715         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1716         symbols if we didn't create an IRELATIVE GOT.
1717         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1718         plt_address_for_local.
1719         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1720         * testsuite/ifuncvar1.c: New test file.
1721         * testsuite/ifuncvar2.c: New test file.
1722         * testsuite/ifuncvar3.c: New test file.
1723         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1724         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1725         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1726         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1727         * testsuite/Makefile.in: Rebuild.
1728
1729 2011-07-07  Cary Coutant  <ccoutant@google.com>
1730
1731         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1732         (two_file_test_1_ndebug.o): Likewise.
1733         (two_file_test_1b_ndebug.o): Likewise.
1734         (two_file_test_2_ndebug.o): Likewise.
1735         (two_file_test_main_ndebug.o): Likewise.
1736         (incremental_test_2): Link with no-debug versions.
1737
1738 2011-07-06  Cary Coutant  <ccoutant@google.com>
1739
1740         * gold/incremental.cc
1741         (Output_section_incremental_inputs::write_info_blocks): Check for
1742         hidden and internal symbols.
1743
1744 2011-07-06  Cary Coutant  <ccoutant@google.com>
1745
1746         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
1747         Check disposition for startup file.
1748         (Incremental_inputs::report_command_line): Ignore
1749         --incremental-startup-unchanged option.
1750         * options.cc (General_options::parse_incremental_startup_unchanged):
1751         New function.
1752         (General_options::General_options): Initialize new data member.
1753         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
1754         (General_options): Add --incremental-startup-unchanged option.
1755         (General_options::incremental_startup_disposition): New function.
1756         (General_options::incremental_startup_disposition_): New data member.
1757
1758 2011-07-06  Cary Coutant  <ccoutant@google.com>
1759
1760         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
1761         input file index to Script_info ctor.
1762         (Sized_incremental_binary::do_file_has_changed): Find the
1763         command-line argument for files named in scripts.
1764         * incremental.h (Script_info::Script_info): New ctor
1765         with input file index.
1766         (Script_info::input_file_index): New function.
1767         (Script_info::input_file_index_): New data member.
1768         (Incremental_binary::get_library): Add const.
1769         (Incremental_binary::get_script_info): Add const.
1770         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
1771         * testsuite/Makefile.am (incremental_test_5): New test case.
1772         (incremental_test_6): New test case.
1773         * testsuite/Makefile.in: Regenerate.
1774
1775 2011-07-06  Cary Coutant  <ccoutant@google.com>
1776
1777         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
1778         debug output when command lines differ.
1779
1780 2011-07-06  Cary Coutant  <ccoutant@google.com>
1781
1782         * incremental.cc (Incremental_inputs::report_command_line): Ignore
1783         --incremental-patch option.
1784         * layout.cc (Free_list::allocate): Extend allocation beyond original
1785         end if enabled.
1786         (Layout::make_output_section): Mark sections that should get
1787         patch space.
1788         * options.cc (parse_percent): New function.
1789         * options.h (parse_percent): New function.
1790         (DEFINE_percent): New macro.
1791         (General_options): Add --incremental-patch option.
1792         * output.cc (Output_section::Output_section): Initialize new data
1793         members.
1794         (Output_section::add_input_section): Print section name when out
1795         of patch space.
1796         (Output_section::add_output_section_data): Likewise.
1797         (Output_section::set_final_data_size): Add patch space when
1798         doing --incremental-full.
1799         (Output_section::do_reset_address_and_file_offset): Remove patch
1800         space.
1801         (Output_segment::set_section_list_addresses): Print debug output
1802         only if --incremental-update.
1803         * output.h (Output_section::set_is_patch_space_allowed): New function.
1804         (Output_section::is_patch_space_allowed_): New data member.
1805         (Output_section::patch_space_): New data member.
1806         * parameters.cc (Parameters::incremental_full): New function.
1807         * parameters.h (Parameters::incremental_full): New function
1808         * testsuite/Makefile.am (incremental_test_2): Add test for
1809         --incremental-patch option.
1810         * testsuite/Makefile.in: Regenerate.
1811         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
1812         (t18): Remove function body.
1813
1814 2011-07-05  Doug Kwan  <dougkwan@google.com>
1815
1816         PR gold/12771
1817         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
1818         Arm_Address type for relocation result.
1819         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
1820         overflow check.
1821         (Arm_relocate_functions::abs32): Use unaligned access.
1822         (Arm_relocate_functions::rel32): Ditto.
1823         (Arm_relocate_functions::prel31): Ditto.
1824         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
1825         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
1826         static data relocations.
1827         * testsuite/Makefile.in: Regnerate.
1828         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
1829
1830 2011-07-05  Ian Lance Taylor  <iant@google.com>
1831
1832         PR gold/12392
1833         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
1834         symbols if necessary.
1835         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
1836
1837 2011-07-05  Ian Lance Taylor  <iant@google.com>
1838
1839         PR gold/12952
1840         * resolve.cc (Symbol::override_base_with_special): Simply override
1841         version with special symbol version, ignoring previous version.
1842
1843 2011-07-05  Ian Lance Taylor  <iant@google.com>
1844
1845         * object.cc (Sized_relobj_file::include_section_group): Add
1846         information to comment about signature location.
1847
1848 2011-07-02  Ian Lance Taylor  <iant@google.com>
1849
1850         PR gold/12957
1851         * options.h (class General_options): Add -f and -F.
1852         * options.cc (General_options::finalize): Fatal error if -f/-F
1853         are used without -shared.
1854         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
1855
1856 2011-07-02  Ian Lance Taylor  <iant@google.com>
1857
1858         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
1859
1860 2011-07-01  Ian Lance Taylor  <iant@google.com>
1861
1862         PR gold/12525
1863         PR gold/12952
1864         * resolve.cc (Symbol::override_base_with_special): Don't override
1865         the version if the overriding symbol has a different name.
1866         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
1867         all callers.  If we give an error about an undefined version,
1868         define the base version if necessary.
1869         * dynobj.h (class Versions): Update declaration.
1870         * testsuite/weak_alias_test_5.cc: New file.
1871         * testsuite/weak_alias_test.script: New file.
1872         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
1873         and versioned_alias have the right value, and call t2.
1874         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
1875         weak_alias_test_5.so.
1876         (weak_alias_test_LDADD): Likewise.
1877         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
1878         * testsuite/Makefile.in: Rebuild.
1879
1880 2011-07-01  Ian Lance Taylor  <iant@google.com>
1881
1882         PR gold/12525
1883         * options.h (class General_options): Support -z notext.
1884         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
1885         -Wl,-z,notext.
1886         (two_file_shared_nonpic.so): Likewise.
1887         (two_file_shared_mixed.so): Likewise.
1888         (two_file_shared_mixed_1.so): Likewise.
1889         (weak_undef_lib_nonpic.so): Likewise.
1890         (alt/weak_undef_lib_nonpic.so): Likewise.
1891         (tls_test_shared_nonpic.so): Likewise.
1892         * testsuite/Makefile.in: Rebuild.
1893
1894 2011-07-01  Ian Lance Taylor  <iant@google.com>
1895
1896         PR gold/12525
1897         * configure.ac: Test whether static linking works, setting
1898         the automake conditional HAVE_STATIC.
1899         * testsuite/Makefile.am: Disable tests using -static if
1900         HAVE_STATIC is not true.
1901         * configure, testsuite/Makefile.in: Rebuild.
1902
1903 2011-07-01  Ian Lance Taylor  <iant@google.com>
1904
1905         PR gold/12525
1906         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
1907         Assert if we see DW_EH_PE_indirect.
1908         * target.h (Target::ehframe_datarel_base): New function.
1909         (Target::do_ehframe_datarel_base): New target function.
1910         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
1911         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
1912         function.
1913
1914 2011-07-01  Ian Lance Taylor  <iant@google.com>
1915
1916         PR gold/12571
1917         * options.h (class General_options): Add
1918         --ld-generated-unwind-info.
1919         * ehframe.cc (Fde::write): Add address parameter.  Change all
1920         callers.  If associated with PLT, fill in address and size.
1921         (Cie::set_output_offset): Only add merge mapping if there is an
1922         object.
1923         (Cie::write): Add address parameter.  Change all callers.
1924         (Eh_frame::add_ehframe_for_plt): New function.
1925         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
1926         input_offset_ fields into union u_, with new plt field.
1927         (Fde::Fde): Adjust for new union field.
1928         (Fde::Fde) [Output_data version]: New constructor.
1929         (Fde::add_mapping): Only add merge mapping if there is an object.
1930         (class Cie): Update declarations.
1931         (class Eh_frame): Declare add_ehframe_for_plt.
1932         * layout.cc (Layout::layout_eh_frame): Break out code into
1933         make_eh_frame_section, and call it.
1934         (Layout::make_eh_frame_section): New function.
1935         (Layout::add_eh_frame_for_plt): New function.
1936         * layout.h (class Layout): Update declarations.
1937         * merge.cc (Merge_map::add_mapping): Add assertion.
1938         * i386.cc: Include "dwarf.h".
1939         (class Output_data_plt_i386): Make first_plt_entry,
1940         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
1941         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1942         and plt_eh_frame_fde.
1943         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
1944         boundary.  Call add_eh_frame_for_plt if appropriate.
1945         * x86_64.cc: Include "dwarf.h".
1946         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
1947         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
1948         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
1949         and plt_eh_frame_fde.
1950         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
1951         appropriate.
1952
1953 2011-06-29  Ian Lance Taylor  <iant@google.com>
1954
1955         PR gold/12629
1956         * object.cc (Sized_relobj_file::layout_section): Change shdr
1957         parameter to be const.
1958         (Sized_relobj_file::layout_eh_frame_section): New function, broken
1959         out of do_layout.
1960         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
1961         appropriate.  Call layout_eh_frame_section.
1962         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
1963         sections.
1964         * object.h (class Sized_relobj_file): Update declarations.
1965
1966 2011-06-29  Ian Lance Taylor  <iant@google.com>
1967
1968         PR gold/12652
1969         * script.cc (Token::integer_value): Accept trailing M/m/K/k
1970         modifier.
1971         (Lex::gather_token): Accept trailing M/m/K/k for integers.
1972
1973 2011-06-29  Ian Lance Taylor  <iant@google.com>
1974
1975         PR gold/12675
1976         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
1977         SHT_X86_64_UNWIND.
1978         * layout.cc (Layout::layout_eh_frame): Likewise.
1979
1980 2011-06-29  Ian Lance Taylor  <iant@google.com>
1981
1982         PR gold/12695
1983         * layout.cc (Layout::symtab_section_shndx): New function.
1984         * layout.h (class Layout): Declare symtab_section_shndx.
1985         * output.cc (Output_section::write_header): Call it.
1986
1987 2011-06-29  Ian Lance Taylor  <iant@google.com>
1988
1989         PR gold/12818
1990         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
1991         symbols which are not used in a relocation.
1992
1993 2011-06-28  Ian Lance Taylor  <iant@google.com>
1994
1995         PR gold/12898
1996         * layout.cc (Layout::segment_precedes): Don't crash if a linker
1997         script create indistinguishable segments.
1998         (Layout::set_segment_offsets): Use stable_sort when sorting
1999         segments.  Pass this to Compare_segments constructor.
2000         * layout.h (class Layout): Make segment_precedes non-static.
2001         (class Compare_segments): Change from struct to class.  Add
2002         layout_ field.  Add constructor.
2003         * script-sections.cc
2004         (Script_sections::attach_sections_using_phdrs_clause): Rename
2005         local orphan to is_orphan.  Don't report failure to put empty
2006         section in segment.  On attachment failure, report name of
2007         section, and attach to first PT_LOAD segment.
2008
2009 2011-06-28  Ian Lance Taylor  <iant@google.com>
2010
2011         PR gold/12934
2012         * target-select.cc (Target_selector::Target_selector): Add
2013         emulation parameter.  Change all callers.
2014         (select_target_by_bfd_name): Rename from select_target_by_name.
2015         Change all callers.
2016         (select_target_by_emulation): New function.
2017         (supported_emulation_names): New function.
2018         * target-select.h (class Target_selector): Add emulation_ field.
2019         Update declarations.
2020         (Target_selector::recognize_by_bfd_name): Rename from
2021         recognize_by_name.  Change all callers.
2022         (Target_selector::supported_bfd_names): Rename from
2023         supported_names.  Change all callers.
2024         (Target_selector::recognize_by_emulation): New function.
2025         (Target_selector::supported_emulations): New function.
2026         (Target_selector::emulation): New function.
2027         (Target_selector::do_recognize_by_bfd_name): Rename from
2028         do_recognize_by_name.  Change all callers.
2029         (Target_selector::do_supported_bfd_names): Rename from
2030         do_supported_names.  Change all callers.
2031         (Target_selector::do_recognize_by_emulation): New function.
2032         (Target_selector::do_supported_emulations): New function.
2033         (select_target_by_bfd_name): Change name in declaration.
2034         (select_target_by_emulation): Declare.
2035         (supported_emulation_names): Declare.
2036         * parameters.cc (parameters_force_valid_target): Try to find
2037         target based on emulation from -m option.
2038         * options.h (class General_options): Change doc string for -m.
2039         * options.cc (help): Print emulations.
2040         (General_options::parse_V): Likewise.
2041         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2042         Add emulation parameter.  Change all callers.
2043
2044 2011-06-28  Ian Lance Taylor  <iant@google.com>
2045
2046         * target.h (class Target): Add osabi_ field.
2047         (Target::osabi): New function.
2048         (Target::set_osabi): New function.
2049         (Target::Target): Initialize osabi_.
2050         (Target::do_adjust_elf_header): Make pure virtual.
2051         (Sized_target::do_adjust_elf_header): Declare.
2052         * target.cc (Sized_target::do_adjust_elf_header): New function.
2053         (class Sized_target): Instantiate all versions.
2054         * freebsd.h (class Target_freebsd): Remove.
2055         (Target_selector_freebsd::do_recognize): Call set_osabi on
2056         Target.
2057         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2058         (Target_selector_freebsd::set_osabi): Remove.
2059         * i386.cc (class Target_i386): Inherit from Sized_target rather
2060         than Target_freebsd.
2061         * x86_64.cc (class Target_x86_64): Likewise.
2062
2063 2011-06-28  Ian Lance Taylor  <iant@google.com>
2064
2065         * target.h (Target::can_check_for_function_pointers): Rewrite.
2066         Make non-virtual.
2067         (Target::can_icf_inline_merge_sections): Likewise.
2068         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2069         (Target::Target_info): Add can_icf_inline_merge_sections field.
2070         (Target::do_can_check_for_function_pointers): New virtual
2071         function.
2072         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2073         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2074         from can_check_for_function_pointers, move in file.
2075         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2076         section_may_have_icf_unsafe_poineters, move in file.
2077         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2078         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2079         Rename from can_check_for_function_pointers, move in file.
2080         (Target_i386::can_icf_inline_merge_sections): Remove.
2081         (Target_i386::i386_info): Initialize
2082         can_icf_inline_merge_sections.
2083         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2084         Initialize can_icf_inline_merge_sections.
2085         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2086         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2087         Rename from can_check_for_function_pointers, move in file.
2088         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2089         (Target_x86_64::x86_64_info): Initialize
2090         can_icf_inline_merge_sections.
2091         * testsuite/testfile.cc (Target_test::test_target_info):
2092         Likewise.
2093         * icf.cc (get_section_contents): Correct formatting.
2094
2095 2011-06-27  Ian Lance Taylor  <iant@google.com>
2096
2097         * symtab.cc (Symbol::versioned_name): New function.
2098         (Symbol_table::add_to_final_symtab): Use versioned_name when
2099         appropriate.
2100         (Symbol_table::sized_write_symbol): Likewise.
2101         * symtab.h (class Symbol): Declare versioned_name.
2102         * stringpool.h (class Stringpool_template): Add variant of add
2103         which takes a std::basic_string.
2104         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2105         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2106         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2107         (ver_test_12.o): New target.
2108         * testsuite/Makefile.in: Rebuild.
2109
2110 2011-06-27  Doug Kwan  <dougkwan@google.com>
2111
2112         * arm.cc (Arm_relocate_functions::thm_jump8,
2113         Arm_relocate_functions::thm_jump11): Use a wider signed
2114         type to compute offset.
2115         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2116         arm_thm_jump8.
2117         * testsuite/Makefile.in: Regenerate.
2118         * testsuite/arm_branch_in_range.sh: Check test results of
2119         arm_thm_jump11 and arm_thm_jump8.
2120         * testsuite/arm_thm_jump11.s: New test source file.
2121         * testsuite/arm_thm_jump11.t: New linker script.
2122         * testsuite/arm_thm_jump8.s: New test source file.
2123         * testsuite/arm_thm_jump8.t: New linker script.
2124
2125 2011-06-24  Ian Lance Taylor  <iant@google.com>
2126
2127         * layout.cc: Include "object.h".
2128         (ctors_sections_in_init_array): New static variable.
2129         (Layout::is_ctors_in_init_array): New function.
2130         (Layout::layout): Add entry to ctors_sections_in_init_array if
2131         appropriate.
2132         * layout.h (class Layout): Declare is_ctors_in_init_array.
2133         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2134         is_ctors_reverse_view is set.
2135         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2136         all callers.  Set is_ctors_reverse_view field of View_size.
2137         (Sized_relobj_file::reverse_words): New function.
2138         * object.h (Sized_relobj_file::View_size): Add
2139         is_ctors_reverse_view field.
2140         (class Sized_relobj_file): Update declarations.
2141         * testsuite/initpri3.c: New test.
2142         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2143         initpri3b.
2144         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2145         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2146         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2147         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2148         * testsuite/Makefile.in: Rebuild.
2149
2150 2011-06-24  Cary Coutant  <ccoutant@google.com>
2151
2152         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2153         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2154         (debug_msg_cdebug.err): New targets.
2155         * testsuite/Makefile.in: Regenerate.
2156         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2157         Fix checks for link with shared library.
2158
2159 2011-06-24  Doug Kwan  <dougkwan@google.com>
2160
2161         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2162         skip empty text sections.
2163         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2164
2165 2011-06-22  Ian Lance Taylor  <iant@google.com>
2166
2167         PR gold/12910
2168         * options.h (class General_options): Add --ctors-in-init-array.
2169         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2170         friends as SHT_PROGBITS for merging sections.
2171         (Layout::layout): Remove special handling of .init_array and
2172         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2173         and .dtors if ctors_in_init_array.
2174         (Layout::make_output_section): Force correct section types for
2175         .init_array and friends.  Don't sort if doing relocatable link,
2176         Don't sort .ctors and .dtors if ctors_in_init_array.
2177         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2178         (Layout::output_section_name): Add relobj parameter.  Change all
2179         callers.  Handle .ctors. and .dtors. in code rather than table.
2180         Handle .ctors and .dtors if ctors_in_init_array.
2181         (Layout::match_file_name): New function, moved from output.cc.
2182         * layout.h (class Layout): Update declarations.
2183         * output.cc: Include "layout.h".
2184         (Input_section_sort_entry::get_priority): New function.
2185         (Input_section_sort_entry::match_file_name): Just call
2186         Layout::match_file_name.
2187         (Output_section::Input_section_sort_init_fini_compare::operator()):
2188         Handle .ctors and .dtors.  Sort by explicit priority rather than
2189         by name.
2190         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2191         * testsuite/initpri2.c: New test.
2192         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2193         (check_PROGRAMS): Add initpri2.
2194         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2195         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2196         * configure, testsuite/Makefile.in: Rebuild.
2197
2198 2011-06-19  Ian Lance Taylor  <iant@google.com>
2199
2200         PR gold/12880
2201         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2202         .interp section to a PT_INTERP segment even if we have seen a
2203         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2204         clause in a linker script.
2205         (Layout::finalize): Don't create a .interp section if we've
2206         already create a PT_INTERP segment.
2207         (Layout::create_interp): Always call choose_output_section (revert
2208         patch of 2011-06-17).  Don't create PT_INTERP segment.
2209         * script-sections.cc
2210         (Script_sections::create_note_and_tls_segments): Add a .interp
2211         section to a PT_INTERP segment even if we have seen a
2212         --dynamic-linker option.
2213
2214 2011-06-18  Ian Lance Taylor  <iant@google.com>
2215
2216         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2217         merely because a non-PT_LOAD segment has a dynamic reloc.
2218
2219 2011-06-18  Ian Lance Taylor  <iant@google.com>
2220
2221         * layout.cc (Layout::finish_dynamic_section): Don't create
2222         DT_FLAGS entry if not needed.
2223
2224 2011-06-18  Ian Lance Taylor  <iant@google.com>
2225
2226         PR gold/12745
2227         * layout.cc (Layout::layout_eh_frame): Correct handling of
2228         writable .eh_frame section.
2229
2230 2011-06-17  Ian Lance Taylor  <iant@google.com>
2231
2232         PR gold/12893
2233         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2234         symbol is redefined with the exact same object and value.
2235
2236 2011-06-17  Ian Lance Taylor  <iant@google.com>
2237
2238         PR gold/12880
2239         * layout.h (class Layout): Add interp_segment_ field.
2240         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2241         (Layout::attach_allocated_section_to_segment): If making shared
2242         library, put .interp section in PT_INTERP segment.
2243         (Layout::finalize): Also call create_interp if -dynamic-linker
2244         option was used.
2245         (Layout::create_interp): Assert that there is no PT_INTERP
2246         segment.  If not using a SECTIONS clause, use make_output_section.
2247         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2248         * script-sections.cc
2249         (Script_sections::create_note_and_tls_segments): If making shared
2250         library, put .interp section in PT_INTERP segment.
2251
2252 2011-06-17  Ian Lance Taylor  <iant@google.com>
2253
2254         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2255         when making a shared library.
2256
2257 2011-06-17  Ian Lance Taylor  <iant@google.com>
2258
2259         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2260         parameter.  Change all callers.  Don't issue warning about PC32
2261         against locally defined symbol.
2262
2263 2011-06-16  Ian Lance Taylor  <iant@google.com>
2264
2265         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2266         occurs in same object.
2267
2268 2011-06-14  Alan Modra  <amodra@gmail.com>
2269
2270         * po/POTFILES.in: Regenerate.
2271
2272 2011-06-09  Ian Lance Taylor  <iant@google.com>
2273
2274         * script-sections.cc
2275         (Orphan_output_section::set_section_addresses): For a relocatable
2276         link set address to 0.
2277
2278 2011-06-09  Cary Coutant  <ccoutant@google.com>
2279
2280         PR gold/12804
2281         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2282         used with --compress-debug-sections.
2283         * gold/object.cc (Sized_relobj_file::do_layout): Report
2284         uncompressed size of compressed input sections.
2285
2286 2011-06-08  Cary Coutant  <ccoutant@google.com>
2287
2288         PR gold/12804
2289         * testsuite/two_file_test_2_v1.cc: Change initialization of
2290         v2 to keep it in .data.
2291
2292 2011-06-07  Cary Coutant  <ccoutant@google.com>
2293
2294         * common.cc (Symbol_table::do_allocate_commons_list): Call
2295         gold_fallback.
2296         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2297         (Errors::fallback): New function.
2298         (gold_fallback): New function.
2299         * errors.h (Errors::fallback): New function.
2300         * gold.cc (gold_exit): Change status parameter to enum; adjust
2301         all callers.
2302         (queue_initial_tasks): Call gold_fallback.
2303         * gold.h: Include cstdlib.
2304         (Exit_status): New enum type.
2305         (gold_exit): Change status parameter to enum.
2306         (gold_fallback): New function.
2307         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2308         (Layout::create_symtab_sections): Likewise.
2309         (Layout::create_shdrs): Likewise.
2310         * main.cc (main): Adjust call to gold_exit.
2311         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2312         (Output_data_got::add_got_entry_pair): Likewise.
2313         (Output_section::add_input_section): Likewise.
2314         (Output_section::add_output_section_data): Likewise.
2315         (Output_segment::set_section_list_addresses): Likewise.
2316         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2317
2318 2011-06-07  Cary Coutant  <ccoutant@google.com>
2319
2320         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2321         for incremental links.
2322         * output.cc (Output_segment::set_section_list_addresses): Remove
2323         FIXME and test for TLS or BSS.
2324
2325 2011-06-07  Cary Coutant  <ccoutant@google.com>
2326
2327         * testsuite/Makefile.am: Add incremental_copy_test,
2328         incremental_common_test_1.
2329         * testsuite/Makefile.in: Regenerate.
2330         * testsuite/common_test_1_v1.c: New source file.
2331         * testsuite/common_test_1_v2.c: New source file.
2332         * testsuite/copy_test_v1.cc: New source file.
2333
2334 2011-06-07  Cary Coutant  <ccoutant@google.com>
2335
2336         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2337         update, allocate common from bss section's free list.
2338         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2339         linker-defined symbols.
2340         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2341         Skip GOT and PLT entries that are no longer referenced.
2342         (Output_section_incremental_inputs::write_info_blocks): Mark
2343         linker-defined symbols.
2344         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2345         * output.cc (Output_section::allocate): New function.
2346         * output.h (Output_section::allocate): New function.
2347         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2348         linker-defined symbols.
2349         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2350         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2351         (Symbol::init_base_output_data): Likewise.
2352         (Symbol::init_base_output_segment): Likewise.
2353         (Symbol::init_base_constant): Likewise.
2354         (Sized_symbol::init_output_data): Likewise.
2355         (Sized_symbol::init_output_segment): Likewise.
2356         (Sized_symbol::init_constant): Likewise.
2357         (Symbol_table::do_define_in_output_data): Likewise.
2358         (Symbol_table::do_define_in_output_segment): Likewise.
2359         (Symbol_table::do_define_as_constant): Likewise.
2360         * symtab.h (Symbol::is_predefined): New function.
2361         (Symbol::init_base_output_data): Add is_predefined parameter.
2362         (Symbol::init_base_output_segment): Likewise.
2363         (Symbol::init_base_constant): Likewise.
2364         (Symbol::is_predefined_): New data member.
2365         (Sized_symbol::init_output_data): Add is_predefined parameter.
2366         (Sized_symbol::init_output_segment): Likewise.
2367         (Sized_symbol::init_constant): Likewise.
2368         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2369
2370 2011-06-07  Cary Coutant  <ccoutant@google.com>
2371
2372         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2373         instead of emit_copy_reloc.
2374         (Copy_relocs::emit_copy_reloc): Refactor.
2375         (Copy_relocs::make_copy_reloc): New function.
2376         (Copy_relocs::add_copy_reloc): Remove.
2377         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2378         section.
2379         (Copy_relocs::make_copy_reloc): New function.
2380         (Copy_relocs::add_copy_reloc): Remove.
2381         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2382         unchanged input files.
2383         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2384         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2385         Reserve BSS space for COPY relocations.
2386         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2387         (Output_section_incremental_inputs::write_info_blocks): Record
2388         whether a symbol is copied from a shared object.
2389         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2390         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2391         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2392         (Incremental_input_entry_reader::get_output_symbol_index): Add
2393         is_copy parameter.
2394         (Incremental_binary::emit_copy_relocs): New function.
2395         (Incremental_binary::do_emit_copy_relocs): New function.
2396         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2397         new data member.
2398         (Sized_incremental_binary::add_copy_reloc): New function.
2399         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2400         (Sized_incremental_binary::Copy_reloc): New struct.
2401         (Sized_incremental_binary::Copy_relocs): New typedef.
2402         (Sized_incremental_binary::copy_relocs_): New data member.
2403         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2404         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2405         * target.h (Sized_target::emit_copy_reloc): New function.
2406         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2407
2408 2011-06-02  Cary Coutant  <ccoutant@google.com>
2409
2410         PR gold/12163
2411         * gold/archive.cc (Archive::Archive): Initialize new data member.
2412         (Archive::include_all_members): Return if archive has already been
2413         included.
2414         * gold/archive.h (Archive::include_all_members_): New data member.
2415
2416 2011-06-02  Nick Clifton  <nickc@redhat.com>
2417
2418         * dynobj.h: Fix spelling mistake in comment.
2419         * output.cc: Likewise.
2420
2421 2011-05-31  Doug Kwan  <dougkwan@google.com>
2422             Asier Llano
2423
2424         PR gold/12826
2425         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2426         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2427         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2428         redundant arm_exidx_test.so.
2429         * testsuite/Makefile.in: Regenerate.
2430         (check_SCRIPTS): Add pr12826.sh
2431         (check_DATA): Add pr12826.stdout
2432         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2433         * testsuite/pr12826.sh: New file.
2434         * testsuite/pr12826_1.s: Ditto.
2435         * testsuite/pr12826_1.s: Ditto.
2436
2437 2011-05-30  Ian Lance Taylor  <iant@google.com>
2438
2439         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2440         sections.
2441
2442 2011-05-29  Ian Lance Taylor  <iant@google.com>
2443
2444         PR gold/12804
2445         * testsuite/Makefile.am: Use different file name for two_file_test
2446         temporary file for each incremental test.
2447         * testsuite/Makefile.in: Rebuild.
2448
2449 2011-05-29  Ian Lance Taylor  <iant@google.com>
2450
2451         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2452         binary input file is empty.
2453
2454 2011-05-27  Ian Lance Taylor  <iant@google.com>
2455
2456         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2457         (ver_test_9.so): Likewise.
2458         * testsuite/Makefile.in: Rebuild.
2459
2460 2011-05-26 Cary Coutant  <ccoutant@google.com>
2461
2462         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2463         * incremental.cc (Incremental_inputs::report_input_section): Fix
2464         comment, indentation.
2465         (Incremental_inputs::report_comdat_group): New function.
2466         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2467         of data for incremental input file entry.
2468         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2469         group count, COMDAT group signatures.
2470         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2471         an unchanged input file.
2472         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2473         Initialize new data member.
2474         (Incremental_object_entry::add_comdat_group): New function.
2475         (Incremental_object_entry::get_comdat_group_count): New function.
2476         (Incremental_object_entry::get_comdat_signature_key): New function.
2477         (Incremental_object_entry::groups_): New data member.
2478         (Incremental_inputs::report_comdat_group): New function.
2479         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2480         data for incremental input file entry.
2481         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2482         (Incremental_input_entry_reader::get_input_section): Adjust size of
2483         data for incremental input file entry.
2484         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2485         (Incremental_input_entry_reader::get_comdat_group_signature): New
2486         function.
2487         * object.cc (Sized_relobj::include_section_group): Report kept
2488         COMDAT groups for incremental links.
2489
2490 2011-05-24  David Meyer  <pdox@google.com>
2491
2492         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2493         with name parameter.  Add found_name parameter.
2494         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2495         * dirsearch.h (class Dirsearch): Update declaration.
2496
2497 2011-05-24  Ian Lance Taylor  <iant@google.com>
2498
2499         * archive.cc (Library_base::should_include_member): Pull in object
2500         from archive if it defines the entry symbol.
2501         * parameters.cc (Parameters::entry): New function.
2502         * parameters.h (class Parameters): Declare entry.
2503         * output.h (class Output_file_header): Remove entry_ field.
2504         * output.cc (Output_file_header::Output_file_header): Remove entry
2505         parameter.  Change all callers.
2506         (Output_file_header::entry): Use parameters->entry.
2507         * gold.cc (queue_middle_tasks): Likewise.
2508         * plugin.cc (Plugin_hook::run): Likewise.
2509
2510 2011-05-24 Cary Coutant  <ccoutant@google.com>
2511
2512         * gold.cc (queue_initial_tasks): Pass incremental base filename
2513         to Output_file::open_base_file; don't print error message.
2514         * incremental-dump.cc (main): Adjust call to
2515         Output_file::open_for_modification.
2516         * incremental-dump.cc (main): Likewise.
2517         * incremental.cc (Incremental_inputs::report_command_line):
2518         Ignore --incremental-base option when comparing command lines.
2519         Ignore parameter when given as separate argument.
2520         * options.h (class General_options): Add --incremental-base.
2521         * output.cc (Output_file::Output_file):
2522         (Output_file::open_base_file): Add base_name and writable parameters;
2523         read base file into new file; print error message here.
2524         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2525         callers.
2526         * output.h (Output_file::open_for_modification): Rename to...
2527         (Output_file::open_base_file): ...this; add base_name and
2528         writable parameters; adjust all callers.
2529         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2530         callers.
2531         * testsuite/Makefile.am (incremental_test_4): Test
2532         --incremental-base.
2533         * testsuite/Makefile.in: Regenerate.
2534
2535 2011-05-24 Cary Coutant  <ccoutant@google.com>
2536
2537         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2538         incremental_test_4.
2539         * testsuite/Makefile.in: Regenerate.
2540         * testsuite/two_file_test_1_v1.cc: New test source file.
2541         * testsuite/two_file_test_1b_v1.cc: New test source file.
2542         * testsuite/two_file_test_2_v1.cc: New test source file.
2543
2544 2011-05-24 Cary Coutant  <ccoutant@google.com>
2545
2546         * dynobj.h (Dynobj::do_dynobj): New function.
2547         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2548         flag and soname for shared objects.
2549         * incremental.cc (Incremental_inputs::report_object): Make
2550         either Incremental_object_entry or Incremental_dynobj_entry; add
2551         soname to string table.
2552         (Incremental_inputs::report_input_section): Add assertion.
2553         (Output_section_incremental_inputs::set_final_data_size): Adjust
2554         type of input file entry for shared libraries; adjust size of
2555         shared library info entry.
2556         (Output_section_incremental_inputs::write_input_files): Write
2557         as_needed flag for shared libraries.
2558         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2559         of input file entry for shared libraries; write soname.
2560         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2561         soname from incremental info.
2562         * incremental.h (enum Incremental_input_flags): Add
2563         INCREMENTAL_INPUT_AS_NEEDED.
2564         (Incremental_input_entry::Incremental_input_entry): Initialize new
2565         data member.
2566         (Incremental_input_entry::set_as_needed): New function.
2567         (Incremental_input_entry::as_needed): New function.
2568         (Incremental_input_entry::do_dynobj_entry): New function.
2569         (Incremental_input_entry::as_needed_): New data member.
2570         (Incremental_object_entry::Incremental_object_entry): Don't check
2571         for shared library.
2572         (Incremental_object_entry::do_type): Likewise.
2573         (class Incremental_dynobj_entry): New class.
2574         (Incremental_input_entry_reader::as_needed): New function.
2575         (Incremental_input_entry_reader::get_soname): New function.
2576         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2577         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2578         size of shared library info entry.
2579         * layout.cc (Layout::finish_dynamic_section): Don't test for
2580         incremental link when adding DT_NEEDED entries.
2581         * object.h (Object::Object): Initialize new data member.
2582         (Object::dynobj): New function.
2583         (Object::set_as_needed): New function.
2584         (Object::as_needed): New function.
2585         (Object::do_dynobj): New function.
2586         (Object::as_needed_): New data member.
2587
2588 2011-05-24 Cary Coutant  <ccoutant@google.com>
2589
2590         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2591         info; adjust display of GOT entries.
2592         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2593         vector of input objects; remove file_status_.
2594         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2595         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2596         got_plt reader; call target hooks to reserve GOT entries.
2597         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2598         of input file info header and GOT info entry.
2599         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2600         relocation info.
2601         (Got_plt_view_info::got_descriptor): Remove.
2602         (Got_plt_view_info::sym_index): New data member.
2603         (Got_plt_view_info::input_index): New data member.
2604         (Local_got_offset_visitor::visit): Write input file index.
2605         (Global_got_offset_visitor::visit): Write 0 for input file index.
2606         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2607         with sym_index and input_index.
2608         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2609         incremental info GOT entry; replace got_descriptor with input_index.
2610         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2611         map from input file index to object.
2612         (Sized_relobj_incr::do_layout): Replace direct data member reference
2613         with accessor function.
2614         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2615         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2616         Adjust size of input file info header.
2617         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2618         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2619         (Incremental_input_entry_reader::get_input_section): Adjust size of
2620         input file info header.
2621         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2622         of incremental info GOT entry.
2623         (Incremental_got_plt_reader::get_got_desc): Remove.
2624         (Incremental_got_plt_reader::get_got_symndx): New function.
2625         (Incremental_got_plt_reader::get_got_input_index): New function.
2626         (Sized_incremental_binary::Sized_incremental_binary): Remove
2627         file_status_; add input_objects_.
2628         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2629         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2630         (Sized_incremental_binary::file_is_unchanged): Remove.
2631         (Sized_incremental_binary::set_input_object): New function.
2632         (Sized_incremental_binary::input_object): New function.
2633         (Sized_incremental_binary::file_status_): Remove.
2634         (Sized_incremental_binary::input_objects_): New data member.
2635         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2636         references.
2637         (Sized_relobj_incr::invalid_address): Move to base class.
2638         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2639         class.
2640         (Sized_relobj_incr::do_output_section_offset): Likewise.
2641         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2642         (Sized_relobj_incr::section_offsets_): Likewise.
2643         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2644         function.
2645         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2646         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2647         with accessor function.
2648         (Sized_relobj_file::do_layout): Likewise.
2649         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2650         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2651         (Sized_relobj_file::compute_final_local_value): Replace refs to
2652         section_offsets_ with accessor function.
2653         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2654         * object.h (Relobj::Relobj): Initialize new data members.
2655         (Relobj::add_dyn_reloc): New function.
2656         (Relobj::first_dyn_reloc): New function.
2657         (Relobj::dyn_reloc_count): New function.
2658         (Relobj::first_dyn_reloc_): New data member.
2659         (Relobj::dyn_reloc_count_): New data member.
2660         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2661         references.
2662         (Sized_relobj::Address): New typedef.
2663         (Sized_relobj::invalid_address): Move here from child class.
2664         (Sized_relobj::Sized_relobj): Initialize new data members.
2665         (Sized_relobj::sized_relobj): New function.
2666         (Sized_relobj::is_output_section_offset_invalid): Move here from
2667         child class.
2668         (Sized_relobj::get_output_section_offset): Likewise.
2669         (Sized_relobj::local_has_got_offset): Likewise.
2670         (Sized_relobj::local_got_offset): Likewise.
2671         (Sized_relobj::set_local_got_offset): Likewise.
2672         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2673         (Sized_relobj::clear_got_offsets): New function.
2674         (Sized_relobj::section_offsets): Move here from child class.
2675         (Sized_relobj::do_output_section_offset): Likewise.
2676         (Sized_relobj::do_set_section_offset): Likewise.
2677         (Sized_relobj::Local_got_offsets): Likewise.
2678         (Sized_relobj::local_got_offsets_): Likewise.
2679         (Sized_relobj::section_offsets_): Likewise.
2680         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2681         references.
2682         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2683         class.
2684         (Sized_relobj_file::sized_relobj): New function
2685         (Sized_relobj_file::local_has_got_offset): Move to base class.
2686         (Sized_relobj_file::local_got_offset): Likewise.
2687         (Sized_relobj_file::set_local_got_offset): Likewise.
2688         (Sized_relobj_file::get_output_section_offset): Likewise.
2689         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2690         (Sized_relobj_file::do_output_section_offset): Likewise.
2691         (Sized_relobj_file::do_set_section_offset): Likewise.
2692         (Sized_relobj_file::Local_got_offsets): Likewise.
2693         (Sized_relobj_file::local_got_offsets_): Likewise.
2694         (Sized_relobj_file::section_offsets_): Likewise.
2695         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2696         (all constructors).
2697         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2698         (Output_reloc::get_symbol_index): Likewise.
2699         (Output_reloc::local_section_offset): Likewise.
2700         (Output_reloc::get_address): Likewise.
2701         (Output_reloc::symbol_value): Likewise.
2702         (Output_data_got::reserve_slot): Move to class definition.
2703         (Output_data_got::reserve_local): New function.
2704         (Output_data_got::reserve_slot_for_global): Remove.
2705         (Output_data_got::reserve_global): New function.
2706         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2707         (all constructors, two instantiations).
2708         (Output_reloc::get_relobj): New function (two instantiations).
2709         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2710         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2711         (Output_data_reloc::add_global): Adjust type of relobj.
2712         (Output_data_reloc::add_global_relative): Likewise.
2713         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2714         (Output_data_reloc::add_local): Likewise.
2715         (Output_data_reloc::add_local_relative): Likewise.
2716         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2717         (Output_data_reloc::add_local_section): Likewise.
2718         (Output_data_reloc::add_output_section): Likewise.
2719         (Output_data_reloc::add_absolute): Likewise.
2720         (Output_data_reloc::add_target_specific): Likewise.
2721         (Output_data_got::reserve_slot): Move definition here.
2722         (Output_data_got::reserve_local): New function.
2723         (Output_data_got::reserve_global): New function.
2724         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2725         section_offsets_ with accessor function.
2726         (Sized_relobj_file::write_sections): Likewise.
2727         (Sized_relobj_file::do_relocate_sections): Likewise.
2728         * target.h (Sized_target::reserve_local_got_entry): New function.
2729         (Sized_target::reserve_global_got_entry): New function.
2730         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2731         (Target_x86_64::reserve_global_got_entry): New function.
2732         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2733
2734 2011-05-23 Cary Coutant  <ccoutant@google.com>
2735
2736         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
2737         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
2738         bit when checking got_type.
2739         * incremental.cc (Sized_incremental_binary::setup_readers):
2740         Store symbol table and string table locations; initialize bit vector
2741         of file status flags.
2742         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
2743         unchanged files.
2744         (Sized_incremental_binary::do_process_got_plt): New function.
2745         (Sized_incremental_binary::get_symtab_view): Use stored locations.
2746         (Output_section_incremental_inputs::set_final_data_size): Record
2747         file index for each input file.
2748         (Output_section_incremental_inputs::write_got_plt): Store file index
2749         instead of input entry offset for each GOT entry.
2750         * incremental.h
2751         (Incremental_input_entry::Incremental_input_entry): Initialize new
2752         data member.
2753         (Incremental_input_entry::set_offset): Store file index.
2754         (Incremental_input_entry::get_file_index): New function.
2755         (Incremental_input_entry::file_index_): New data member.
2756         (Incremental_binary::process_got_plt): New function.
2757         (Incremental_binary::do_process_got_plt): New function.
2758         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2759         data members.
2760         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
2761         (Sized_incremental_binary::set_file_is_unchanged): New function.
2762         (Sized_incremental_binary::file_is_unchanged): New function.
2763         (Sized_incremental_binary::do_process_got_plt): New function.
2764         (Sized_incremental_binary::file_status_): New data member.
2765         (Sized_incremental_binary::main_symtab_loc_): New data member.
2766         (Sized_incremental_binary::main_strtab_loc_): New data member.
2767         * output.cc (Output_data_got::Got_entry::write): Add case
2768         RESERVED_CODE.
2769         (Output_data_got::add_global): Call add_got_entry.
2770         (Output_data_got::add_global_plt): Likewise.
2771         (Output_data_got::add_global_with_rel): Likewise.
2772         (Output_data_got::add_global_with_rela): Likewise.
2773         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
2774         (Output_data_got::add_global_pair_with_rela): Likewise.
2775         (Output_data_got::add_local): Call add_got_entry.
2776         (Output_data_got::add_local_plt): Likewise.
2777         (Output_data_got::add_local_with_rel): Likewise.
2778         (Output_data_got::add_local_with_rela): Likewise.
2779         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
2780         (Output_data_got::add_local_pair_with_rela): Likewise.
2781         (Output_data_got::reserve_slot): New function.
2782         (Output_data_got::reserve_slot_for_global): New function.
2783         (Output_data_got::add_got_entry): New function.
2784         (Output_data_got::add_got_entry_pair): New function.
2785         (Output_section::add_output_section_data): Edit FIXME.
2786         * output.h
2787         (Output_section_data_build::Output_section_data_build): New
2788         constructor with size parameter.
2789         (Output_data_space::Output_data_space): Likewise.
2790         (Output_data_got::Output_data_got): Initialize new data member; new
2791         constructor with size parameter.
2792         (Output_data_got::add_constant): Call add_got_entry.
2793         (Output_data_got::reserve_slot): New function.
2794         (Output_data_got::reserve_slot_for_global): New function.
2795         (class Output_data_got::Got_entry): Add RESERVED_CODE.
2796         (Output_data_got::add_got_entry): New function.
2797         (Output_data_got::add_got_entry_pair): New function.
2798         (Output_data_got::free_list_): New data member.
2799         * target.h (Sized_target::init_got_plt_for_update): New function.
2800         (Sized_target::register_global_plt_entry): New function.
2801         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2802         Initialize new data member; call init; add constructor with PLT count.
2803         (Output_data_plt_x86_64::init): New function.
2804         (Output_data_plt_x86_64::add_relocation): New function.
2805         (Output_data_plt_x86_64::reserve_slot): New function.
2806         (Output_data_plt_x86_64::free_list_): New data member.
2807         (Target_x86_64::init_got_plt_for_update): New function.
2808         (Target_x86_64::register_global_plt_entry): New function.
2809         (Output_data_plt_x86_64::add_entry): Allocate from free list for
2810         incremental updates.
2811         (Output_data_plt_x86_64::add_relocation): New function.
2812         * testsuite/object_unittest.cc (Object_test): Set default options.
2813
2814 2011-05-16  Ian Lance Taylor  <iant@google.com>
2815
2816         * options.h (class General_options): Make -i a synonym for -r.
2817
2818 2011-05-16  Ian Lance Taylor  <iant@google.com>
2819
2820         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
2821
2822 2011-05-10 Cary Coutant  <ccoutant@google.com>
2823
2824         * object.cc (Sized_relobj::do_count_local_symbols): Check for
2825         strip_all (-s).
2826
2827 2011-05-06  Ian Lance Taylor  <iant@google.com>
2828
2829         * layout.cc (Layout::layout): If the output section flags change,
2830         update the ordering.
2831
2832 2011-04-25 Cary Coutant  <ccoutant@google.com>
2833
2834         * incremental-dump.cc (dump_incremental_inputs): Print local
2835         symbol info for each input file.
2836         * incremental.cc
2837         (Output_section_incremental_inputs::set_final_data_size): Add local
2838         symbol info to input file entries in incremental info.
2839         (Output_section_incremental_inputs::write_info_blocks): Likewise.
2840         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
2841         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
2842         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
2843         implementation.
2844         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
2845         (Sized_incr_relobj::do_relocate): Write the local symbols.
2846         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
2847         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
2848         Adjust size of input file header.
2849         (Incremental_inputs_reader::get_local_symbol_offset): New function.
2850         (Incremental_inputs_reader::get_local_symbol_count): New function.
2851         (Incremental_inputs_reader::get_input_section): Adjust size of input
2852         file header.
2853         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
2854         (Sized_incr_relobj::This): New typedef.
2855         (Sized_incr_relobj::sym_size): New const data member.
2856         (Sized_incr_relobj::Local_symbol): New struct.
2857         (Sized_incr_relobj::do_output_local_symbol_count): New function.
2858         (Sized_incr_relobj::do_local_symbol_offset): New function.
2859         (Sized_incr_relobj::local_symbol_count_): New data member.
2860         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
2861         (Sized_incr_relobj::local_symbol_index_): New data member.
2862         (Sized_incr_relobj::local_symbol_offset_): New data member.
2863         (Sized_incr_relobj::local_dynsym_offset_): New data member.
2864         (Sized_incr_relobj::local_symbols_): New data member.
2865         * object.h (Relobj::output_local_symbol_count): New function.
2866         (Relobj::local_symbol_offset): New function.
2867         (Relobj::do_output_local_symbol_count): New function.
2868         (Relobj::do_local_symbol_offset): New function.
2869         (Sized_relobj::do_output_local_symbol_count): New function.
2870         (Sized_relobj::do_local_symbol_offset): New function.
2871
2872 2011-04-22  Vladimir Simonov  <sv@sw.ru>
2873
2874         * descriptors.cc (set_close_on_exec): New function.
2875         (Descriptors::open): Use set_close_on_exec.
2876         * output.cc (S_ISLNK): Define if not defined.
2877
2878 2011-04-22 Cary Coutant  <ccoutant@google.com>
2879
2880         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2881         global symbol map.
2882         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2883         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
2884         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
2885         relocations.
2886         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
2887         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
2888         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
2889         * incremental.h
2890         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
2891         function.
2892         (Incremental_binary::apply_incremental_relocs): New function.
2893         (Incremental_binary::do_apply_incremental_relocs): New function.
2894         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
2895         data member.
2896         (Sized_incremental_binary::add_global_symbol): New function.
2897         (Sized_incremental_binary::global_symbol): New function.
2898         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
2899         (Sized_incremental_binary::symbol_map_): New data member.
2900         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
2901         * target.h (Sized_target::apply_relocation): New function.
2902         * target-reloc.h (apply_relocation): New function.
2903         * x86_64.cc (Target_x86_64::apply_relocation): New function.
2904
2905 2011-04-22  Doug Kwan  <dougkwan@google.com>
2906
2907         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
2908         flag of a SHT_ARM_EXIDX section.
2909         * testsuite/Makefile.am (arm_exidx_test): New test rules.
2910         * testsuite/Makefile.in: Regenerate.
2911         * testsuite/arm_exidx_test.s: New file.
2912         * testsuite/arm_exidx_test.sh: Same.
2913
2914 2011-04-20 Cary Coutant  <ccoutant@google.com>
2915
2916         PR gold/12689
2917         * archive.h (Incremental_archive_entry::Archive_member):
2918         Initialize arg_serial_ (second constructor).
2919
2920 2011-04-17  Ian Lance Taylor  <iant@google.com>
2921
2922         * object.cc (Relocate_info::location): Simplify location string.
2923         * errors.cc (Errors::error_at_location): Don't print program
2924         name.
2925         (Errors::warning_at_location): Likewise.
2926         (Errors::undefined_symbol): Likewise.
2927         * testsuite/debug_msg.sh: Update accordingly.
2928
2929 2011-04-14 Cary Coutant  <ccoutant@google.com>
2930
2931         * gold/layout.cc (Layout::symtab_section_offset): New function.
2932         * gold/layout.h (Layout::symtab_section_offset): New function.
2933         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
2934
2935 2011-04-12  Ian Lance Taylor  <iant@google.com>
2936
2937         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
2938         with MREMAP_MAYMOVE.
2939         * output.h (class Output_file): Add map_is_allocated_ field.
2940         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
2941         not available, provide stubs.  If mremap is not available, #define
2942         it to gold_mremap.
2943         (MREMAP_MAYMOVE): Define if not defined.
2944         (Output_file::Output_file): Initialize map_is_allocated_.
2945         (Output_file::resize): Check map_is_allocated_.
2946         (Output_file::map_anonymous): If mmap fails, use malloc.
2947         (Output_file::unmap): Don't do anything for an anonymous map.
2948         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
2949         is not available, provide stubs.
2950         (File_read::View::~View): Use free rather than delete[].
2951         (File_read::make_view): Use malloc rather than new[].  If mmap
2952         fails, use malloc.
2953         (File_read::find_or_make_view): Use malloc rather than new[].
2954         * gold.h: Remove HAVE_REMAP code.
2955         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
2956         exists.  Rename mremap to gold_mremap.  If mmap is not available
2957         don't do anything.
2958         * configure, config.in: Rebuild.
2959
2960 2011-04-11  Ian Lance Taylor  <iant@google.com>
2961
2962         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
2963         initialize local variable v.
2964
2965 2011-04-11  Cary Coutant  <ccoutant@google.com>
2966
2967         * archive.cc (Archive::include_member): Adjust call to
2968         report_object.
2969         (Add_archive_symbols::run): Track argument serial numbers.
2970         (Lib_group::include_member): Likewise.
2971         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
2972         * archive.h (Incremental_archive_entry::Archive_member):
2973         Initialize arg_serial_.
2974         (Archive_member::arg_serial_): New data member.
2975         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
2976         (Sized_dynobj::do_add_symbols): Track symbols when doing an
2977         incremental link.
2978         (Sized_dynobj::do_for_all_local_got_entries): New function.
2979         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
2980         function.
2981         * fileread.cc (get_mtime): New function.
2982         * fileread.h (get_mtime): New function.
2983         * gold.cc (queue_initial_tasks): Check for incremental update.
2984         (process_incremental_input): New function.
2985         (queue_middle_tasks): Don't force valid target for incremental
2986         update.
2987         * incremental-dump.cc (find_input_containing_global): Adjust
2988         size of symbol info entry.
2989         (dump_incremental_inputs): Dump argument serial number and
2990         in_system_directory flag; bias shndx by 1; print symbol names
2991         when dumping per-file symbol lists; use new symbol info readers.
2992         * incremental.cc
2993         (Output_section_incremental_inputs:update_data_size): New function.
2994         (Sized_incremental_binary::setup_readers): Setup input readers
2995         for each input file; build maps for files added from libraries
2996         and scripts.
2997         (Sized_incremental_binary::check_input_args): New function.
2998         (Sized_incremental_binary::do_check_inputs): Build map of argument
2999         serial numbers to input arguments.
3000         (Sized_incremental_binary::do_file_has_changed): Rename
3001         do_file_is_unchanged to this; compare file modification times.
3002         (Sized_incremental_binary::do_init_layout): New function.
3003         (Sized_incremental_binary::do_reserve_layout): New function.
3004         (Sized_incremental_binary::do_get_input_reader): Remove.
3005         (Sized_incremental_binary::get_symtab_view): New function.
3006         (Incremental_checker::can_incrementally_link_output_file): Remove.
3007         (Incremental_inputs::report_command_line): Exclude --debug options.
3008         (Incremental_inputs::report_archive_begin): Add parameter; track
3009         argument serial numbers; don't put input file entry for archive
3010         before archive members.
3011         (Incremental_inputs::report_archive_end): Put input file entry
3012         for archive after archive members.
3013         (Incremental_inputs::report_object): Add parameter; track argument
3014         serial numbers and in_system_directory flag.
3015         (Incremental_inputs::report_script): Add parameter; track argument
3016         serial numbers.
3017         (Output_section_incremental_inputs::set_final_data_size): Adjust
3018         size of symbol info entry; check for forwarding symbols.
3019         (Output_section_incremental_inputs::write_input_files): Write
3020         in_system_directory flag and argument serial number.
3021         (Output_section_incremental_inputs::write_info_blocks): Map section
3022         indices between incremental info and original input file; store
3023         input section index for each symbol.
3024         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3025         change operator() to visit().
3026         (class Global_got_offset_visitor): Likewise.
3027         (class Global_symbol_visitor_got_plt):
3028         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3029         classes.
3030         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3031         (Sized_incr_relobj::do_read_symbols): New function.
3032         (Sized_incr_relobj::do_layout): New function.
3033         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3034         (Sized_incr_relobj::do_add_symbols): New function.
3035         (Sized_incr_relobj::do_should_include_member): New function.
3036         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3037         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3038         (Sized_incr_relobj::do_section_size): New function.
3039         (Sized_incr_relobj::do_section_name): New function.
3040         (Sized_incr_relobj::do_section_contents): New function.
3041         (Sized_incr_relobj::do_section_flags): New function.
3042         (Sized_incr_relobj::do_section_entsize): New function.
3043         (Sized_incr_relobj::do_section_address): New function.
3044         (Sized_incr_relobj::do_section_type): New function.
3045         (Sized_incr_relobj::do_section_link): New function.
3046         (Sized_incr_relobj::do_section_info): New function.
3047         (Sized_incr_relobj::do_section_addralign): New function.
3048         (Sized_incr_relobj::do_initialize_xindex): New function.
3049         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3050         (Sized_incr_relobj::do_read_relocs): New function.
3051         (Sized_incr_relobj::do_gc_process_relocs): New function.
3052         (Sized_incr_relobj::do_scan_relocs): New function.
3053         (Sized_incr_relobj::do_count_local_symbols): New function.
3054         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3055         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3056         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3057         (Sized_incr_relobj::do_relocate): New function.
3058         (Sized_incr_relobj::do_set_section_offset): New function.
3059         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3060         (Sized_incr_dynobj::do_read_symbols): New function.
3061         (Sized_incr_dynobj::do_layout): New function.
3062         (Sized_incr_dynobj::do_add_symbols): New function.
3063         (Sized_incr_dynobj::do_should_include_member): New function.
3064         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3065         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3066         (Sized_incr_dynobj::do_section_size): New function.
3067         (Sized_incr_dynobj::do_section_name): New function.
3068         (Sized_incr_dynobj::do_section_contents): New function.
3069         (Sized_incr_dynobj::do_section_flags): New function.
3070         (Sized_incr_dynobj::do_section_entsize): New function.
3071         (Sized_incr_dynobj::do_section_address): New function.
3072         (Sized_incr_dynobj::do_section_type): New function.
3073         (Sized_incr_dynobj::do_section_link): New function.
3074         (Sized_incr_dynobj::do_section_info): New function.
3075         (Sized_incr_dynobj::do_section_addralign): New function.
3076         (Sized_incr_dynobj::do_initialize_xindex): New function.
3077         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3078         (make_sized_incremental_object): New function.
3079         (Incremental_library::copy_unused_symbols): New function.
3080         (Incremental_library::do_for_all_unused_symbols): New function.
3081         * incremental.h (enum Incremental_input_flags): New type.
3082         (class Incremental_checker): Remove.
3083         (Incremental_input_entry::Incremental_input_entry): Add argument
3084         serial number.
3085         (Incremental_input_entry::arg_serial): New function.
3086         (Incremental_input_entry::set_is_in_system_directory): New function.
3087         (Incremental_input_entry::is_in_system_directory): New function.
3088         (Incremental_input_entry::arg_serial_): New data member.
3089         (Incremental_input_entry::is_in_system_directory_): New data member.
3090         (class Script_info): Move here from script.h.
3091         (Script_info::Script_info): Add filename parameter.
3092         (Script_info::filename): New function.
3093         (Script_info::filename_): New data member.
3094         (Incremental_script_entry::Incremental_script_entry): Add argument
3095         serial number.
3096         (Incremental_object_entry::Incremental_object_entry): Likewise.
3097         (Incremental_object_entry::add_input_section): Build list of input
3098         sections with map to original shndx.
3099         (Incremental_object_entry::get_input_section_index): New function.
3100         (Incremental_object_entry::shndx_): New data member.
3101         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3102         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3103         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3104         serial number.
3105         (Incremental_inputs::report_archive_begin): Likewise.
3106         (Incremental_inputs::report_object): Likewise.
3107         (Incremental_inputs::report_script): Likewise.
3108         (class Incremental_global_symbol_reader): New class.
3109         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3110         and store flags and input file type.
3111         (Incremental_input_entry_reader::arg_serial): New function.
3112         (Incremental_input_entry_reader::type): Extract type from flags.
3113         (Incremental_input_entry_reader::is_in_system_directory): New function.
3114         (Incremental_input_entry_reader::get_input_section_count): Call
3115         accessor function for type.
3116         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3117         function for type; adjust size of global symbol entry.
3118         (Incremental_input_entry_reader::get_global_symbol_count): Call
3119         accessor function for type.
3120         (Incremental_input_entry_reader::get_object_count): Likewise.
3121         (Incremental_input_entry_reader::get_object_offset): Likewise.
3122         (Incremental_input_entry_reader::get_member_count): Likewise.
3123         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3124         (Incremental_input_entry_reader::get_member_offset): Likewise.
3125         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3126         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3127         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3128         (Incremental_input_entry_reader::get_global_symbol_reader): New
3129         function.
3130         (Incremental_input_entry_reader::get_output_symbol_index): New
3131         function.
3132         (Incremental_input_entry_reader::type_): Remove.
3133         (Incremental_input_entry_reader::flags_): New data member.
3134         (Incremental_inputs_reader::input_file_offset): New function.
3135         (Incremental_inputs_reader::input_file_index): New function.
3136         (Incremental_inputs_reader::input_file): Call input_file_offset.
3137         (Incremental_inputs_reader::input_file_at_offset): New function.
3138         (Incremental_relocs_reader::get_r_type): Reformat.
3139         (Incremental_relocs_reader::get_r_shndx): Reformat.
3140         (Incremental_relocs_reader::get_r_offset): Reformat.
3141         (Incremental_relocs_reader::data): New function.
3142         (Incremental_binary::Incremental_binary): Initialize new data members.
3143         (Incremental_binary::check_inputs): Add cmdline parameter.
3144         (Incremental_binary::file_is_unchanged): Remove.
3145         (Input_reader::arg_serial): New function.
3146         (Input_reader::get_unused_symbol_count): New function.
3147         (Input_reader::get_unused_symbol): New function.
3148         (Input_reader::do_arg_serial): New function.
3149         (Input_reader::do_get_unused_symbol_count): New function.
3150         (Input_reader::do_get_unused_symbol): New function.
3151         (Incremental_binary::input_file_count): New function.
3152         (Incremental_binary::get_input_reader): Change signature to use
3153         index instead of filename.
3154         (Incremental_binary::file_has_changed): New function.
3155         (Incremental_binary::get_input_argument): New function.
3156         (Incremental_binary::get_library): New function.
3157         (Incremental_binary::get_script_info): New function.
3158         (Incremental_binary::init_layout): New function.
3159         (Incremental_binary::reserve_layout): New function.
3160         (Incremental_binary::output_file): New function.
3161         (Incremental_binary::do_check_inputs): New function.
3162         (Incremental_binary::do_file_is_unchanged): Remove.
3163         (Incremental_binary::do_file_has_changed): New function.
3164         (Incremental_binary::do_init_layout): New function.
3165         (Incremental_binary::do_reserve_layout): New function.
3166         (Incremental_binary::do_input_file_count): New function.
3167         (Incremental_binary::do_get_input_reader): Change signature.
3168         (Incremental_binary::input_args_map_): New data member.
3169         (Incremental_binary::library_map_): New data member.
3170         (Incremental_binary::script_map_): New data member.
3171         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3172         new data members.
3173         (Sized_incremental_binary::output_section): New function.
3174         (Sized_incremental_binary::inputs_reader): Add const.
3175         (Sized_incremental_binary::symtab_reader): Add const.
3176         (Sized_incremental_binary::relocs_reader): Add const.
3177         (Sized_incremental_binary::got_plt_reader): Add const.
3178         (Sized_incremental_binary::get_symtab_view): New function.
3179         (Sized_incremental_binary::Inputs_reader): New typedef.
3180         (Sized_incremental_binary::Input_entry_reader): New typedef.
3181         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3182         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3183         (Sized_incremental_binary::do_file_has_changed): New function.
3184         (Sized_incremental_binary::do_init_layout): New function.
3185         (Sized_incremental_binary::do_reserve_layout): New function.
3186         (Sized_input_reader::Inputs_reader): Remove.
3187         (Sized_input_reader::Input_entry_reader): Remove.
3188         (Sized_input_reader::do_arg_serial): New function.
3189         (Sized_input_reader::do_get_unused_symbol_count): New function.
3190         (Sized_input_reader::do_get_unused_symbol): New function.
3191         (Sized_incremental_binary::do_input_file_count): New function.
3192         (Sized_incremental_binary::do_get_input_reader): Change signature;
3193         use index instead of filename.
3194         (Sized_incremental_binary::section_map_): New data member.
3195         (Sized_incremental_binary::input_entry_readers_): New data member.
3196         (class Sized_incr_relobj): New class.
3197         (class Sized_incr_dynobj): New class.
3198         (make_sized_incremental_object): New function.
3199         (class Incremental_library): New class.
3200         * layout.cc (Free_list::num_lists): New static data member.
3201         (Free_list::num_nodes): New static data member.
3202         (Free_list::num_removes): New static data member.
3203         (Free_list::num_remove_visits): New static data member.
3204         (Free_list::num_allocates): New static data member.
3205         (Free_list::num_allocate_visits): New static data member.
3206         (Free_list::init): New function.
3207         (Free_list::remove): New function.
3208         (Free_list::allocate): New function.
3209         (Free_list::dump): New function.
3210         (Free_list::print_stats): New function.
3211         (Layout_task_runner::run): Resize output file for incremental updates.
3212         (Layout::Layout): Initialize new data members.
3213         (Layout::set_incremental_base): New function.
3214         (Layout::init_fixed_output_section): New function.
3215         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3216         incremental updates.
3217         (Layout::create_gold_note): Do not create gold note section for
3218         incremental updates.
3219         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3220         for incremental updates.
3221         (Layout::set_section_offsets): For incremental updates, allocate space
3222         from free list.
3223         (Layout::create_symtab_sections): Layout with offsets relative to
3224         start of section; for incremental updates, allocate space from free
3225         list.
3226         (Layout::create_shdrs): For incremental updates, allocate space from
3227         free list.
3228         (Layout::finish_dynamic_section): For incremental updates, do not
3229         check --as-needed (fixed in subsequent patch).
3230         * layout.h (class Free_list): New class.
3231         (Layout::set_incremental_base): New function.
3232         (Layout::incremental_base): New function.
3233         (Layout::init_fixed_output_section): New function.
3234         (Layout::allocate): New function.
3235         (Layout::incremental_base_): New data member.
3236         (Layout::free_list_): New data member.
3237         * main.cc (main): Print Free_list statistics.
3238         * object.cc (Relobj::finalize_incremental_relocs): Add
3239         clear_counts parameter; clear counts only when clear_counts is set.
3240         (Sized_relobj::Sized_relobj): Initialize new base class.
3241         (Sized_relobj::do_layout): Don't report special sections.
3242         (Sized_relobj::do_for_all_local_got_entries): New function.
3243         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3244         symtab_off to all symbol table offsets.
3245         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3246         * object.h (class Got_offset_list): Move to top of file.
3247         (Object::Object): Allow case where input_file == NULL.
3248         (Object::~Object): Likewise.
3249         (Object::input_file): Assert that input_file != NULL.
3250         (Object::lock): Allow case where input_file == NULL.
3251         (Object::unlock): Likewise.
3252         (Object::is_locked): Likewise.
3253         (Object::token): Likewise.
3254         (Object::release): Likewise.
3255         (Object::is_incremental): New function.
3256         (Object::get_mtime): New function.
3257         (Object::for_all_local_got_entries): New function.
3258         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3259         (Object::set_is_in_system_directory): New function.
3260         (Object::is_in_system_directory): New function.
3261         (Object::do_is_incremental): New function.
3262         (Object::do_get_mtime): New function.
3263         (Object::do_for_all_local_got_entries): New function.
3264         (Object::is_in_system_directory_): New data member.
3265         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3266         (class Sized_relobj_base): New class.
3267         (class Sized_relobj): Derive from Sized_relobj_base.
3268         (class Sized_relobj::Symbols): Redeclare from base class.
3269         (class Sized_relobj::local_got_offset_list): Remove.
3270         (class Sized_relobj::Output_sections): Redeclare from base class.
3271         (class Sized_relobj::do_for_all_local_got_entries): New function.
3272         (class Sized_relobj::write_local_symbols): Add offset parameter.
3273         (class Sized_relobj::local_symbol_offset_): Update comment.
3274         (class Sized_relobj::local_dynsym_offset_): Update comment.
3275         * options.cc (Input_arguments::add_file): Remove const.
3276         * options.h (Input_file_argument::Input_file_argument):
3277         Initialize arg_serial_ (all constructors).
3278         (Input_file_argument::set_arg_serial): New function.
3279         (Input_file_argument::arg_serial): New function.
3280         (Input_file_argument::arg_serial_): New data member.
3281         (Input_arguments::Input_arguments): Initialize file_count_.
3282         (Input_arguments::add_file): Remove const.
3283         (Input_arguments::number_of_input_files): New function.
3284         (Input_arguments::file_count_): New data member.
3285         (Command_line::number_of_input_files): Call
3286         Input_arguments::number_of_input_files.
3287         * output.cc (Output_segment_headers::Output_segment_headers):
3288         Set current size.
3289         (Output_section::Input_section::current_data_size): New function.
3290         (Output_section::Output_section): Initialize new data members.
3291         (Output_section::add_input_section): Don't do merge sections for
3292         an incremental link; allocate space from free list for an
3293         incremental update.
3294         (Output_section::add_output_section_data): Allocate space from
3295         free list for an incremental update.
3296         (Output_section::update_data_size): New function.
3297         (Output_section::set_fixed_layout): New function.
3298         (Output_section::reserve): New function.
3299         (Output_segment::set_section_addresses): Remove const.
3300         (Output_segment::set_section_list_addresses): Remove const; allocate
3301         space from free list for an incremental update.
3302         (Output_segment::set_offset): Adjust size of RELRO segment for an
3303         incremental update.
3304         * output.h (Output_data::current_data_size): Move here from
3305         child classes.
3306         (Output_data::pre_finalize_data_size): New function.
3307         (Output_data::update_data_size): New function.
3308         (Output_section_headers::update_data_size): new function.
3309         (Output_section_data_build::current_data_size): Move to Output_data.
3310         (Output_data_strtab::update_data_size): New function.
3311         (Output_section::current_data_size): Move to Output_data.
3312         (Output_section::set_fixed_layout): New function.
3313         (Output_section::has_fixed_layout): New function.
3314         (Output_section::reserve): New function.
3315         (Output_section::update_data_size): New function.
3316         (Output_section::has_fixed_layout_): New data member.
3317         (Output_section::free_list_): New data member.
3318         (Output_segment::set_section_addresses): Remove const.
3319         (Output_segment::set_section_list_addresses): Remove const.
3320         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3321         New function.
3322         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3323         New function.
3324         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3325         parameter when calling Add_symbols constructor; store argument
3326         serial number for members of a lib group.
3327         (Add_symbols::locks): Allow case where token == NULL.
3328         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3329         (Read_member::~Read_member): New function.
3330         (Read_member::is_runnable): New function.
3331         (Read_member::locks): New function.
3332         (Read_member::run): New function.
3333         (Check_script::~Check_script): New function.
3334         (Check_script::is_runnable): New function.
3335         (Check_script::locks): New function.
3336         (Check_script::run): New function.
3337         (Check_library::~Check_library): New function.
3338         (Check_library::is_runnable): New function.
3339         (Check_library::locks): New function.
3340         (Check_library::run): New function.
3341         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3342         (Add_symbols::library_): New data member.
3343         (class Read_member): New class.
3344         (class Check_script): New class.
3345         (class Check_library): New class.
3346         * reloc.cc (Read_relocs::is_runnable): Allow case where
3347         token == NULL.
3348         (Read_relocs::locks): Likewise.
3349         (Scan_relocs::locks): Likewise.
3350         (Relocate_task::locks): Likewise.
3351         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3352         to clear counters.
3353         (Sized_relobj::incremental_relocs_scan): Fix comment.
3354         (Sized_relobj::do_relocate): Pass output file offset to
3355         write_local_symbols.
3356         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3357         from class declaration.
3358         * script.cc (read_input_script): Allocate Script_info; pass
3359         argument serial number to report_script.
3360         * script.h (class Script_info): Move to incremental.h.
3361         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3362         * symtab.h (Symbol_table::add_from_incrobj): New function.
3363         (Symbol_table::set_file_offset): New function.
3364
3365 2011-04-05  Cary Coutant  <ccoutant@google.com>
3366
3367         * incremental-dump.cc (dump_incremental_inputs): Change signature
3368         to take a Sized_incremental_binary; change caller.  Use readers
3369         in Sized_incremental_binary.
3370         * incremental.cc
3371         (Sized_incremental_binary::find_incremental_inputs_sections):
3372         Rename do_find_incremental_inputs_sections to this.
3373         (Sized_incremental_binary::setup_readers): New function.
3374         (Sized_incremental_binary::do_check_inputs): Check
3375         has_incremental_info_ flag; move setup code to setup_readers;
3376         use input readers.
3377         (Sized_incremental_binary::do_file_is_unchanged): New function.
3378         (Sized_incremental_binary::do_get_input_reader): New function.
3379         * incremental.h (class Incremental_binary): Move to end of file.
3380         (Incremental_binary::file_is_unchanged): New function.
3381         (Incremental_binary::do_file_is_unchanged): New function.
3382         (Incremental_binary::Input_reader): New class.
3383         (Incremental_binary::get_input_reader): New function.
3384         (class Sized_incremental_binary): Move to end of file.
3385         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3386         input section reader classes.
3387         (Sized_incremental_binary::has_incremental_info): New function.
3388         (Sized_incremental_binary::inputs_reader): New function.
3389         (Sized_incremental_binary::symtab_reader): New function.
3390         (Sized_incremental_binary::relocs_reader): New function.
3391         (Sized_incremental_binary::got_plt_reader): New function.
3392         (Sized_incremental_binary::do_file_is_unchanged): New function.
3393         (Sized_incremental_binary::Sized_input_reader): New class.
3394         (Sized_incremental_binary::get_input_reader): New function.
3395         (Sized_incremental_binary::find_incremental_inputs_sections):
3396         Rename do_find_incremental_inputs_sections to this.
3397         (Sized_incremental_binary::setup_readers): New function.
3398         (Sized_incremental_binary::has_incremental_info_): New data member.
3399         (Sized_incremental_binary::inputs_reader_): New data member.
3400         (Sized_incremental_binary::symtab_reader_): New data member.
3401         (Sized_incremental_binary::relocs_reader_): New data member.
3402         (Sized_incremental_binary::got_plt_reader_): New data member.
3403         (Sized_incremental_binary::current_input_file_): New data member.
3404
3405 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3406
3407         PR gold/12640
3408         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3409         violation.
3410
3411 2011-03-30  Cary Coutant  <ccoutant@google.com>
3412
3413         * archive.cc (Archive::include_member): Adjust call to report_object.
3414         (Add_archive_symbols::run): Add script_info to call to
3415         report_archive_begin.
3416         (Lib_group::include_member): Adjust call to report_object.
3417         (Add_lib_group_symbols::run): Adjust call to report_object.
3418         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3419         blocks.  Add object count for script input files.
3420         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3421         script_info parameter; change all callers.
3422         (Incremental_inputs::report_object): Add script_info parameter;
3423         change all callers.
3424         (Incremental_inputs::report_script): Store backpointer to
3425         incremental info entry.
3426         (Output_section_incremental_inputs::set_final_data_size): Record
3427         additional information for scripts.
3428         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3429         * incremental.h (Incremental_script_entry::add_object): New function.
3430         (Incremental_script_entry::get_object_count): New function.
3431         (Incremental_script_entry::get_object): New function.
3432         (Incremental_script_entry::objects_): New data member; adjust
3433         constructor.
3434         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3435         (Incremental_inputs::report_object): Add script_info parameter.
3436         (Incremental_inputs_reader::get_object_count): New function.
3437         (Incremental_inputs_reader::get_object_offset): New function.
3438         * options.cc (Input_arguments::add_file): Return reference to
3439         new input argument.
3440         * options.h (Input_argument::set_script_info): New function.
3441         (Input_argument::script_info): New function.
3442         (Input_argument::script_info_): New data member; adjust all
3443         constructors.
3444         (Input_file_group::add_file): Return reference to new input argument.
3445         (Input_file_lib::add_file): Likewise.
3446         (Input_arguments::add_file): Likewise.
3447         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3448         * script.cc (Parser_closure::Parser_closure): Add script_info
3449         parameter; adjust all callers.
3450         (Parser_closure::script_info): New function.
3451         (Parser_closure::script_info_): New data member.
3452         (read_input_script): Report scripts earlier to incremental info.
3453         (script_add_file): Set script_info in Input_argument.
3454         (script_add_library): Likewise.
3455         * script.h (Script_options::Script_info): Rewrite class.
3456
3457 2011-03-29  Cary Coutant  <ccoutant@google.com>
3458
3459         * archive.cc (Library_base::should_include_member): Move
3460         method here from class Archive.
3461         (Archive::Archive): Initialize base class.
3462         (Archive::should_include_member): Move to base class.
3463         (Archive::do_for_all_unused_symbols): New function.
3464         (Add_archive_symbols::run): Remove redundant access to
3465         incremental_inputs.
3466         (Lib_group::Lib_group): Initialize base class.
3467         (Lib_group::do_filename): New function.
3468         (Lib_group::include_member): Pass pointer to Lib_group to
3469         report_object.
3470         (Lib_group::do_for_all_unused_symbols): New function.
3471         (Add_lib_group_symbols::run): Report archive information for
3472         incremental links.
3473         * archive.h (class Library_base): New base class.
3474         (class Archive): Derive from Library_base.
3475         (Archive::filename): Move to base class.
3476         (Archive::set_incremental_info): Likewise.
3477         (Archive::incremental_info): Likewise.
3478         (Archive::Should_include): Likewise.
3479         (Archive::should_include_member): Likewise.
3480         (Archive::Armap_entry): Remove.
3481         (Archive::Unused_symbol_iterator): Remove.
3482         (Archive::unused_symbols_begin): Remove.
3483         (Archive::unused_symbols_end): Remove.
3484         (Archive::do_filename): New function.
3485         (Archive::do_get_mtime): New function.
3486         (Archive::do_for_all_unused_symbols): New function.
3487         (Archive::task_): Move to base class.
3488         (Archive::incremental_info_): Likewise.
3489         (class Lib_group): Derive from Library_base.
3490         (Lib_group::do_filename): New function.
3491         (Lib_group::do_get_mtime): New function.
3492         (Lib_group::do_for_all_unused_symbols): New function.
3493         (Lib_group::task_): Move to base class.
3494         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3495         function.
3496         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3497         function.
3498         * incremental.cc (Incremental_inputs::report_archive_begin):
3499         Use Library_base; call library's get_mtime; add incremental inputs
3500         entry before members.
3501         (class Unused_symbol_visitor): New class.
3502         (Incremental_inputs::report_archive_end): Use Library_base; use
3503         visitor class to record unused symbols; don't add incremental inputs
3504         entry after members.
3505         (Incremental_inputs::report_object): Use Library_base.
3506         * incremental.h
3507         (Incremental_archive_entry::Incremental_archive_entry): Remove
3508         unused Archive parameter.
3509         (Incremental_inputs::report_archive_begin): Use Library_base.
3510         (Incremental_inputs::report_archive_end): Likewise.
3511         (Incremental_inputs::report_object): Likewise.
3512         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3513         function.
3514         * object.h (Object::for_all_global_symbols): New function.
3515         (Object::do_for_all_global_symbols): New function.
3516         (Sized_relobj::do_for_all_global_symbols): New function.
3517         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3518         function.
3519         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3520         function.
3521
3522 2011-03-27  Ian Lance Taylor  <iant@google.com>
3523
3524         * archive.cc (Archive::interpret_header): Return -1 if something
3525         goes wrong.  Change callers accordingly.
3526
3527 2011-03-25  Cary Coutant  <ccoutant@google.com>
3528
3529         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3530         * testsuite/Makefile.in: Regenerate.
3531
3532 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3533
3534         * plugin.cc (get_view): New.
3535         (Plugin::load): Pass get_view to the plugin.
3536         (Plugin_manager::get_view): New.
3537
3538 2011-03-21  Ian Lance Taylor  <iant@google.com>
3539
3540         * testsuite/final_layout.sh: Rewrite to not use dc.
3541         * testsuite/relro_test.sh: Fail if dc is not present.
3542
3543 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3544
3545         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3546         Change == to -eq.
3547         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3548         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3549         Change == to -eq.
3550         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3551         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3552
3553 2011-03-14  Ian Lance Taylor  <iant@google.com>
3554
3555         * script-sections.cc (Sort_output_sections::script_compare):
3556         Rename from is_before, change return type.
3557         (Sort_output_sections::operator()): Adjust accordingly.
3558
3559 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3560
3561         PR gold/12572
3562         * testsuite/odr_violation2.cc: Add comment to make all error line
3563         numbers double digits.
3564         * testsuite/debug_msg.sh: Adjust expected errors.
3565
3566 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3567
3568         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3569         but mark earlier ones as non-canonical
3570         (offset_to_iterator): Update search target and example
3571         (do_addr2line): Return extra lines in a vector*
3572         (format_file_lineno): Extract from do_addr2line
3573         (one_addr2line): Add vector* out-param
3574         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3575         when a lineno entry appeared last for its instruction
3576         (Dwarf_line_info): Add vector* out-param
3577         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3578         * symtab.cc (Odr_violation_compare): Include the lineno in the
3579         comparison again.
3580         (linenos_from_loc): New. Combine the canonical line for an
3581         address with its other lines.
3582         (True_if_intersect): New. Helper functor to make
3583         std::set_intersection a query.
3584         (detect_odr_violations): Compare sets of lines instead of just
3585         one line for each function. This became less deterministic, but
3586         has fewer false positives.
3587         * symtab.h: Declarations.
3588         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3589         mix an optimized and non-optimized object in the same binary
3590         (odr_violation2.so): Same.
3591         * testsuite/Makefile.in: Regenerate from Makefile.am.
3592         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3593         * testsuite/debug_msg.sh: Update line numbers and add
3594         assertions.
3595         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3596         non-optimized context.
3597         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3598         isn't inlined, and use OdrDerived in an optimized context.
3599         * testsuite/odr_header1.h: Defines OdrDerived, where
3600         optimization will change the
3601         first-instruction-in-the-destructor's file and line number.
3602         * testsuite/odr_header2.h: Defines OdrBase.
3603
3604 2011-03-09  Ian Lance Taylor  <iant@google.com>
3605
3606         * fileread.cc (File_read::clear_views): Don't delete the whole
3607         file view.
3608
3609 2011-03-08  Ian Lance Taylor  <iant@google.com>
3610
3611         PR gold/12525
3612         * fileread.cc: #include <climits>.
3613         (GOLD_IOV_MAX): Define.
3614         (File_read::read_multiple): Limit number of entries by iov_max.
3615         * fileread.h (class File_read): Always set max_readv_entries to
3616         128.
3617
3618 2011-03-07  Ian Lance Taylor  <iant@google.com>
3619
3620         PR gold/12525
3621         * options.h (class General_options): Add -dy and -dn.
3622
3623 2011-03-02  Cary Coutant  <ccoutant@google.com>
3624
3625         * testsuite/script_test_9.t: Add TLS segment.
3626
3627 2011-03-02  Simon Baldwin  <simonb@google.com>
3628
3629         * configure.ac: Add check for gnu_indirect_function support in
3630         the toolchain building binutils.
3631         * configure: Rebuild.
3632
3633 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3634
3635         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3636         plugin only symbols.
3637         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3638         in plugin files as not needed in the symbol table.
3639
3640 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3641
3642         * output.cc (Output_section::add_input_section): Delay fill
3643         generation for section ordering.
3644
3645 2011-02-09  Ian Lance Taylor  <iant@google.com>
3646
3647         PR gold/12316
3648         * object.h (class Sized_relobj): Remove clear_local_symbols.
3649         * reloc.cc (Sized_relobj::do_relocate): Don't call
3650         clear_local_symbols.
3651
3652 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3653
3654         * plugin.cc (is_visible_from_outside): Return true for symbols
3655         in the -u option.
3656
3657 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3658
3659         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3660         filename.
3661
3662 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3663
3664         * icf.h (is_section_foldable_candidate): Change type of parameter
3665         to std::string.
3666         * icf.cc (Icf::find_identical_sections): Change type of local variable
3667         section_name to be std::string.
3668         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3669
3670 2011-01-25  Ian Lance Taylor  <iant@google.com>
3671
3672         * script.cc (script_add_extern): Rewrite to use
3673         add_symbol_reference.
3674
3675 2011-01-25  Doug Kwan  <dougkwan@google.com>
3676
3677         * icf.cc (get_section_contents): Always lock section's object.
3678
3679 2011-01-24  Ian Lance Taylor  <iant@google.com>
3680
3681         * options.h (class General_options): Accept
3682         --no-detect-odr-violations.
3683
3684 2011-01-24  Ian Lance Taylor  <iant@google.com>
3685
3686         * version.cc (version_string): Bump to 1.11.
3687
3688 2011-01-24  Ian Lance Taylor  <iant@google.com>
3689
3690         * plugin.cc (class Plugin_rescan): Define new class.
3691         (Plugin_manager::claim_file): Set any_claimed_.
3692         (Plugin_manager::save_archive): New function.
3693         (Plugin_manager::save_input_group): New function.
3694         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3695         necessary.
3696         (Plugin_manager::new_undefined_symbol): New function.
3697         (Plugin_manager::rescan): New function.
3698         (Plugin_manager::rescannable_defines): New function.
3699         (Plugin_manager::add_input_file): Set any_added_.
3700         * plugin.h (class Plugin_manager): define new fields rescannable_,
3701         undefined_symbols_, any_claimed_, and any_added_.  Declare
3702         Plugin_rescan as friend.  Declare new functions.
3703         (Plugin_manager::Rescannable): Define type.
3704         (Plugin_manager::Rescannable_list): Define type.
3705         (Plugin_manager::Undefined_symbol_list): Define type.
3706         (Plugin_manager::Plugin_manager): Initialize new fields.
3707         * archive.cc (Archive::defines_symbol): New function.
3708         (Add_archive_symbols::run): Pass archive to plugins if any.
3709         * archive.h (class Archive): Declare defines_symbol.
3710         * readsyms.cc (Input_group::~Input_group): New function.
3711         (Finish_group::run): Pass input_group to plugins if any.
3712         * readsyms.h (class Input_group): Declare destructor.
3713         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3714         any.
3715
3716 2011-01-10  Ian Lance Taylor  <iant@google.com>
3717
3718         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3719         section as relro.
3720         (Layout::set_segment_offsets): Reset increase_relro before calling
3721         set_section_addresses a second time.
3722
3723 2011-01-04  Cary Coutant  <ccoutant@google.com>
3724
3725         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3726         sections before NOBITS sections.
3727
3728 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3729
3730         * version.cc (print_version): Update copyright to 2011.
3731
3732 2010-12-23  Cary Coutant  <ccoutant@google.com>
3733
3734         * output.h (Output_data_reloc::add_output_section): Pass OD instead
3735         of OS to this->add.  Add OD parameter to second form of the function.
3736
3737 2010-12-20  Ian Lance Taylor  <iant@google.com>
3738
3739         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
3740         second of two consecutive entries with same offset.
3741
3742 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3743
3744         * testsuite/Makefile.am (ifuncmain2static_LDADD)
3745         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
3746         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
3747         to avoid unneeded links against $(LDADD).
3748         * testsuite/Makefile.in: Regenerate.
3749
3750 2010-12-15  Ian Lance Taylor  <iant@google.com>
3751
3752         PR gold/12324
3753         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
3754         for R_X86_64_32 and R_X86_64_PC32.
3755         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
3756         ver_matching_def_pic.o.
3757         (ver_matching_def_pic.o): New target.
3758
3759 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3760
3761         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
3762         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
3763         Move definition before File_read::View member definitions.
3764         (File_read::View::~View): Initialize and hold lock before
3765         updating current_mapped_bytes.
3766
3767 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
3768
3769         * dwarf_reader.cc: Remove outdated comment.
3770         * gold-threads.cc: Fix typo in error message.
3771         * archive.cc: Fix typos in comments.
3772         * archive.h: Likewise.
3773         * arm-reloc-property.cc: Likewise.
3774         * arm-reloc-property.h: Likewise.
3775         * arm-reloc.def: Likewise.
3776         * arm.cc: Likewise.
3777         * attributes.h: Likewise.
3778         * cref.cc: Likewise.
3779         * ehframe.cc: Likewise.
3780         * fileread.h: Likewise.
3781         * gold.h: Likewise.
3782         * i386.cc: Likewise.
3783         * icf.cc: Likewise.
3784         * incremental.h: Likewise.
3785         * int_encoding.cc: Likewise.
3786         * layout.h: Likewise.
3787         * main.cc: Likewise.
3788         * merge.h: Likewise.
3789         * object.cc: Likewise.
3790         * object.h: Likewise.
3791         * options.cc: Likewise.
3792         * readsyms.cc: Likewise.
3793         * reduced_debug_output.cc: Likewise.
3794         * reloc.cc: Likewise.
3795         * script-sections.cc: Likewise.
3796         * sparc.cc: Likewise.
3797         * symtab.h: Likewise.
3798         * target-reloc.h: Likewise.
3799         * target.cc: Likewise.
3800         * target.h: Likewise.
3801         * timer.cc: Likewise.
3802         * timer.h: Likewise.
3803         * x86_64.cc: Likewise.
3804
3805 2010-12-09  Cary Coutant  <ccoutant@google.com>
3806
3807         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
3808         stack.
3809         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
3810         parameter; change all callers.
3811         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
3812         * options.h (warn_execstack): New option.
3813
3814 2010-12-07  Doug Kwan  <dougkwan@google.com>
3815
3816         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
3817         like function call relocations.
3818
3819 2010-12-07  Ian Lance Taylor  <iant@google.com>
3820
3821         * archive.cc (Archive::get_elf_object_for_member): Permit
3822         punconfigured to be NULL.
3823         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
3824         (Archive::include_member): Pass NULL to get_elf_object_for_member
3825         if we searched for the archive and this is the first included
3826         object.
3827
3828 2010-12-01  Ian Lance Taylor  <iant@google.com>
3829
3830         * dwarf_reader.h (class Sized_dwarf_line_info): Add
3831         track_relocs_type_ field.
3832         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3833         Set track_relocs_type_.
3834         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
3835         contents when using RELA relocs.
3836         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
3837         reloc_map_.
3838         * reloc.cc (Track_relocs::next_addend): New function.
3839         * reloc.h (class Track_relocs): Declare next_addend.
3840
3841 2010-12-01  Ian Lance Taylor  <iant@google.com>
3842
3843         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
3844         virtual destructor.
3845
3846 2010-12-01  Ian Lance Taylor  <iant@google.com>
3847
3848         * README: Update compilers known to work and fail.
3849
3850 2010-11-23  Matthias Klose  <doko@ubuntu.com>
3851
3852         * configure.in: For --enable-gold, handle value `default' instead of
3853         `both*'.  Always install ld as ld.bfd, install as ld if gold is
3854         not the default.
3855         * configure: Regenerate.
3856
3857 2010-11-18  Doug Kwan  <dougkwan@google.com>
3858
3859         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
3860         and right_alignment to be zero.  Store result alignment only if it is
3861         greater than existing alignment.
3862
3863 2010-11-16  Cary Coutant  <ccoutant@google.com>
3864
3865         PR gold/12220
3866         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3867         Check for ".zdebug_line".
3868
3869 2010-11-16  Doug Kwan  <dougkwan@google.com>
3870             Cary Coutant  <ccoutant@google.com>
3871
3872         * output.h (Output_segment::set_section_addresses): Pass increase_relro
3873         by reference; adjust all callers.
3874         * output.cc (Output_segment::set_section_addresses): Adjust references
3875         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
3876         list is empty.
3877         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
3878         end at page boundary.
3879
3880 2010-11-16  Cary Coutant  <ccoutant@google.com>
3881
3882         PR gold/12220
3883         * layout.cc (Layout::choose_output_section): Transform names of
3884         compressed sections even when using a script with a SECTIONS clause.
3885         (Layout::output_section_name): Remove code to transform
3886         compressed debug section names.
3887         * output.cc (Output_section::add_input_section): Use uncompressed
3888         section size when tracking input sections.
3889
3890 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
3891
3892         * symtab.h (Symbol::NON_PIC_REF): Remove.
3893         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
3894         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
3895         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
3896         (Symbol::use_plt_offset): Take a flags argument and pass it
3897         directly to needs_dynamic_reloc.  Restrict check for undefined
3898         weak symbols to function calls.
3899         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
3900         (Target_arm::Scan::global): Use it.
3901         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
3902         (Target_arm::Relocate::relocate): Likewise.
3903         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
3904         parameter with an r_type parameter.  Use get_reference_flags
3905         to get the flags.
3906         (Target_arm::Relocate::relocate): Update accordingly.
3907         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
3908         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
3909         (Target_i386::Scan::global): Likewise.
3910         (Target_i386::Relocate::relocate): Likewise.
3911         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
3912         parameter with an r_type parameter.  Use get_reference_flags
3913         to get the flags.
3914         (Target_i386::Relocate::relocate): Update accordingly.
3915         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
3916         (Target_powerpc::Scan::global): Use it.
3917         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
3918         (Target_powerpc::Relocate::relocate): Likewise.
3919         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
3920         (Target_sparc::Scan::global): Use it.
3921         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
3922         (Target_sparc::Relocate::relocate): Likewise.
3923         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
3924         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
3925         (Target_x86_64::Scan::global): Likewise.
3926         (Target_x86_64::Relocate::relocate): Likewise.
3927
3928 2010-11-08  Doug Kwan  <dougkwan@google.com>
3929             Cary Coutant  <ccoutant@google.com>
3930
3931         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
3932         (Arm_exidx_merge_section::section_contents_): New data member.
3933         (Arm_input_section::Arm_input_section): Initialize original_contents_.
3934         (Arm_input_section::~Arm_input_section): De-allocate memory.
3935         (Arm_input_section::original_contents_): New data member.
3936         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
3937         in parameters instead of calling Object::section_contents without
3938         locking.
3939         (Arm_output_section::group_section): New parameter TASK.  Pass it
3940         to callees that need locking objects.
3941         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
3942         to lock EXIDX input sections.  Fix a formatting issue.  Call
3943         Arm_exidx_merged_section::build_contents to create merged section
3944         contents.
3945         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
3946         to lock object of stub table owner.
3947         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
3948         TEXT_SIZE to initialize data member TEXT_SIZE_.
3949         (Arm_exidx_input_section::addralign): Fix typo in comment.
3950         (Arm_exidx_input_section::text_size): New method.
3951         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
3952         that require locking objects.  Lock objects before scanning for stubs
3953         and updating local symbols.
3954         (Arm_input_section<big_endian>::init): Copy contents of original
3955         input section.
3956         (Arm_input_section<big_endian>::do_write): Use saved contents of
3957         original input section instead of calling Object::section_contents
3958         without locking.
3959         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
3960         size without calling Object::section_size().
3961         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
3962         for size.  Allocate a buffer for merged EXIDX entries.
3963         (Arm_exidx_merged_section::build_contents): New method.
3964         (Arm_exidx_merged_section::do_write): Move merge section contents
3965         building code to Arm_exidx_merged_section::build_contetns.  Write
3966         out contetns in buffer instead of building it on the fly.
3967         (Arm_relobj::make_exidx_input_section): Also pass text section size
3968         to Arm_exidx_input_section constructor.
3969         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
3970         (Arm_dynobj::do_read_symbols): Fix memory leak.
3971         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
3972         * target.h: (class Task): Add forward declaration.
3973         (Target::relax): Add new parameter TASK and pass it to
3974         Target::do_relax().
3975         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
3976
3977 2010-11-05  Cary Coutant  <ccoutant@google.com>
3978
3979         PR gold/10708
3980         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
3981         object when reading from the file.
3982         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
3983         second layout pass.
3984         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
3985         when reading section contents.
3986         (get_section_contents): Likewise.
3987         (icf::find_identical_sections): Likewise.
3988         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
3989         object when reading from the file.
3990         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
3991         the object when doing deferred section layout.
3992
3993 2010-11-03  Nick Clifton  <nickc@redhat.com>
3994
3995         PR gold/12001
3996         * script.h (class Symbol_assignment: name): New member.  Returns
3997         the name of the symbol.
3998         * scrfipt.cc (Script_options::is_pending_assignment): New member.
3999         Returns true if the given symbol name is on the list of
4000         assignments wating to be processed.
4001         * archive.cc (should_incldue_member): If the symbol is undefined,
4002         check to see if it is on the list of symbols pending assignment.
4003
4004 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4005
4006         * script-sections.cc (Script_sections::find_memory_region): Check
4007         for a NULL output section pointer.
4008
4009 2010-10-29  Doug Kwan  <dougkwan@google.com>
4010
4011         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4012         Output_section::add_relaxed_input_section.
4013         * output.cc (Output_section::add_relaxed_input_section): Add new
4014         arguments LAYOUT and NAME.  Set section order index.
4015         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4016         Copy section order index.
4017         * output.h (Output_section::add_relaxed_input_section): Add new
4018         arguments LAYOUT and NAME.
4019
4020 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4021
4022         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4023         NATIVE_OR_CROSS_LINKER.
4024         * testsuite/Makefile.in: Regenerate.
4025
4026 2010-10-20  Doug Kwan  <dougkwan@google.com>
4027
4028         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4029         without SHF_LINK_ORDER flags.
4030         * layout.cc (Layout::choose_output_section): Do not filter
4031         SHF_LINK_ORDER flag in a relocatable link.
4032
4033 2010-10-17  Cary Coutant  <ccoutant@google.com>
4034
4035         * output.h (Output_segment::set_section_addresses): Change function
4036         signature.  Update all callers.
4037         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4038         sections.
4039         (Output_segment::set_section_addresses): Align after last TLS
4040         section.  Add padding before last relro section instead of after.
4041
4042 2010-10-17  Doug Kwan  <dougkwan@google.com>
4043
4044         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4045         GOT output section to be writable.
4046
4047 2010-10-14  Cary Coutant  <ccoutant@google.com>
4048
4049         * debug.h (DEBUG_INCREMENTAL): New flag.
4050         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4051         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4052         mode.
4053         * incremental.cc (report_command_line): Ignore all forms of
4054         --incremental.
4055         * layout.cc (Layout::Layout): Check parameters for incremental link
4056         mode.
4057         * options.cc (General_options::parse_incremental): New function.
4058         (General_options::parse_no_incremental): New function.
4059         (General_options::parse_incremental_full): New function.
4060         (General_options::parse_incremental_update): New function.
4061         (General_options::incremental_mode_): New data member.
4062         (General_options::finalize): Check incremental_mode_.
4063         * options.h (General_options): Update help text for --incremental.
4064         Add --no-incremental, --incremental-full, --incremental-update.
4065         (General_options::Incremental_mode): New enum type.
4066         (General_options::incremental_mode): New function.
4067         (General_options::incremental_mode_): New data member.
4068         * parameters.cc (Parameters::incremental_mode_): New data member.
4069         (Parameters::set_options): Set incremental_mode_.
4070         (Parameters::set_incremental_full): New function.
4071         (Parameters::incremental): New function.
4072         (Parameters::incremental_update): New function.
4073         (set_parameters_incremental_full): New function.
4074         * parameters.h (Parameters::set_incremental_full): New function.
4075         (Parameters::incremental): New function.
4076         (Parameters::incremental_update): New function.
4077         (Parameters::incremental_mode_): New data member.
4078         (set_parameters_incremental_full): New function.
4079         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4080         incremental link mode.
4081         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4082         (Sized_relobj::do_relocate_sections): Likewise.
4083         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4084         option.
4085         * testsuite/Makefile.in: Regenerate.
4086         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4087
4088 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4089
4090         * script-sections.h (class Script_sections): Make
4091         Sections_elements typedef public.
4092         * script-sections.cc (class Sort_output_sections): Add elements_
4093         field.  Add constructor which sets it; change all callers.
4094         (Sort_output_sections::is_before): New function.
4095         (Sort_output_sections::operator()): Call is_before.
4096         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4097         conditional.
4098         * testsuite/script_test_10.sh: New test. Test script section
4099         order.
4100         * testsuite/script_test_10.t: Likewise.
4101         * testsuite/script_test_10.s: Likewise.
4102         * testsuite/Makefile.am: Wrap the cross linker tests and the
4103         common tests into NATIVE_OR_CROSS_LINKER.
4104         (check_SCRIPTS): Add script_test_10.sh.
4105         (check_DATA): Add script_test_10.stdout.
4106         (script_test_10.o, script_test_10): New targets.
4107         (script_test_10.stdout): New target.
4108         * configure, testsuite/Makefile.in: Regenerate.
4109
4110 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4111
4112         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4113         error for the deprecated relocations.
4114         (Target_arm::Scan::global): Likewise.
4115         (Target_arm::Relocate::relocate): Likewise.
4116
4117 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4118
4119         * fileread.cc (Input_file::find_file): Initialize *found_name
4120         and *namep when using the fallback search for case 4.
4121
4122 2010-10-11  Cary Coutant  <ccoutant@google.com>
4123
4124         * options.h (class General_options): Redefine -z lazy as an alias for
4125         the negation of -z now.
4126
4127 2010-10-11  Ian Lance Taylor  <iant@google.com>
4128
4129         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4130         binding.
4131
4132 2010-10-06  Nick Clifton  <nickc@redhat.com>
4133
4134         * script-sections.cc(class Memory_region): Remove
4135         current_lma_offset_ field.  Rename current_vma_offset_ to
4136         current_offset_.  Add last_section_ field.
4137         (Memory_region::get_current_vma_address): Rename to
4138         get_current_address.
4139         (Memory_region::get_current_lma_address): Delete.
4140         (Memory_region::increment_vma_offset): Rename to
4141         increment_offset.
4142         (Memory_region::increment_lma_offset): Delete.
4143         (Memory_region::attributes_compatible): New method.  Returns
4144         true if the provided section is compatible with the region.
4145         (Memory_region::get_last_section): New method.  Returns the last
4146         section to use the region.
4147         (Memory_region::set_last_section): New method.  Stores the last
4148         section to use the region.
4149         (Script_sections::block_in_region): New method.  Returns true if
4150         a block of memory is contained within a region.
4151         (Script_sections::find_memory_region): New method.  Locates a
4152         memory region to be used to set a VMA or LMA address.
4153         (Output_section_definition::set_section_addresses): Add code to
4154         check for addresses set by memory regions.
4155         (Output_segment::set_section_addresses): Remove memory region
4156         walking code.
4157         (Script_sections::create_segment): Add a warning if a header
4158         segment is created outside of any region.
4159         * script-sections.h (class Script_sections): Add prototypes for
4160         find_memory_region and block_in_region methods.
4161         * testsuite/memory_test.s: Use .long instead of .word.
4162         * testsuite/memory_test.t: Add some more output sections.
4163         * testsuite/memory_test.sh: Update expected output.
4164
4165 2010-10-02  Doug Kwan  <dougkwan@google.com>
4166
4167         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4168         defintion to symtab.h
4169         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4170         declaration to defintion.
4171
4172 2010-10-01  Nick Clifton  <nickc@redhat.com>
4173
4174         * expression.cc (eval): Replace dummy argument with NULL.
4175         (eval_maybe_dot): Check for a NULL result section pointer.
4176         (Symbol_expression::value): Likewise.
4177         (Dot_expression::value): Likewise.
4178         (BINARY_EXPRESSION): Likewise.
4179         (Max_expression::value): Likewise.
4180         (Min_expression::value): Likewise.
4181         (Absolute_expression::value): Likewise.
4182         (Addr_expression::value_from_output_section): Likewise.
4183         (Loaddddr_expression::value_from_output_section): Likewise.
4184         (Segment_start_expression::value): Likewise.
4185         * script-sections.cc
4186         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4187         argument with NULL.
4188         (Sections_elememt_dot_assignment::set_section_addresses):
4189         Likewise.
4190         (Output_data_expression::do_write_to_buffer): Likewise.
4191         (Output_section_definition::finalize_symbols): Likewise.
4192         (Output_section_definition::set_section_addresses): Likewise.
4193
4194 2010-09-30  Doug Kwan  <dougkwan@google.com>
4195
4196         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4197
4198 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4199
4200         * target.h (Target::can_icf_inline_merge_sections): New virtual
4201         function.
4202         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4203         virtual function.
4204         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4205         virtual function.
4206         * icf.cc (get_section_contents): Inline merge sections only when
4207         target allows it.
4208
4209 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4210
4211         * configure: Regenerate.
4212
4213 2010-09-17  Ian Lance Taylor  <iant@google.com>
4214
4215         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4216         * testsuite/Makefile.am (memory_test.o): New target.
4217         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4218         memory_test.t.
4219         * testsuite/Makefile.in: Rebuild.
4220
4221 2010-09-17  Doug Kwan  <dougkwan@google.com>
4222
4223         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4224         defintion if relocation uses GOT entries of the symbol.
4225         * testsuite/icf_safe_test.sh: Fix test.
4226         * testsuite/icf_safe_so_test.sh: Fix test.
4227
4228 2010-09-16  Cary Coutant  <ccoutant@google.com>
4229
4230         * script_sections.cc (class Memory_region): Remove "NULL" from
4231         vector initializations.
4232
4233 2010-09-15  Cary Coutant  <ccoutant@google.com>
4234
4235         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4236         Resolve forwarding symbols.
4237
4238 2010-09-15  Doug Kwan  <dougkwan@google.com>
4239
4240         * gold/testsuite/script_test_3.t: Add ARM special sections.
4241         * gold/testsuite/script_test_4.t: Same.
4242         * gold/testsuite/script_test_5.t: Same.
4243         * gold/testsuite/script_test_6.t: Same.
4244         * gold/testsuite/script_test_7.t: Same.
4245         * gold/testsuite/script_test_7.t: Same.
4246         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4247
4248 2010-09-14  Cary Coutant  <ccoutant@google.com>
4249
4250         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4251         (Target_x86_64::Relocate::relocate_tls): Replace check for
4252         saw_tls_block_reloc_ with test for executable section.
4253
4254 2010-09-12  Cary Coutant  <ccoutant@google.com>
4255
4256         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4257         position-independent executables to shared libraries need dynamic
4258         relocations.
4259         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4260         position-independent executables.
4261         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4262         * testsuite/Makefile.in: Regenerate.
4263
4264 2010-09-10  Nick Clifton  <nickc@redhat.com>
4265
4266         PR gold/11997
4267         * testsuite/memory_test.t: Discard any sections that are not
4268         needed.
4269
4270 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4271
4272         PR gold/11996
4273         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4274         "This::" to work around a bug in gcc 4.2.
4275
4276         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4277
4278 2010-09-09  Rafael Espindola  <espindola@google.com>
4279
4280         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4281         sections with different PF_X flags in the same segment.
4282         (Layout::find_first_load_seg): Search all segments to find the first
4283         one.
4284         * options.h (rosegment): New.
4285
4286 2010-09-08  Rafael Espindola  <espindola@google.com>
4287
4288         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4289
4290 2010-09-08  Doug Kwan  <dougkwan@google.com>
4291
4292         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4293         (Arm_relobj::do_relocate_sections): Add new parameter for output
4294         file to match the parent.
4295         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4296         of local symbols instead of input values.  Update code to track
4297         changes in gold::relocate_section.
4298         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4299         (Sized_relobj::compute_final_local_value_internal): New methods.
4300         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4301         body into private version of Sized_relobj::compute_final_local_value.
4302         Call the inline method.
4303         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4304         merged symbol value if there is one.
4305         (Symbol_value::has_output_value): New method defintiion.
4306         (Sized_relobj::Compute_final_local_value_status): New enum type.
4307         (Sized_relobj::compute_final_local_value): New methods.
4308         (Sized_relobj::compute_final_local_value_internal): New methods.
4309         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4310         and arm_cortex_a8.sh.
4311         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4312         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4313         New tests.
4314         * Makefile.in: Regenerate.
4315         * testsuite/arm_bl_out_of_range.s: Update test.
4316         * testsuite/thumb_bl_out_of_range.s: Ditto.
4317         * testsuite/thumb_blx_out_of_range.s: Ditto.
4318         * testsuite/arm_branch_out_of_range.sh: New file.
4319         * testsuite/arm_cortex_a8.sh: Ditto.
4320         * testsuite/arm_cortex_a8_b.s: Ditto.
4321         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4322         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4323         * testsuite/arm_cortex_a8_bl.s: Ditto.
4324         * testsuite/arm_cortex_a8_blx.s: Ditto.
4325         * testsuite/arm_cortex_a8_local.s: Ditto.
4326         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4327         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4328
4329 2010-09-08  Rafael Espindola  <espindola@google.com>
4330
4331         * Makefile.am (memory_test.stdout): Run readelf with -W.
4332         * Makefile.in: Regenerate.
4333         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4334         64 bit output.
4335
4336 2010-09-08  Rafael Espindola  <espindola@google.com>
4337
4338         * script-sections.cc (Script_sections::add_memory_region): Convert
4339         field precision to int.
4340         * script.cc (script_set_section_region, script_set_section_region):
4341         Convert field precision to int.
4342
4343 2010-09-08  Rafael Espindola  <espindola@google.com>
4344
4345         * arm.cc (do_finalize_sections): Create the __exidx_start and
4346         __exdix_end symbols even when the section is missing.
4347
4348 2010-09-08  Nick Clifton  <nickc@redhat.com>
4349
4350         * README: Remove claim that MEMORY is not supported.
4351         * expression.cc (script_exp_function_origin)
4352         (script_exp_function_length): Move from here to ...
4353         * script.cc: ... here.
4354         (script_set_section_region, script_add_memory)
4355         (script_parse_memory_attr, script_include_directive): New
4356         functions.
4357         * script-sections.cc
4358         (class Memory_region): New class.
4359         (class Output_section_definition): Add set_memory_region,
4360         set_section_vma, set_section_lma and get_section_name methods.
4361         (class Script_Sections): Add add_memory_region,
4362         find_memory_region, find_memory_region_origin,
4363         find_memory_region_length and set_memory_region methods.
4364         Have set_section_addresses method walk the list of set memory
4365         regions.
4366         Extend the print methos to display memory regions.
4367         * script-sections.h: Add prototypes for new methods.
4368         Add enum for MEMORY region attributes.
4369         * yyscript.y: Add support for parsing MEMORY regions.
4370         * script-c.h: Add prototypes for new functions.
4371         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4372         * testsuite/Makefile.in: Regenerate.
4373         * testsuite/memory_test.sh: New script.
4374         * testsuite/memory_test.s: New assembler source file.
4375         * testsuite/memory_test.t: New linker script.
4376
4377 2010-08-27  Doug Kwan  <dougkwan@google.com>
4378
4379         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4380         reference override an existing dynamic weak reference.
4381         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4382         * testsuite/Makefile.in: Regenerate.
4383         * testsuite/dyn_weak_ref.sh: New file.
4384         * testsuite/dyn_weak_ref_1.c: Ditto.
4385         * testsuite/dyn_weak_ref_2.c: Ditto.
4386
4387 2010-08-27  Ian Lance Taylor  <iant@google.com>
4388
4389         * incremental.h (class Incremental_input_entry): Add virtual
4390         destructor.
4391
4392 2010-08-27  Ian Lance Taylor  <iant@google.com>
4393
4394         * testsuite/start_lib_test_3.c: Mark t3 as used.
4395
4396 2010-08-27  Nick Clifton  <nickc@redhat.com>
4397
4398         * options.cc (version_script): Fix small typo in previous
4399         whitespace tidyup.
4400
4401 2010-08-25  Nick Clifton  <nickc@redhat.com>
4402
4403         * archive.cc: Formatting fixes: Remove whitespace between
4404         typename and following asterisk.  Remove whitespace between
4405         function name and opening parenthesis.
4406         * archive.h: Likewise.
4407         * arm.cc: Likewise.
4408         * attributes.cc: Likewise.
4409         * attributes.h: Likewise.
4410         * common.cc: Likewise.
4411         * copy-relocs.cc: Likewise.
4412         * dirsearch.h: Likewise.
4413         * dynobj.cc: Likewise.
4414         * ehframe.cc: Likewise.
4415         * ehframe.h: Likewise.
4416         * expression.cc: Likewise.
4417         * fileread.cc: Likewise.
4418         * fileread.h: Likewise.
4419         * gc.h: Likewise.
4420         * gold-threads.cc: Likewise.
4421         * gold.cc: Likewise.
4422         * i386.cc: Likewise.
4423         * icf.h: Likewise.
4424         * incremental-dump.cc: Likewise.
4425         * incremental.cc: Likewise.
4426         * layout.cc: Likewise.
4427         * layout.h: Likewise.
4428         * main.cc: Likewise.
4429         * merge.cc: Likewise.
4430         * merge.h: Likewise.
4431         * object.cc: Likewise.
4432         * object.h: Likewise.
4433         * options.cc: Likewise.
4434         * options.h: Likewise.
4435         * output.cc: Likewise.
4436         * output.h: Likewise.
4437         * plugin.cc: Likewise.
4438         * plugin.h: Likewise.
4439         * powerpc.cc: Likewise.
4440         * reloc.cc: Likewise.
4441         * script-c.h: Likewise.
4442         * script-sections.cc: Likewise.
4443         * script.cc: Likewise.
4444         * stringpool.cc: Likewise.
4445         * symtab.cc: Likewise.
4446         * symtab.h: Likewise.
4447         * target.cc: Likewise.
4448         * timer.cc: Likewise.
4449         * timer.h: Likewise.
4450         * version.cc: Likewise.
4451         * x86_64.cc: Likewise.
4452
4453 2010-08-24  Nick Clifton  <nickc@redhat.com>
4454
4455         PR 11899
4456         * layout.cc (segment_precedes): Sort segments by their physical
4457         addresses, if they have been set.
4458
4459 2010-08-23  Cary Coutant  <ccoutant@google.com>
4460
4461         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4462         symbols data.
4463         (Lib_group::include_member): Unlock object after deleting its
4464         symbols data.
4465         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4466         the bug fixed here.
4467
4468 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4469             Cary Coutant  <ccoutant@google.com>
4470
4471         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4472         constructor, and set_blocker.
4473         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4474         readsyms_blocker_.
4475         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4476         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4477         * testsuite/Makefile.am (start_lib_test): New test case.
4478         * testsuite/Makefile.in: Regenerate.
4479         * testsuite/start_lib_test_main.c: New file.
4480         * testsuite/start_lib_test_1.c: New file.
4481         * testsuite/start_lib_test_2.c: New file.
4482         * testsuite/start_lib_test_3.c: New file.
4483
4484 2010-08-19  Ian Lance Taylor  <iant@google.com>
4485
4486         * Makefile.in: Rebuild with automake 1.11.1.
4487         * aclocal.m4: Likewise.
4488         * testsuite/Makefile.in: Likewise.
4489
4490 2010-08-19  Ian Lance Taylor  <iant@google.com>
4491
4492         PR 10893
4493         * i386.cc (class Output_data_plt_i386): Update declarations.
4494         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4495         local_ifuncs_ fields.
4496         (Target_i386::do_plt_section_for_global): New function.
4497         (Target_i386::do_plt_section_for_local): New function.
4498         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4499         parameter; change all callers.  Initialize global_ifuncs_ and
4500         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4501         __rel_iplt_end.
4502         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4503         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4504         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4505         symbols.
4506         (Target_i386::make_plt_section): New function, broken out of
4507         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4508         (Target_i386::make_plt_entry): Call make_plt_section.
4509         (Target_i386::make_local_ifunc_plt_entry): New function.
4510         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4511         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4512         R_386_IRELATIVE to switch.
4513         (Target_i386::Scan::global): Likewise.
4514         (Target_i386::Relocate::relocate): Likewise.
4515         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4516         switch.
4517         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4518         (Target_x86_64::do_plt_section_for_global): New function.
4519         (Target_x86_64::do_plt_section_for_local): New function.
4520         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4521         parameter; change all callers.  If doing a static link define
4522         __rela_iplt_start and __rela_iplt_end.
4523         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4524         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4525         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4526         to point to .plt.
4527         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4528         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4529         switch.
4530         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4531         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4532         R_X86_64_IRELATIVE to switch.
4533         (Target_x86_64::Scan::global): Likewise.
4534         (Target_x86_64::Relocate::relocate): Likewise.
4535         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4536         switch.
4537         * target.h (class Target): Add plt_section_for_global and
4538         plt_section_for_local functions.  Add do_plt_section_for_global
4539         and do_plt_section_for_local virtual functions.
4540         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4541         clarifying comments.
4542         (Symbol::use_plt_offset): Handle IFUNC symbol.
4543         * object.cc (Sized_relobj::Sized_relobj): Initialize
4544         local_plt_offsets_.
4545         (Sized_relobj::local_has_plt_offset): New function.
4546         (Sized_relobj::local_plt_offset): New function.
4547         (Sized_relobj::set_local_plt_offset): New function.
4548         (Sized_relobj::do_count): Handle IFUNC symbol.
4549         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4550         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4551         is_ifunc_symbol functions.
4552         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4553         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4554         local_plt_offsets_ field.
4555         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4556         * output.h (class Output_section_data): Add non-const
4557         output_section function.
4558         (class Output_data_got): Update declarations.
4559         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4560         Add use_plt_offset parameter to global and local constructors.
4561         Change all callers.  Change local_sym_index_ field to 31 bits.
4562         Change GSYM_CODE and CONSTANT_CODE accordingly.
4563         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4564         doing a static link don't set sh_link field.
4565         (Output_data_got::Got_entry::write): Use PLT offset if
4566         appropriate.
4567         (Output_data_got::add_global_plt): New function.
4568         (Output_data_got::add_local_plt): New function.
4569         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4570         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4571         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4572         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4573         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4574         IFUNC conditional.
4575         * testsuite/ifunc-sel.h: New file.
4576         * testsuite/ifuncmain1.c: New file.
4577         * testsuite/ifuncmain1vis.c: New file.
4578         * testsuite/ifuncmod1.c: New file.
4579         * testsuite/ifuncdep2.c: New file.
4580         * testsuite/ifuncmain2.c: New file.
4581         * testsuite/ifuncmain3.c: New file.
4582         * testsuite/ifuncmod3.c: New file.
4583         * testsuite/ifuncmain4.c: New file.
4584         * testsuite/ifuncmain5.c: New file.
4585         * testsuite/ifuncmod5.c: New file.
4586         * testsuite/ifuncmain6pie.c: New file.
4587         * testsuite/ifuncmod6.c: New file.
4588         * testsuite/ifuncmain7.c: New file.
4589         * configure, testsuite/Makefile.in: Rebuild.
4590
4591 2010-08-18  Ian Lance Taylor  <iant@google.com>
4592
4593         * incremental.cc
4594         (Output_section_incremental_inputs::write_input_files): Add cast
4595         to avoid signed/unsigned comparison warning.
4596         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4597
4598 2010-08-12  Cary Coutant  <ccoutant@google.com>
4599
4600         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4601
4602 2010-08-13  Ian Lance Taylor  <iant@google.com>
4603
4604         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4605
4606 2010-08-12  Cary Coutant  <ccoutant@google.com>
4607             Doug Kwan  <dougkwan@google.com>
4608
4609         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4610         defintion overrides non-weak undef, remember that the original undef
4611         is not weak.
4612         * symtab.cc (Symbol_table::sized_write_global): For undef without
4613         an original weak binding, set binding to global in output.
4614         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4615         * testsuite/Makefile.in: Regenerate.
4616         * testsuite/strong_ref_weak_def.sh: New file.
4617         * testsuite/strong_ref_weak_def_1.c: Ditto.
4618         * testsuite/strong_ref_weak_def_2.c: Ditto.
4619
4620 2010-08-12  Cary Coutant  <ccoutant@google.com>
4621
4622         * testsuite/incremental_test.sh: Rewrite.
4623         * testsuite/incremental_test_1.c: Rewrite.
4624         * testsuite/incremental_test_2.c: Rewrite.
4625
4626 2010-08-12  Cary Coutant  <ccoutant@google.com>
4627
4628         * arm.cc (Target_arm::got_size): Add const.
4629         (Target_arm::got_entry_count): New function.
4630         (Target_arm::plt_entry_count): New function.
4631         (Target_arm::first_plt_entry_offset): New function.
4632         (Target_arm::plt_entry_size): New function.
4633         (Output_data_plt_arm::entry_count): New function.
4634         (Output_data_plt_arm::first_plt_entry_offset): New function.
4635         (Output_data_plt_arm::get_plt_entry_size): New function.
4636         * i386.cc (Target_i386::got_size): Add const.
4637         (Target_i386::got_entry_count): New function.
4638         (Target_i386::plt_entry_count): New function.
4639         (Target_i386::first_plt_entry_offset): New function.
4640         (Target_i386::plt_entry_size): New function.
4641         (Output_data_plt_i386::entry_count): New function.
4642         (Output_data_plt_i386::first_plt_entry_offset): New function.
4643         (Output_data_plt_i386::get_plt_entry_size): New function.
4644         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4645         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4646         * incremental.cc: Include target.h.
4647         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4648         parameter.  Adjust all callers.  Find incremental_got_plt section.
4649         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4650         section.
4651         (Output_section_incremental_inputs::set_final_data_size): Calculate
4652         size of incremental_got_plt section.
4653         (Output_section_incremental_inputs::do_write): Write the
4654         incremental_got_plt section.
4655         (Got_plt_view_info): New struct.
4656         (Local_got_offset_visitor): New class.
4657         (Global_got_offset_visitor): New class.
4658         (Global_symbol_visitor_got_plt): New class.
4659         (Output_section_incremental_inputs::write_got_plt): New function.
4660         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4661         Add parameter.  Adjust all callers.
4662         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4663         (Incremental_inputs::got_plt_section): New function.
4664         (Incremental_inputs::got_plt_section_): New data member.
4665         (Incremental_got_plt_reader): New class.
4666         * layout.cc (Layout::create_incremental_info_sections): Add the
4667         incremental_got_plt section.
4668         * object.h (Got_offset_list::get_list): New function.
4669         (Got offset_list::for_all_got_offsets): New function.
4670         (Sized_relobj::local_got_offset_list): New function.
4671         * powerpc.cc (Target_powerpc::got_size): Add const.
4672         (Target_powerpc::got_entry_count): New function.
4673         (Target_powerpc::plt_entry_count): New function.
4674         (Target_powerpc::first_plt_entry_offset): New function.
4675         (Target_powerpc::plt_entry_size): New function.
4676         (Output_data_plt_powerpc::entry_count): New function.
4677         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4678         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4679         * sparc.cc (Target_sparc::got_size): Add const.
4680         (Target_sparc::got_entry_count): New function.
4681         (Target_sparc::plt_entry_count): New function.
4682         (Target_sparc::first_plt_entry_offset): New function.
4683         (Target_sparc::plt_entry_size): New function.
4684         (Output_data_plt_sparc::entry_count): New function.
4685         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4686         (Output_data_plt_sparc::get_plt_entry_size): New function.
4687         * symtab.h (Symbol::got_offset_list): New function.
4688         (Symbol_table::for_all_symbols): New function.
4689         * target.h (Sized_target::got_entry_count): New function.
4690         (Sized_target::plt_entry_count): New function.
4691         (Sized_target::plt_entry_size): New function.
4692         * x86_64.cc (Target_x86_64::got_size): Add const.
4693         (Target_x86_64::got_entry_count): New function.
4694         (Target_x86_64::plt_entry_count): New function.
4695         (Target_x86_64::first_plt_entry_offset): New function.
4696         (Target_x86_64::plt_entry_size): New function.
4697         (Output_data_plt_x86_64::entry_count): New function.
4698         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4699         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4700
4701 2010-08-12  Cary Coutant  <ccoutant@google.com>
4702
4703         * archive.cc: Include incremental.h.
4704         (Archive::Archive): Initialize incremental_info_.
4705         (Archive::include_member): Record archive members in incremental info.
4706         (Add_archive_symbols::run): Record begin and end of an archive in
4707         incremental info.
4708         (Lib_group::include_member): Record objects in incremental info.
4709         * archive.h (Incremental_archive_entry): Forward declaration.
4710         (Archive::set_incremental_info): New member function.
4711         (Archive::incremental_info): New member function.
4712         (Archive::Unused_symbol_iterator): New class.
4713         (Archive::unused_symbols_begin): New member function.
4714         (Archive::unused_symbols_end): New member function.
4715         (Archive::incremental_info_): New data member.
4716         * incremental-dump.cc (find_input_containing_global): New function.
4717         (dump_incremental_inputs): Dump new incremental info sections.
4718         * incremental.cc: Include symtab.h.
4719         (Output_section_incremental_inputs): New class.
4720         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4721         new incremental info sections.
4722         (Sized_incremental_binary::do_check_inputs): Likewise.
4723         (Incremental_inputs::report_archive): Remove.
4724         (Incremental_inputs::report_archive_begin): New function.
4725         (Incremental_inputs::report_archive_end): New function.
4726         (Incremental_inputs::report_object): New function.
4727         (Incremental_inputs::finalize_inputs): Remove.
4728         (Incremental_inputs::report_input_section): New function.
4729         (Incremental_inputs::report_script): Rewrite.
4730         (Incremental_inputs::finalize): Do nothing but finalize string table.
4731         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4732         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4733         (Incremental_inputs::create_data_sections): New function.
4734         (Incremental_inputs::relocs_entsize): New function.
4735         (Output_section_incremental_inputs::set_final_data_size): New function.
4736         (Output_section_incremental_inputs::do_write): New function.
4737         (Output_section_incremental_inputs::write_header): New function.
4738         (Output_section_incremental_inputs::write_input_files): New function.
4739         (Output_section_incremental_inputs::write_info_blocks): New function.
4740         (Output_section_incremental_inputs::write_symtab): New function.
4741         * incremental.h (Incremental_script_entry): Forward declaration.
4742         (Incremental_object_entry): Forward declaration.
4743         (Incremental_archive_entry): Forward declaration.
4744         (Incremental_inputs): Forward declaration.
4745         (Incremental_inputs_header_data): Remove.
4746         (Incremental_inputs_header): Remove.
4747         (Incremental_inputs_header_write): Remove.
4748         (Incremental_inputs_entry_data): Remove.
4749         (Incremental_inputs_entry): Remove.
4750         (Incremental_inputs_entry_write): Remove.
4751         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
4752         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
4753         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4754         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
4755         Likewise.
4756         (Incremental_input_entry): New class.
4757         (Incremental_script_entry): New class.
4758         (Incremental_object_entry): New class.
4759         (Incremental_archive_entry): New class.
4760         (Incremental_inputs::Incremental_inputs): Initialize new data members.
4761         (Incremental_inputs::report_inputs): Remove.
4762         (Incremental_inputs::report_archive): Remove.
4763         (Incremental_inputs::report_archive_begin): New function.
4764         (Incremental_inputs::report_archive_end): New function.
4765         (Incremental_inputs::report_object): Change prototype.
4766         (Incremental_inputs::report_input_section): New function.
4767         (Incremental_inputs::report_script): Change prototype.
4768         (Incremental_inputs::get_reloc_count): New function.
4769         (Incremental_inputs::set_reloc_count): New function.
4770         (Incremental_inputs::create_data_sections): New function.
4771         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4772         (Incremental_inputs::inputs_section): New function.
4773         (Incremental_inputs::symtab_section): New function.
4774         (Incremental_inputs::relocs_section): New function.
4775         (Incremental_inputs::get_stringpool): Add const.
4776         (Incremental_inputs::command_line): Add const.
4777         (Incremental_inputs::inputs): Remove.
4778         (Incremental_inputs::command_line_key): New function.
4779         (Incremental_inputs::input_file_count): New function.
4780         (Incremental_inputs::input_files): New function.
4781         (Incremental_inputs::relocs_entsize): New function.
4782         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4783         (Incremental_inputs::finalize_inputs): Remove.
4784         (Incremental_inputs::Input_info): Remove.
4785         (Incremental_inputs::lock_): Remove.
4786         (Incremental_inputs::inputs_): Change type.
4787         (Incremental_inputs::inputs_map_): Remove.
4788         (Incremental_inputs::current_object_entry_): New data member.
4789         (Incremental_inputs::inputs_section_): New data member.
4790         (Incremental_inputs::symtab_section_): New data member.
4791         (Incremental_inputs::relocs_section_): New data member.
4792         (Incremental_inputs::reloc_count_): New data member.
4793         (Incremental_inputs_reader): New class.
4794         (Incremental_symtab_reader): New class.
4795         (Incremental_relocs_reader): New class.
4796         * layout.cc (Layout::finalize): Move finalization of incremental info
4797         and creation of incremental info sections to follow finalization of
4798         symbol table.  Set offsets for postprocessing sections.
4799         (Layout::create_incremental_info_sections): Call
4800         Incremental_inputs::create_data_sections.  Add incremental symtab
4801         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
4802         sections to layout after input sections.
4803         * layout.h (struct Timespec): Forward declaration.
4804         (Layout::incremental_inputs): Add const.
4805         (Layout::create_incremental_info_sections): Add parameter.
4806         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
4807         * object.cc: Include incremental.h.
4808         (Relobj::finalize_incremental_relocs): New function.
4809         (Sized_relobj::do_layout): Record input sections in incremental info.
4810         * object.h (Object::output_section): New function.
4811         (Object::output_section_offset): Moved from Relobj.
4812         (Object::get_incremental_reloc_base): New function.
4813         (Object::get_incremental_reloc_count): New function.
4814         (Object::do_output_section): New function.
4815         (Object::do_output_section_offset): Moved from Relobj.
4816         (Object::do_get_incremental_reloc_base): New function.
4817         (Object::do_get_incremental_reloc_count): New function.
4818         (Object::Object): Initialize new data members.
4819         (Relobj::output_section): Renamed do_output_section and moved to
4820         protected.
4821         (Relobj::output_section_offset): Moved to Object.
4822         (Relobj::do_get_incremental_reloc_base): New function.
4823         (Relobj::do_get_incremental_reloc_count): New function.
4824         (Relobj::allocate_incremental_reloc_counts): New function.
4825         (Relobj::count_incremental_reloc): New function.
4826         (Relobj::finalize_incremental_relocs): New function.
4827         (Relobj::next_incremental_reloc_index): New function.
4828         (Relobj::reloc_counts_): New data member.
4829         (Relobj::reloc_bases_): New data member.
4830         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
4831         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
4832         (Sized_relobj::incremental_relocs_scan): New function.
4833         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4834         (Sized_relobj::incremental_relocs_write): New function.
4835         (Sized_relobj::incremental_relocs_write_reltype): New function.
4836         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
4837         incremental link.
4838         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
4839         archives and object files elsewhere.
4840         (Add_symbols::run): Report object files here.
4841         (Finish_group::run): Report end of archive at end of group.
4842         * reloc.cc: Include layout.h, incremental.h.
4843         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
4844         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
4845         (Sized_relobj::incremental_relocs_scan): New function.
4846         (Sized_relobj::incremental_relocs_scan_reltype): New function.
4847         (Sized_relobj::do_relocate_sections): Write incremental relocations.
4848         (Sized_relobj::incremental_relocs_write): New function.
4849         (Sized_relobj::incremental_relocs_write_reltype): New function.
4850         * script.cc (read_input_script): Rewrite test for incremental link.
4851         Change call to Incremental_inputs::report_script.
4852         * symtab.h (Symbol_table::first_global_index): New function.
4853         (Symbol_table::output_count): New function.
4854
4855 2010-08-12  Doug Kwan  <dougkwan@google.com>
4856
4857         * arm.cc (Target_arm::merge_object_attributes): Check command line
4858         options --no-wchar-size-warning and --no-enum-size-warning.
4859         * options.h (General_options): Add ld-compatible options
4860         --no-enum-size-warning and --no-wchar-size-warning.
4861
4862 2010-08-04  Ian Lance Taylor  <iant@google.com>
4863
4864         * x86_64.cc (Target_x86_64::Scan::local): Use
4865         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
4866         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
4867         (Target_x86_64::Scan::global): Likewise.
4868         (Target_x86_64::Relocate::relocate): Likewise.
4869         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
4870         Likewise.
4871
4872 2010-08-03  Cary Coutant  <ccoutant@google.com>
4873
4874         * merge.cc (Output_merge_string::do_add_input_section): Count strings
4875         to reserve space in merged_strings vector. Keep total input size
4876         for stats.
4877         (Output_merge_string::do_print_merge_stats): Print total input size.
4878         * merge.h (Output_merge_string): Add input_size_ field.
4879         * stringpool.cc (Stringpool_template::string_length): Move
4880         implementations out of Stringpool_template class and place in
4881         stringpool.h.
4882         * stringpool.h (string_length): Move out of Stringpool_template.
4883
4884 2010-08-03  Ian Lance Taylor  <iant@google.com>
4885
4886         PR 11712
4887         * layout.cc (relaxation_loop_body): If address of load segment is
4888         set, adjust address to include headers if possible.
4889
4890 2010-08-03  Ian Lance Taylor  <iant@google.com>
4891
4892         * version.cc (version_string): Bump to 1.10.
4893
4894 2010-08-03  Ian Lance Taylor  <iant@google.com>
4895
4896         PR 11805
4897         * layout.h (enum Output_section_order): Define.
4898         (class Layout): Update declarations.
4899         * layout.cc (Layout::get_output_section): Add order parameter.
4900         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
4901         is_first_non_relro parameters.  Change all callers.
4902         (Layout::choose_output_section): Likewise.
4903         (Layout::add_output_section_data): Likewise.
4904         (Layout::make_output_section): Likewise.  Set order.
4905         (Layout::default_section_order): New function.
4906         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
4907         * output.cc (Output_section::Output_section): Initialize order_.
4908         Don't initialize deleted fields.
4909         (Output_segment::Output_segment): Don't initialize deleted
4910         fields.
4911         (Output_segment::add_output_section_to_load): New function
4912         replacing add_output_section.  Change all callers to call this or
4913         add_output_section_to_nonload.
4914         (Output_segment::add_output_section_to_nonload): New function.
4915         (Output_segment::remove_output_section): Rewrite.
4916         (Output_segment::add_initial_output_data): Likewise.
4917         (Output_segment::has_any_data_sections): Likewise.
4918         (Output_segment::is_first_section_relro): Likewise.
4919         (Output_segment::maximum_alignment): Likewise.
4920         (Output_segment::has_dynamic_reloc): New function replacing
4921         dynamic_reloc_count.  Change all callers.
4922         (Output_segment::has_dynamic_reloc_list): New function replacing
4923         dynamic_reloc_count_list.  Change all callers.
4924         (Output_segment::set_section_addresses): Rewrite.
4925         (Output_segment::set_offset): Rewrite.
4926         (Output_segment::find_first_and_last_list): Remove.
4927         (Output_segment::set_tls_offsets): Rewrite.
4928         (Output_segment::first_section_load_address): Likewise.
4929         (Output_segment::output_section_count): Likewise.
4930         (Output_segment::section_with_lowest_load_address): Likewise.
4931         (Output_segment::write_section_headers): Likewise.
4932         (Output_segment::print_sections_to_map): Likewise.
4933         * output.h (class Output_data): Remove dynamic_reloc_count_
4934         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
4935         (Output_data::add_dynamic_reloc): Rewrite.
4936         (Output_data::has_dynamic_reloc): New function.
4937         (Output_data::dynamic_reloc_count): Remove.
4938         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
4939         is_last_relro_, is_first_non_relro_, is_interp_,
4940         is_dynamic_linker_section_ fields.  Add order and set_order
4941         functions.  Remove is_relro_local, set_is_relro_local,
4942         is_last_relro, set_is_last_relro, is_first_non_relro,
4943         set_is_first_non_relro functions, is_interp, set_is_interp,
4944         is_dynamic_linker_section, and set_is_dynamic_linker_section
4945         functions.
4946         (class Output_segment): Change Output_data_list from std::list to
4947         std:;vector.  Add output_lists_ field.  Remove output_data_ and
4948         output_bss_ fields.  Update declarations.
4949
4950 2010-08-02  Ian Lance Taylor  <iant@google.com>
4951
4952         * arm.cc (Target_arm::gc_process_relocs): Use typename.
4953         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
4954         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
4955
4956 2010-08-02  Ian Lance Taylor  <iant@google.com>
4957
4958         PR 11855
4959         * script.cc (Script_options::Script_options): Initialize
4960         symbol_definitions_ and symbol_references_.
4961         (Script_options::add_symbol_assignment): Update
4962         symbol_definitions_ and symbol_references_.
4963         (Script_options::add_symbol_reference): New function.
4964         (script_symbol): New function.
4965         * script.h (class Script_options): Add symbol_definitions_ and
4966         symbol_references_ fields.
4967         (Script_options::referenced_const_iterator): New type.
4968         (Script_options::referenced_begin): New function.
4969         (Script_options::referenced_end): New function.
4970         (Script_options::is_referenced): New function.
4971         (Script_options::any_unreferenced): New function.
4972         * script-c.h (script_symbol): Declare.
4973         * yyscript.y (exp): Call script_symbol.
4974         * symtab.cc: Include "script.h".
4975         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
4976         Change all callers.  Check symbols referenced by scripts.
4977         (Symbol_table::add_undefined_symbols_from_command_line): Add
4978         layout parameter.  Change all callers.
4979         (Symbol_table::do_add_undefined_symbols_from_command_line):
4980         Likewise.  Break out loop body.  Check symbols referenced by
4981         scripts.
4982         (Symbol_table::add_undefined_symbol_from_command_line): New
4983         function broken out of
4984         do_add_undefined_symbols_from_command_line.
4985         * symtab.h (class Symbol_table): Update declarations.
4986         * archive.cc: Include "layout.h".
4987         (Archive::should_include_member): Add layout parameter.  Change
4988         all callers.  Check for symbol mentioned in expression.
4989         * archive.h (class Archive): Update declaration.
4990         * object.cc (Sized_relobj::do_should_include_member): Add layout
4991         parameter.
4992         * object.h (Object::should_include_member): Add layout parameter.
4993         Change all callers.
4994         (Object::do_should_include_member): Add layout parameter.
4995         (class Sized_relobj): Update declaration.
4996         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
4997         parameter.
4998         * dynobj.h (class Sized_dynobj): Update declaration.
4999         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5000         layout parameter.
5001         * plugin.h (class Sized_pluginobj): Update declaration.
5002
5003 2010-08-02  Ian Lance Taylor  <iant@google.com>
5004
5005         PR 11866
5006         * output.cc (Output_segment::set_offset): Search for the first and
5007         last sections rather than assuming that the list is in order.
5008         (Output_segment::find_first_and_last_list): New function.
5009         * output.h (class Output_segment): Update declarations.
5010         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5011         (relro_strip_test_SOURCES): New variable.
5012         (relro_strip_test_DEPENDENCIES): New variable.
5013         (relro_strip_test_LDFLAGS): New variable.
5014         (relro_strip_test_LDADD): New variable.
5015         (relro_strip_test.so): New target.
5016
5017 2010-08-02  Ian Lance Taylor  <iant@google.com>
5018
5019         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5020         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5021         (Target_i386::got_tlsdesc_section): New function.
5022         (Target_i386::got_section): Create space for GOT entries for
5023         TLSDESC relocations.
5024         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5025         R_386_TLS_GOTDESC.
5026         (Target_i386::Scan::global): Likewise.
5027         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5028         using TLSDESC GOT.
5029         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5030         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5031         (Target_x86_64::got_tlsdesc_section): New function.
5032         (Target_x86_64::got_section): Create space for GOT entries for
5033         TLSDESC relocations.
5034         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5035         R_386_TLS_GOTDESC.
5036         (Target_x86_64::Scan::global): Likewise.
5037         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5038         using TLSDESC GOT.
5039
5040 2010-08-02  Ian Lance Taylor  <iant@google.com>
5041
5042         * testsuite/final_layout.sh: Use dc to convert from hex to
5043         decimal.
5044
5045 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5046
5047         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5048         paramter to the call to gold::gc_process_relocs.
5049         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5050         paramter to the call to gold::gc_process_relocs.
5051         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5052         parameter to the call to gold::gc_process_relocs.
5053         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5054         template parameter to the call to gold::gc_process_relocs.
5055         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5056         paramter to the call to gold::gc_process_relocs.
5057         * gc.h (get_embedded_addend_size): New function.
5058         (gc_process_relocs): Save the size of the reloc for use by ICF.
5059         * icf.cc (get_section_contents): Get the addend from the text section
5060         for SHT_REL relocation sections.
5061         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5062         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5063         * int_encoding.h (read_from_pointer): New overloaded function.
5064         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5065         * testsuite/icf_sht_rel_addend_test.sh: New file.
5066         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5067         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5068
5069 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5070
5071         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5072         * Makefile.in: Regenerate.
5073         * testsuite/Makefile.in: Regenerate.
5074
5075 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5076
5077         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5078         * gold/testsuite/debug_msg.cc: Likewise.
5079         * gold/testsuite/odr_violation1.cc
5080         * gold/testsuite/odr_violation2.cc
5081
5082 2010-07-21  Cary Coutant  <ccoutant@google.com>
5083
5084         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5085         string, and length fields.
5086         (Output_merge_string::Merged_strings_list): New type.
5087         (Output_merge_string::Merged_strings_lists): New typedef.
5088         (Output_merge_string): Replace merged_strings_ with
5089         merged_strings_lists_.
5090         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5091         Merged_strings_list per input object and section.  Don't store pointer
5092         to the string.  Don't store length with each merged string entry.
5093         (Output_merge_string::finalize_merged_data): Loop over list of merged
5094         strings lists.  Recompute length of each merged string.
5095
5096 2010-07-15  Cary Coutant  <ccoutant@google.com>
5097
5098         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5099         here.
5100
5101 2010-07-14  Ian Lance Taylor  <iant@google.com>
5102
5103         * descriptors.cc (Descriptors::open): Report correct name in error
5104         message.
5105
5106 2010-07-13  Doug Kwan  <dougkwan@google.com>
5107
5108         * arm.cc (Arm_input_section::Arm_input_section): For a
5109         SHT_ARM_EXIDX section, always keeps the input sections.
5110         (Arm_input_section::set_exidx_section_link): New method.
5111         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5112         has_errors_ to false.
5113         (Arm_exidx_input_section::has_errors,
5114         Arm_exidx_input_section::set_has_errors): New methods.
5115         (Arm_exidx_input_section::has_errors_): New data member.
5116         (Arm_relobj::get_exidx_shndx_list): New method.
5117         (Arm_output_section::append_text_sections_to_list): Do not skip
5118         section without SHF_EXECINSTR.
5119         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5120         errors.
5121         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5122         section header.  Make error messages more verbose.  Check for
5123         a non-executable section linked to an EXIDX section.
5124         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5125         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5126         check that there is no deferred EXIDX section if we exit early.
5127         Instead of not making an EXIDX section in case of an error, make one
5128         and set the has_errors flag of it.
5129         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5130         in a relocatable link.
5131         (Target_arm::do_relax): Look for the EXIDX output section instead of
5132         assuming that it is called .ARM.exidx.
5133         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5134         section list.  Do not check for SHF_EXECINSTR section flags but
5135         skip any input section with errors.
5136         * output.cc (Output_section::Output_section): Initialize
5137         always_keeps_input_sections_ to false.
5138         (Output_section::add_input_section): Check for
5139         always_keeps_input_sections_.
5140         *  output.h (Output_section::always_keeps_input_sections,
5141         Output_section::set_always_keeps_input_sections): New methods.
5142         (Output_section::always_keeps_input_sections): New data member.
5143
5144 2010-07-13  Rafael Espindola  <espindola@google.com>
5145
5146         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5147         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5148
5149 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5150             Ian Lance Taylor  <iant@google.com>
5151
5152         * output.h (Output_section_lookup_maps::add_merge_section):
5153         Correct check of whether value was inserted.
5154         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5155         (Output_section_lookup_maps::add_relaxed_input_section):
5156         Likewise.
5157         * arm.cc (Target_arm::got_section): Remove used local os.
5158         * i386.cc (Target_i386::got_section): Likewise.
5159         * x86_64.cc (Target_x86_64::got_section): Likewise.
5160         * sparc.cc (Target_sparc::got_section): Likewise.
5161         (Target_sparc::relocate): Remove unused local have_got_offset.
5162         * powerpc.cc (Target_powerpc::relocate): Likewise.
5163
5164 2010-07-13  Ian Lance Taylor  <iant@google.com>
5165
5166         * compressed_output.cc (zlib_decompress): Fix signature in
5167         !HAVE_ZLIB_H case.
5168
5169         * archive.cc (Archive::include_member): Unlock an external member
5170         of a thin archive.  Don't bother to delete an object we know is
5171         NULL.
5172
5173 2010-07-12  Cary Coutant  <ccoutant@google.com>
5174
5175         * compressed_output.cc (zlib_decompress): New function.
5176         (get_uncompressed_size): New function.
5177         (decompress_input_section): New function.
5178         * compressed_output.h (get_uncompressed_size): New function.
5179         (decompress_input_section): New function.
5180         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5181         Handle compressed debug sections.
5182         * layout.cc (is_compressed_debug_section): New function.
5183         (Layout::output_section_name): Map compressed section names to
5184         canonical names.
5185         * layout.h (is_compressed_debug_section): New function.
5186         (is_debug_info_section): Recognize compressed debug sections.
5187         * merge.cc: Include compressed_output.h.
5188         (Output_merge_data::do_add_input_section): Handle compressed
5189         debug sections.
5190         (Output_merge_string::do_add_input_section): Handle compressed
5191         debug sections.
5192         * object.cc: Include compressed_output.h.
5193         (Sized_relobj::Sized_relobj): Initialize new data members.
5194         (build_compressed_section_map): New function.
5195         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5196         * object.h (Object::section_is_compressed): New method.
5197         (Object::do_section_is_compressed): New method.
5198         (Sized_relobj::Compressed_section_map): New type.
5199         (Sized_relobj::do_section_is_compressed): New method.
5200         (Sized_relobj::compressed_sections_): New data member.
5201         * output.cc (Output_section::add_input_section): Handle compressed
5202         debug sections.
5203         * reloc.cc: Include compressed_output.h.
5204         (Sized_relobj::write_sections): Handle compressed debug sections.
5205
5206 2010-07-08  Cary Coutant  <ccoutant@google.com>
5207
5208         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5209         weak when resolving to a dynamic def.
5210         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5211         for weak undef/dynamic def cases. Adjust callers.
5212         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5213         undef_binding_weak_.
5214         (Symbol_table::sized_write_globals): Adjust symbol binding.
5215         (Symbol_table::sized_write_symbol): Add binding parameter.
5216         * symtab.h (Symbol::set_undef_binding): New method.
5217         (Symbol::is_undef_binding_weak): New method.
5218         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5219         (Symbol_table::should_override): Add new parameter.
5220         (Symbol_table::sized_write_symbol): Add new parameter.
5221
5222         * testsuite/weak_undef_file1.cc: Add new test case.
5223         * testsuite/weak_undef_file2.cc: Fix header comment.
5224         * testsuite/weak_undef_test.cc: Add new test case.
5225
5226 2010-06-29  Doug Kwan  <dougkwan@google.com>
5227
5228         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5229         Initialize USE_SYMBOL_.
5230         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5231         definition.
5232         (Arm_reloc_property::uses_symbol_): New data member declaration.
5233         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5234         uses symbol value and symbol is undefined but not weakly undefined.
5235
5236 2010-06-28  Rafael Espindola  <espindola@google.com>
5237
5238         * plugin.cc (Plugin::load): Use dlerror.
5239
5240 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5241
5242         * symtab.cc (detect_odr_violations): When reporting an ODR
5243         violation, report an object where the symbol is defined.
5244
5245 2010-06-25  Doug Kwan  <dougkwan@google.com>
5246
5247         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5248         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5249         definition.
5250         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5251         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5252         target hook to detect function points.
5253         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5254         * icf.h (Icf::check_section_for_function_pointers): Change type of
5255         parameter SECTION_NAME to const reference to std::string.  Use
5256         target hook to determine if section may have unsafe pointers.
5257         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5258         method definition.
5259
5260 2010-06-21  Rafael Espindola  <espindola@google.com>
5261
5262         * fileread.cc (Input_file::find_fie): New
5263         (Input_file::open): Use Input_file::find_fie.
5264         * fileread.h (Input_file::find_fie): New
5265         * plugin.cc (set_extra_library_path): New.
5266         (Plugin::load): Add set_extra_library_path to the transfer vector.
5267         (Plugin_manager::set_extra_library_path): New.
5268         (Plugin_manager::add_input_file): Use the extra search path if set.
5269         (set_extra_library_path(): New.
5270         * plugin.h (Plugin_manager): Add set_extra_library_path and
5271         extra_search_path_.
5272
5273 2010-06-19  Cary Coutant  <ccoutant@google.com>
5274
5275         * layout.cc (gdb_sections): Add .debug_types.
5276         (lines_only_debug_sections): Likewise.
5277
5278 2010-06-18  Rafael Espindola  <espindola@google.com>
5279
5280         * plugin.cc (add_input_file,add_input_library)
5281         (Plugin_manager::add_input_file): Make filename arguments const.
5282         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5283         const.
5284
5285 2010-06-16  Doug Kwan  <dougkwan@google.com>
5286
5287         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5288         .ARM.attributes section if we have not merged any input
5289         attributes sections.
5290
5291 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5292
5293         * arm.cc: Allow combining objects with no EABI version
5294         information.
5295
5296 2010-06-15  Rafael Espindola  <espindola@google.com>
5297
5298         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5299
5300 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5301
5302         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5303         (struct iovec): Correct !HAVE_READV definition.
5304
5305 2010-06-10  Cary Coutant  <ccoutant@google.com>
5306
5307         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5308         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5309         reloc sections.
5310         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5311
5312         PR 11683
5313         * symtab.h (Symbol::is_placeholder): New member function.
5314         * target-reloc.h (relocate_section): Check for placeholder symbols.
5315
5316         * testsuite/Makefile.am (plugin_test_8): New test.
5317         (plugin_test_9): New test.
5318         * testsuite/Makefile.in: Regenerate.
5319
5320 2010-06-09  Nick Clifton  <nickc@redhat.com>
5321
5322         * yyscript.y (input_list_element): Allow strings prefixed with
5323         the '-' character.  Treat these as libraries.
5324         * script.cc (script_add_library): New function.  Adds a library
5325         specified by "-l<name>" found in an input script.
5326         * script-c.h: Add prototype for script_add_library.
5327
5328 2010-06-07  Doug Kwan  <dougkwan@google.com>
5329
5330         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5331         Restrict stub-group size to be within long conditional branch
5332         range when working around cortex-A8 erratum.
5333
5334 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5335
5336         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5337         #ifdef typo.
5338
5339 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5340
5341         PR gold/11658
5342         * output.cc
5343         (Output_section::Input_section_sort_entry::compare_section_ordering):
5344         Change to return non-zero correctly.
5345         (Output_section::Input_section_sort_section_order_index_compare
5346         ::operator()): Change to fix ambiguity in comparisons.
5347
5348 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5349
5350         * gold.h (is_wildcard_string): New function.
5351         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5352         (Layout::layout_eh_frame): Ditto.
5353         (Layout::find_section_order_index): New method.
5354         (Layout::read_layout_from_file): New method.
5355         * layout.h (Layout::find_section_order_index): New method.
5356         (Layout::read_layout_from_file): New method.
5357         (Layout::input_section_position_): New private member.
5358         (Layout::input_section_glob_): New private member.
5359         * main.cc (main): Call read_layout_from_file here.
5360         * options.h (--section-ordering-file): New option.
5361         * output.cc (Output_section::input_section_order_specified_): New
5362         member.
5363         (Output_section::Output_section): Initialize new member.
5364         (Output_section::add_input_section): Add new parameter.
5365         Keep input sections when --section-ordering-file is used.
5366         (Output_section::set_final_data_size): Sort input sections when
5367         section ordering file is specified.
5368         (Output_section::Input_section_sort_entry): Add new parameter.
5369         Check sorting type.
5370         (Output_section::Input_section_sort_entry::compare_section_ordering):
5371         New method.
5372         (Output_section::Input_section_sort_compare::operator()): Change to
5373         consider section_order_index.
5374         (Output_section::Input_section_sort_init_fini_compare::operator()):
5375         Change to consider section_order_index.
5376         (Output_section::Input_section_sort_section_order_index_compare
5377         ::operator()): New method.
5378         (Output_section::sort_attached_input_sections): Change to sort
5379         according to section order when specified.
5380         (Output_section::add_input_section<32, true>): Add new parameter.
5381         (Output_section::add_input_section<64, true>): Add new parameter.
5382         (Output_section::add_input_section<32, false>): Add new parameter.
5383         (Output_section::add_input_section<64, false>): Add new parameter.
5384         * output.h (Output_section::add_input_section): Add new parameter.
5385         (Output_section::input_section_order_specified): New
5386         method.
5387         (Output_section::set_input_section_order_specified): New method.
5388         (Input_section::Input_section): Initialize section_order_index_.
5389         (Input_section::section_order_index): New method.
5390         (Input_section::set_section_order_index): New method.
5391         (Input_section::section_order_index_): New member.
5392         (Input_section::Input_section_sort_section_order_index_compare): New
5393         struct.
5394         (Output_section::input_section_order_specified_): New member.
5395         * script-sections.cc (is_wildcard_string): Delete and move modified
5396         method to gold.h.
5397         (Output_section_element_input::Output_section_element_input): Modify
5398         call to is_wildcard_string.
5399         (Output_section_element_input::Input_section_pattern
5400         ::Input_section_pattern): Ditto.
5401         (Output_section_element_input::Output_section_element_input): Ditto.
5402         * testsuite/Makefile.am (final_layout): New test case.
5403         * testsuite/Makefile.in: Regenerate.
5404         * testsuite/final_layout.cc: New file.
5405         * testsuite/final_layout.sh: New file.
5406
5407 2010-06-01  Rafael Espindola  <espindola@google.com>
5408
5409         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5410
5411 2010-06-01  Rafael Espindola  <espindola@google.com>
5412
5413         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5414         visibility of symbols.
5415
5416 2010-05-27  Doug Kwan  <dougkwan@google.com>
5417
5418         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5419         from start of output section instead of address for a local symbol
5420         in a merged or relaxed section when doing a relocatable link.
5421
5422 2010-05-26  Rafael Espindola  <espindola@google.com>
5423
5424        PR 11604
5425         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5426         adding sections the garbage collector removed.
5427         * gold/testsuite/Makefile.am: Add test.
5428         * gold/testsuite/Makefile.in: Regenerate.
5429         * gold/testsuite/plugin_test_7.sh: New.
5430         * gold/testsuite/plugin_test_7_1.c: New.
5431         * gold/testsuite/plugin_test_7_2.c: New.
5432
5433 2010-05-26  Rafael Espindola  <espindola@google.com>
5434
5435         * script-sections.cc (Output_section_definition::set_section_addresses):
5436         Check for --section-start.
5437
5438 2010-05-26  Doug Kwan  <dougkwan@google.com>
5439
5440         * arm.cc (Arm_scan_relocatable_relocs): New class.
5441         (Target_arm::relocate_special_relocatable): New method.
5442         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5443         (Arm_relocate_functions::thumb_branch_common): Same.
5444         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5445         instead of Default_scan_relocatable_relocs.
5446         * target-reloc.h (relocate_for_relocatable): Let target handle
5447         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5448         * target.h (Sized_target::relocate_special_relocatable): New method.
5449
5450 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5451
5452         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5453
5454 2010-05-23  Doug Kwan  <dougkwan@google.com>
5455
5456         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5457         instead of a cast.
5458         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5459         with a direct branch, not a conditional branch, to a stub.
5460         * merge.cc (Output_merge_base::record_input_section): New method
5461         defintion.
5462         (Output_merge_data::do_add_input_section): Record input section if
5463         keeps-input-sections flag is set.
5464         (Output_merge_string::do_add_input_section): Ditto.
5465         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5466         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5467         INPUT_SECTIONS_.
5468         (Output_merge_base::keeps_input_sections,
5469         Output_merge_base::set_keeps_input_sections,
5470         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5471         method definitions.
5472         (Output_merge_base::Input_sections): New type declaration.
5473         (Output_merge_base::input_sections_begin,
5474         Output_merge_base::input_sections_end,
5475         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5476         (Output_merge_base::bool keeps_input_sections_,
5477         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5478         Output_merge_base::input_sections_): New data members.
5479         (Output_merge_data::do_set_keeps_input_sections): New method
5480         defintion.
5481         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5482         * output.cc (Output_section::Input_section::relobj): Move method
5483         defintion from class declaration to here and handle merge sections.
5484         (Output_section::Input_section::shndx): Ditto.
5485         (Output_section::Output_section): Remove initializations of removed
5486         data members and initialize new data member LOOKUP_MAPS_.
5487         (Output_section::add_input_section): Set keeps-input-sections flag
5488         for a newly created merge output section as appropriate.  Adjust code
5489         to use Output_section_lookup_maps class.
5490         (Output_section::add_relaxed_input_section): Adjst code for lookup
5491         maps code refactoring.
5492         (Output_section::add_merge_input_section): Add a new parameter
5493         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5494         class.  If adding input section to a newly created merge output
5495         section fails, remove the new merge section.
5496         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5497         Adjust code for use of the Output_section_lookup_maps class.
5498         (Output_section::find_merge_section): Ditto.
5499         (Output_section::build_lookup_maps): New method defintion.
5500         (Output_section::find_relaxed_input_section): Adjust code to use
5501         Output_section_lookup_maps class.
5502         (Output_section::get_input_sections): Export merge sections.  Adjust
5503         code to use Output_section_lookup_maps class.
5504         (Output_section:::add_script_input_section): Adjust code to use
5505         Output_section_lookup_maps class.  Update lookup maps for merge
5506         sections also.
5507         (Output_section::discard_states): Use Output_section_lookup_maps.
5508         (Output_section::restore_states): Same.
5509         * output.h (Merge_section_properties): Move class defintion out of
5510         Output_section.
5511         (Output_section_lookup_maps): New class.
5512         (Output_section::Input_section::is_merge_section): New method
5513         defintion.
5514         (Output_section::Input_section::relobj): Move defintion out of class
5515         defintion.  Declare method only.
5516         (Output_section::Input_section::shndx): Ditto.
5517         (Output_section::Input_section::output_merge_base): New method defintion.
5518         (Output_section::Input_section::u2_.pomb): New union field.
5519         (Output_section::Merge_section_by_properties_map,
5520         Output_section::Output_section_data_by_input_section_map,
5521         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5522         Remove types.
5523         (Output_section::add_merge_input_section): Add new parameter
5524         KEEPS_INPUT_SECTIONS.
5525         (Output_section::build_lookup_maps): New method declaration.
5526         (Output_section::merge_section_map_,
5527         Output_section::merge_section_by_properties_map_,
5528         Output_section::relaxed_input_section_map_,
5529         Output_section::is_relaxed_input_section_map_valid_): Remove data
5530         members.
5531         (Output_section::lookup_maps_): New data member.
5532
5533 2010-05-21  Doug Kwan  <dougkwan@google.com>
5534
5535         PR gold/11619
5536         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5537         avoid a compilation error.
5538
5539 2010-05-19  Rafael Espindola  <espindola@google.com>
5540
5541         * script-sections.cc (Output_section_definition::allocate_to_segment):
5542         Update the phdrs_list even when the output section is NULL.
5543         * testsuite/Makefile.am: Add test.
5544         * testsuite/Makefile.in: Regenerate.
5545         * testsuite/script_test_9.cc: New.
5546         * testsuite/script_test_9.sh: New.
5547         * testsuite/script_test_9.t: New.
5548
5549 2010-05-19  Doug Kwan  <dougkwan@google.com>
5550
5551         * arm.cc (Arm_input_section::original_size): New method.
5552         (Arm_input_section::do_addralign): Add a cast.
5553         (Arm_input_section::do_output_offset): Remove static cast.
5554         (Arm_input_section::original_addralign,
5555          Arm_input_section::original_size_): Change type to uint32_t.
5556         (Arm_input_section::init): Add safe casts for section alignment
5557         and size.
5558         (Arm_input_section::set_final_data_size): Do not set address and
5559         offset of stub table.
5560         (Arm_output_section::fix_exidx_coverage): Change use of of
5561         Output_section::Simple_input_section to that of
5562         Output_section::Input_section.
5563         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5564         except for the first pass.
5565         * output.cc (Output_section::get_input_sections): Change type of
5566         input_sections to std::list<Input_section>.
5567         (Output_section::add_script_input_section): Rename from
5568         Output_section::add_simple_input_section.  Change type of SIS
5569         parameter from Simple_input_section to Input_section.
5570         * output.h (Output_section::Simple_input_section): Remove class.
5571         (Output_section::Input_section): Change class visibility to public.
5572         (Output_section::Input_section::addralign): Use stored alignments
5573         for special input sections if set.
5574         (Output_section::Input_section::set_addralign): New method.
5575         (Output_section::get_input_sections): Change parameter type from
5576         list of Simple_input_section to list of Input_section.
5577         (Output_section::add_script_input_section): Rename from
5578         Output_section::add_simple_input_section. Change first parameter's
5579         type from Simple_input_section to Input_section and remove the
5580         second and third parameters.
5581         * script-sections.cc (Input_section::Input_section_list): Change
5582         type to list of Output_section::Input_section/
5583         (Input_section_info::Input_section_info): Change parameter type of
5584         INPUT_SECTION to Output_section::Input_section.
5585         (Input_section_info::input_section): Change return type.
5586         (Input_section_info::input_section_): Change type to
5587         Output_section::Input_section.
5588         (Output_section_element_input::set_section_addresses): Adjust code
5589         to use Output_section::Input_section instead of
5590         Output_section::Simple_input_section.  Adjust code for renaming
5591         of Output_section::add_simple_input_section.
5592         (Orphan_output_section::set_section_addresses): Ditto.
5593
5594 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5595
5596         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5597         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5598
5599 2010-05-18  Rafael Espindola  <espindola@google.com>
5600
5601         * options.cc (General_options::finalize): Handle -nostdlib.
5602         * options.h (nostdlib): New option.
5603         * script.cc (script_add_search_dir): Handle -nostdlib.
5604
5605 2010-05-12  Doug Kwan  <dougkwan@google.com>
5606
5607         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5608         attributes section only if there no attributes section after merging.
5609         (Target_arm::merge_object_attributes): Move value of
5610         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5611         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5612         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5613         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5614         and arm_attr_merge_7.stdout.
5615         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5616         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5617         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5618         arm_attr_merge_7b.o): New rules.
5619         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5620         arm_attr_merge_7
5621         * testsuite/Makefile.in: Regenerate.
5622         * testsuite/arm_attr_merge.sh: New file.
5623         * testsuite/arm_attr_merge_[67][ab].s: Same.
5624
5625 2010-05-05  Nick Clifton  <nickc@redhat.com>
5626
5627         * po/es.po: Updated Spanish translation.
5628
5629 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5630
5631         * Makefile.am (install-exec-local): Properly install gold as
5632         default cross linker.
5633         * Makefile.in: Regenerated.
5634
5635 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5636             Nick Clifton  <nickc@redhat.com>
5637
5638         * configure.ac (install_as_default): Define and set to false
5639         unless --enable-gold or --enable-gold=both/gold has been
5640         specified.
5641         * configure: Regenerate.
5642
5643         * Makefile.am (install-exec-local): Install the executable as
5644         'ld.gold'.  If install_as_default is true then also install it as
5645         'ld'.
5646         * Makefile.in: Regenerated.
5647
5648 2010-04-24  Ian Lance Taylor  <iant@google.com>
5649
5650         * layout.cc (Layout::layout_reloc): In relocatable link don't
5651         combine reloc sections for grouped sections.
5652
5653 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5654
5655         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5656         sections that are not ordinary to icf.
5657         * icf.cc (get_section_contents): Handle relocation pointing to section
5658         with no object or shndx information.
5659         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5660         * testsuite/Makefile.in: Regenerate.
5661         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5662         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5663
5664 2010-04-22  Ian Lance Taylor  <iant@google.com>
5665
5666         * expression.cc (Expression::Expression_eval_info): Add
5667         result_alignment_pointer field.
5668         (Expression::eval_with_dot): Add result_alignment_pointer
5669         parameter.  Change all callers.
5670         (Expression::eval_maybe_dot): Likewise.
5671         (class Binary_expression): Add alignment_pointer parameter to
5672         left_value and right_value.  Change all callers.
5673         (BINARY_EXPRESSION): Set result alignment.
5674         (class Trinary_expression): Add alignment_pointer parameter to
5675         arg2_value and arg3_value.  Change all callers.
5676         (Trinary_cond::value): Set result alignment.
5677         (Max_expression::value, Min_expression::value): Likewise.
5678         (Align_expression::value): Likewise.
5679         * script-sections.cc (class Sections_element): Add dot_alignment
5680         parameter to set_section_addresses virtual function.  Update
5681         instantiations.
5682         (class Output_section_element): Likewise.
5683         (Script_sections::create_segments): Add dot_alignment parameter.
5684         Change all callers.
5685         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5686         (Script_sections::set_phdrs_clause_addresses): Likewise.
5687         * script-sections.h: Update declarations.
5688         * script.h: Update declarations.
5689         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5690         min_p_align.
5691         * testsuite/script_test_3.t: Set large alignment.
5692         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5693         segment has expected alignment.
5694
5695 2010-04-22  Nick Clifton  <nickc@redhat.com>
5696
5697         * po/gold.pot: Updated by the Translation project.
5698         * po/vi.po: Updated Vietnamese translation.
5699
5700 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5701
5702         * testsuite/Makefile.am (check_PROGRAMS): Add
5703         icf_virtual_function_folding_test.
5704         * testsuite/Makefile.in: Regenerated.
5705
5706 2010-04-15  Andrew Haley  <aph@redhat.com>
5707
5708         * options.h (merge_exidx_entries): New option.
5709         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5710         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5711         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5712         (Target_arm::merge_exidx_entries): New function.
5713         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5714         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5715         to Arm_exidx_fixup constructor.
5716         Add new arg, merge_exidx_entries.
5717         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5718         Arm_output_section::fix_exidx_coverage.
5719
5720 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5721
5722         * icf.cc (get_section_contents): Check for preemptible functions.
5723         Ignore addend when appropriate.
5724         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5725         section folded.
5726         (add_from_relobj): Check for section folded.
5727         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5728         * symtab.h (should_add_dynsym_entry): Add new parameter.
5729         * target-reloc.h (scan_relocs): Check for section folded.
5730         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5731         Check reloc types for function pointers in shared objects.
5732         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5733         case.
5734         (icf_preemptible_functions_test): New test case.
5735         (icf_string_merge_test): New test case.
5736         * testsuite.Makefile.in: Regenerate.
5737         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
5738         bar_glob.  Refactor code.
5739         * testsuite/icf_preemptible_functions_test.cc: New file.
5740         * testsuite/icf_preemptible_functions_test.sh: New file.
5741         * testsuite/icf_string_merge_test.cc: New file.
5742         * testsuite/icf_string_merge_test.sh: New file.
5743         * testsuite/icf_virtual_function_folding_test.cc: New file.
5744         * testsuite/icf_virtual_function_folding_test.sh: New file.
5745
5746 2010-04-14  Doug Kwan  <dougkwan@google.com>
5747
5748         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
5749         for local symbol recounting if we remove a section due to ICF.
5750         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
5751         there are no regular objects in input.
5752
5753 2010-04-13  Doug Kwan  <dougkwan@google.com>
5754
5755         * arm.cc (Arm_input_section::set_final_data_size): Compute
5756         accurate final data size instead of using current data size.
5757
5758 2010-04-09  Doug Kwan  <dougkwan@google.com>
5759
5760         * layout.cc (Layout::choose_output_section): Handle script section
5761         types.
5762         (Layout::make_output_section_for_script): Add section type parameter.
5763         Handle script section types.
5764         * layout.h (Layout::make_output_section_for_script): Add section
5765         type parameter.
5766         * output.cc (Output_section::Output_section): Initialize data member
5767         is_noload_.
5768         (Output_section::do_reset_address_and_file_offset): Do not set address
5769         to 0 if section is a NOLOAD section.
5770         * output.h (Output_section::is_noload): New method.
5771         (Output_section::set_is_noload): Ditto.
5772         (Output_section::is_noload_): New data member.
5773         * script-c.h (Script_section_type): New enum type.
5774         (struct Parser_output_section_header): Add new file section_type.
5775         * script-sections.cc (Sections_element::output_section_name): Add
5776         parameter for returning script section type.
5777         (Output_section_definition::output_section_name): Ditto.
5778         (Output_section_definition::section_type)P; New method.
5779         (Output_section_definiton::script_section_type_name): Ditto.
5780         (Output_section_definition::script_section_type_): New data member.
5781         (Output_section_definition::Output_section_definition): Initialize
5782         data member Output_section_definition::script_section_type_.
5783         (Output_section_definition::create_sections): Pass script section type
5784         to Layout::make_output_section_for_script.
5785         (Output_section_definition::output_section_name): Return script
5786         section type to caller.
5787         (Output_section_definition::set_section_address): Do not advance
5788         dot value and load address if section type is NOLOAD.  Set address
5789         of NOLOAD sections regardless of section flags.
5790         (Output_section_definition::print): Print section type if it is
5791         not SCRIPT_SECTION_TYPE_NONE.
5792         (Output_section_definition::section_type): New method.
5793         (Output_section_definition::script_section_type_name): Ditto.
5794         (Script_sections::output_section_name): Add new parameter
5795         PSECTION_TYPE for returning script section type.  Pass it to
5796         section elements.  Handle discard sections.
5797         (Sort_output_sections::operator()): Handle NOLOAD sections.
5798         * script-sections.h (Script_sections::Section_type): New enum type.
5799         (Script_sections::output_section_name): Add a new parameter for
5800         returning script section type.
5801         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
5802         INFO and NOLOAD.
5803         * yyscript.y (union): Add new field SECTION_TYPE.
5804         (COPY, DSECT, INFO, NOLOAD): New tokens.
5805         (opt_address_and_section_type): Change type to output_section_header.
5806         (section_type): New non-terminal
5807         (section_header): Handle section type.
5808         (opt_address_and_section_type): Return section type value.
5809
5810 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
5811
5812         * testsuite/plugin_common_test_1.c (foo): Add prototype.
5813         * testsuite/plugin_common_test_2.c (foo): Likewise.
5814
5815 2010-04-08  Doug Kwan  <dougkwan@google.com>
5816
5817         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
5818         Output_merge_data.
5819         * output.cc (Output_section::add_merge_input_section): Simplify
5820         code and return status of Output_merge_base::add_input_section.
5821         Update merge section map only if Output_merge_base::add_input_section
5822         returns true.
5823
5824 2010-04-07  Doug Kwan  <dougkwan@google.com>
5825
5826         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
5827         if section is marked as containing instructions but has no mapping
5828         symbols.
5829         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
5830         correct section index.
5831         (Arm_relobj::find_linked_text_section): Ditto.
5832
5833 2010-04-07  Cary Coutant  <ccoutant@google.com>
5834
5835         * archive.cc (include_member): Destroy Read_symbols_data object before
5836         releasing file.
5837         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
5838         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
5839         (Read_symbols_data::~Read_symbols_data) New destructor.
5840         (Section_relocs::Section_relocs) New constructor.
5841         (Section_relocs::~Section_relocs) New destructor.
5842         (Read_relocs_data::Read_relocs_data) New constructor.
5843         (Read_relocs_data::~Read_relocs_data) New destructor.
5844         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
5845         pointers to NULL after deleting.
5846
5847 2010-04-07  Doug Kwan  <dougkwan@google.com>
5848
5849         * arm.cc: Replace "endianity" with "endianness" in comments.
5850         (Arm_exidx_cantunwind): Ditto.
5851         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
5852         (Arm_relobj::merge_flags_and_attributes): New method.
5853         (Arm_relobj::merge_flags_and_attributes_): New data member.
5854         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
5855         (Arm_relobj::scan_sections_for_stubs): Ditto.
5856         (Arm_relobj::do_read_symbols): Check to see if we really want to
5857         merge processor-specific flags and attributes.  Exit early if
5858         an object is empty except for section names and the undefined symbol.
5859         (Target_arm::do_finalize_sections): Move check for ELF format to
5860         Arm_relobj::do_read_symbols.  Merge processor specific flags and
5861         attributes from a regular object only when we have determined that
5862         it is aapropriate.  Do not create an .ARM.attributes section in
5863         output if there is no regular input object.
5864         (Target_arm::merge_processor_specific_flags): Check
5865         --warn-mismatch before printing any error.
5866         (Target_arm::merge_object_attributes): Ditto.
5867         * gold.cc (queue_middle_tasks): Handle the case in which there is
5868         no regular object in input.
5869         * options.cc (General_options::parse_EB): New method.
5870         (General_options::parse_EL): Same.
5871         (General_options::General_options): Initialize endianness_.
5872         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
5873         New options.
5874         (General_options::Endianness): New enum.
5875         (General_options::endianness): New method.
5876         (General_options::endianness_): New data member.
5877         * parameters.cc (Parameters::set_options): Check target endianness.
5878         (Parameters::set_target_once): Ditto.
5879         (Parameters::check_target_endianness): New method.
5880         (parameters_force_valid_target): If either -EL or -EB is specified,
5881         use it to define endianness of default target.
5882         * parameters.h (Parameters::check_target_endianness): New method
5883         declaration.
5884         * target.h (class Target): Change "endianity" to "endianness"
5885         in comments.
5886
5887 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5888
5889         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
5890         * configure: Regenerate.
5891         * Makefile.in: Regenerate.
5892         * testsuite/Makefile.in: Regenerate.
5893
5894 2010-04-06  Cary Coutant  <ccoutant@google.com>
5895
5896         gcc PR lto/42757
5897         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
5898         prevailing definitions of common symbols.
5899         * testsuite/plugin_test_6.sh: New test case.
5900         * testsuite/plugin_common_test_1.c: New test case.
5901         * testsuite/plugin_common_test_2.c: New test case.
5902         * testsuite/Makefile.am (plugin_test_6): New test case.
5903         * testsuite/Makefile.in: Regenerate.
5904
5905 2010-04-06  Nick Clifton  <nickc@redhat.com>
5906
5907         * po/vi.po: New Vietnamese translation.
5908
5909 2010-03-30  Doug Kwan  <dougkwan@google.com>
5910
5911         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
5912
5913 2010-03-25  Doug Kwan  <dougkwan@google.com>
5914
5915         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
5916         to avoid a conversion warning on a 32-bit host.
5917
5918 2010-03-24  Ian Lance Taylor  <iant@google.com>
5919
5920         * testsuite/script_test_3.t: Add a TLS segment.
5921         * testsuite/Makefile.am (check_PROGRAMS): Add
5922         tls_phdrs_script_test.
5923         (tls_phdrs_script_test_SOURCES): Define.
5924         (tls_phdrs_script_test_DEPENDENCIES): Define.
5925         (tls_phdrs_script_test_LDFLAGS): Define.
5926         (tls_phdrs_script_test_LDADD): Define.
5927         * testsuite/Makefile.in: Rebuild.
5928
5929 2010-03-23  Cary Coutant  <ccoutant@google.com>
5930
5931         * fileread.cc (find_or_make_view): Fix comment.
5932
5933 2010-03-23  Ian Lance Taylor  <iant@google.com>
5934
5935         * script-sections.cc (class Orphan_section_placement): Define
5936         PLACE_TLS and PLACE_TLS_BSS.
5937         (Orphan_section_placement::Orphan_section_placement): Initialize
5938         new places.
5939         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
5940         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
5941         (tls_script_test_SOURCES): Define.
5942         (tls_script_test_DEPENDENCIES): Define.
5943         (tls_script_test_LDFLAGS): Define.
5944         (tls_script_test_LDADD): Define.
5945         * testsuite/Makefile.in: Rebuild.
5946
5947 2010-03-22  Doug Kwan  <dougkwan@google.com>
5948
5949         * arm.cc (Arm_relocate_functions::abs8,
5950         Arm_relocate_functions::abs16): Use correct check for overflow
5951         specified in the ARM ELF specs.
5952         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
5953         target of a BLX instruction specially.
5954         (Reloc_stub::stub_type_for_reloc): Ditto.
5955         (Relocate::relocate): Use symbolic names instead of numeric relocation
5956         codes to report error.
5957         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
5958         workaround.
5959         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
5960         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
5961         thumb2_blx_out_of_range.stdout
5962         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
5963         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
5964         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
5965         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
5966         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
5967         thumb2_blx_in_range, thumb2_blx_in_range.o,
5968         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
5969         thumb2_blx_out_of_range.o): New rules.
5970         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
5971         thumb2_blx_in_range and thumb2_blx_out_of_range.
5972         * testsuite/Makefile.in: Regenerate.
5973         * arm_branch_in_range.sh: Add tests for THUMB BLX.
5974         * testsuite/thumb_blx_in_range.s: New file.
5975         * testsuite/thumb_blx_out_of_range.s: New file.
5976
5977 2010-03-22  Rafael Espindola  <espindola@google.com>
5978
5979         * archive.cc (Should_include): Move to archive.h.
5980         (should_include_member): Make it a member of Archive.
5981         (Lib_group): New.
5982         (Add_lib_group_symbols): New.
5983         * archive.h: Include options.h.
5984         (Archive_member): Moved from Archive.
5985         (Should_include): Moved from archive.cc.
5986         (Lib_group): New.
5987         (Add_lib_group_symbols): New.
5988         * dynobj.cc (do_should_include_member): New.
5989         * dynobj.h (do_should_include_member): New.
5990         * gold.cc (queue_initial_tasks): Update call to queue.
5991         * main.cc (main): Print lib group stats.
5992         * object.cc (do_should_include_member): New.
5993         * object.h: Include archive.h.
5994         (Object::should_include_member): New.
5995         (Object::do_should_include_member): New.
5996         (Sized_relobj::do_should_include_member): New.
5997         * options.cc (General_options::parse_start_lib): New.
5998         (General_options::parse_end_lib): New.
5999         (Input_arguments::add_file): Handle lib groups.
6000         (Input_arguments::start_group): Check we are not in a lib.
6001         (Input_arguments::start_lib): New.
6002         (Input_arguments::end_lib): New.
6003         * options.h (General_options): Add start_lib and end_lib.
6004         (Input_argument::lib_): New.
6005         (Input_argument::lib): New.
6006         (Input_argument::is_lib): New.
6007         (Input_file_lib): New.
6008         (Input_arguments::in_lib_): New.
6009         (Input_arguments::in_lib): New.
6010         (Input_arguments::start_lib): New.
6011         (Input_arguments::end_lib_): New.
6012         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6013         in unused members as preempted.
6014         (Sized_pluginobj::do_should_include_member): New.
6015         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6016         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6017         return the blocker.
6018         (Read_symbols::do_whole_lib_group): New.
6019         (Read_symbols::do_lib_group): New.
6020         (Read_symbols::do_read_symbols): Handle lib groups.
6021         (Read_symbols::get_name): Handle lib groups.
6022         * readsyms.h (Read_symbols): Add an archive member pointer.
6023         (Read_symbols::do_whole_lib_group): New.
6024         (Read_symbols::do_lib_group): New.
6025         (Read_symbols::member_): New.
6026         * script.cc (read_input_script): Update call to queue_soon.
6027
6028 2010-03-19  Doug Kwan  <dougkwan@google.com>
6029
6030         * arm.cc (Stub_table::Stub_table): Initialize new data members
6031         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6032         (Stub_table::add_reloc_stub): Assign stub offset and update
6033         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6034         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6035         New data members.
6036         (Stub_table::update_data_size_and_addralign): Use
6037         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6038         instead of going over all reloc stubs.
6039         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6040         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6041         Stringpool_template::offset_ to size of Stringpool_char.
6042         (Stringpool_template::new_key_offset): Remove code to initialize
6043         Stringpool_template::offset_.
6044         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6045         Stringpool_template::offset_ to zero.
6046
6047 2010-03-15  Doug Kwan  <dougkwan@google.com>
6048
6049         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6050         offset_.
6051         (Stringpool_template::new_key_offset): New method.
6052         (Stringpool_template::add_string): Assign offsets when adding new
6053         strings.
6054         (Stringpool_template::set_string_offsets): Do not set string offsets
6055         when not optimizing.
6056         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6057         member size_.
6058         (Chunked_vector::clear): Clear size_.
6059         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6060         (Chunked_vector::size): Return size_.
6061         (Chunked_vector::push_back): Use size_ to find insert position.
6062         (Chunked_vector::size_): New data member.
6063         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6064         (Stringpool_template::new_key_offset): New method declaration.
6065         (Stringpool_template::offset_): New data member.
6066
6067 2010-03-15   Rafael Espindola  <espindola@google.com>
6068
6069         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6070         Add_symbols' constructor.
6071         * readsyms.h (Add_symbols): Remove the input_group member.
6072
6073 2010-03-10  Ian Lance Taylor  <iant@google.com>
6074
6075         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6076         target to ask whether a reference to a symbol requires a stack
6077         split.
6078         * target.h (Target::is_call_to_non_split): New function.
6079         (Target::do_is_call_to_non_split): Declare virtual function.
6080         * target.cc: Include "symtab.h".
6081         (Target::do_is_call_to_non_split): New function.
6082         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6083
6084 2010-03-10  Cary Coutant  <ccoutant@google.com>
6085
6086         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6087         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6088         (File_read::open[2]): Add whole_file_view_ to list of views.
6089         (File_read::make_view): Remove test of whole_file_view_.
6090         (File_read::find_or_make_view): Create whole_file_view_ if
6091         necessary.
6092         (File_read::clear_views): Replace bool parameter with enum;
6093         adjust all callers.  Don't delete views with permanent data;
6094         do delete cached views and views from archives if
6095         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6096         if clearing the corresponding view.
6097         * fileread.h (File_read::Clear_views_mode): New enum.
6098         (File_read::View::is_permanent_view): New method.
6099         (File_read::clear_views): Replace bool parameter
6100         with enum; adjust all callers.
6101         * options.h (General_options): Change keep_files_mapped option;
6102         add map_whole_files.
6103         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6104         releasing the file.
6105         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6106         the file.
6107
6108 2010-03-10  David S. Miller  <davem@davemloft.net>
6109
6110         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6111
6112 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6113
6114         * icf.cc (get_section_contents): Add '@' marker after processing the
6115         merge reloc.
6116
6117 2010-03-08  Doug Kwan  <dougkwan@google.com>
6118
6119         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6120         due to a conversion warning.
6121         (Arm_relobj::update_output_local_symbol_count): Check for local
6122         symbol with unset output index.
6123
6124 2010-03-05  Ian Lance Taylor  <iant@google.com>
6125
6126         * options.h (class General_options): Add --spare-dynamic-tags.
6127         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6128         --spare-dynamic-tags.
6129
6130 2010-03-05  Ian Lance Taylor  <iant@google.com>
6131
6132         * incremental.cc: Include "libiberty.h".
6133
6134 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6135
6136         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6137         function, is_info_ member.
6138         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6139         (Versions::Versions): Update caller.
6140         (Versions::define_base_version): Likewise.
6141         (Versions::add_def): Likewise.
6142
6143 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6144
6145         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6146         (Scan::possible_function_pointer_reloc): New function.
6147         (Scan::local_reloc_may_be_function_pointer): Change to call
6148         possible_function_pointer_reloc.
6149         (Scan::global_reloc_may_be_function_pointer): Ditto.
6150         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6151         relocations in ".data.rel.ro._ZTV" section.
6152         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6153         * testsuite/icf_safe_so_test.cc: Ditto.
6154         * testsuite/icf_safe_test.cc: Ditto.
6155         * testsuite/icf_safe_test.sh: Ditto.
6156
6157 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6158             Ian Lance Taylor  <iant@google.com>
6159
6160         * target-reloc.h (relocate_section): Check the symbol table index
6161         for -1U before setting the local symbol index.
6162         (scan_relocatable_relocs): If copying the relocation, record that
6163         the local symbol is required.
6164         * object.h (Symbol_value::is_output_symtab_index_set): New
6165         function.
6166         (Symbol_value::may_be_discarded_from_output_symtab): New
6167         function.
6168         (Symbol_value::has_output_symtab_entry): New function.
6169         (Symbol_value::needs_output_symtab_entry): Remove.
6170         (Symbol_value::output_symtab_index): Make sure the symbol index is
6171         set.
6172         (Symbol_value::set_output_symtab_index): Make sure the symbol
6173         index is not set.  Make sure the new index is valid.
6174         (Symbol_value::set_must_have_output_symtab_entry): New function.
6175         (Symbol_value::has_output_dynsym_entry): New function.
6176         (Symbol_value::set_output_dynsym_index): Make sure the new index
6177         is valid.
6178         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6179         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6180         local symbol if permitted.
6181         (Sized_relobj::do_finalize_local_symbols): Call
6182         is_output_symtab_index_set rather than needs_output_symtab_entry.
6183         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6184         rather than needs_output_symtab_entry.  Call
6185         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6186         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6187         is_output_symtab_index_set rather than needs_output_symtab_entry.
6188         * testsuite/discard_locals_relocatable_test.c: New file.
6189         * testsuite/discard_locals_test.sh: Test -r.
6190         * testsuite/Makefile.am (check_DATA): Add
6191         discard_locals_relocatable_test1.syms,
6192         discard_local_relocatable_test2.syms.
6193         (MOSTLYCLEANFILES): Likewise.  Also add
6194         discard_locals_relocatable_test1.lout and
6195         discard_locals_relocatable_test2.out.
6196         (discard_locals_relocatable_test1.syms): New target.
6197         (discard_locals_relocatable_test.o): New target.
6198         (discard_locals_relocatable_test1.out): New target.
6199         (discard_locals_relocatable_test2.syms): New target.
6200         (discard_locals_relocatable_test2.out): New target.
6201         (various): Add missing ../ld-new dependencies.
6202         * testsuite/Makefile.in: Rebuild.
6203
6204 2010-03-03  Nick Clifton  <nickc@redhat.com>
6205
6206         * po/fi.po: New Finnish translation.
6207
6208 2010-03-01  Doug Kwan  <dougkwan@google.com>
6209
6210         * layout.cc (Layout::Layout): Force section types of .init_array*,
6211         .preinit_array* and .fini_array* sections.
6212         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6213         Fix check of return value of std::string::find.().
6214         (Output_section::Input_section_sort_compare::operator()): Remove
6215         comment about .init_array.
6216         (Output_section::Input_section_sort_init_fini_compare::operator()):
6217         New method.
6218         (Output_section::sort_attached_input_sections): Handle .init_array
6219         and .fini_array specially.
6220         * output.h (Output_section::Inut_section_sort_compare): Update
6221         comment.
6222         (Output_section::Input_section_sort_init_fini_compare): New struct.
6223
6224 2010-02-26  Doug Kwan  <dougkwan@google.com>
6225
6226         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6227         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6228         * testsuite/debug_msg.sh: Avoid matching source line number for
6229         use of global variable undef_int.
6230
6231 2010-02-26  Doug Kwan  <dougkwan@google.com>
6232
6233         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6234         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6235         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6236         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6237         * options.cc (General_options::General_options): Initialize member
6238         fix_v4bx_.
6239         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6240         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6241         and rm_no_fix_v4bx.stdout
6242         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6243         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6244         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6245         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6246         and arm_no_fix_v4bx.
6247         * Makefile.in: Regenerate.
6248         * testsuite/arm_fix_v4bx.s: New file.
6249         * testsuite/arm_fix_v4bx.sh: Ditto.
6250
6251 2010-02-24  Doug Kwan  <dougkwan@google.com>
6252
6253         * arm.cc (Target_arm::got_section): Make the .got section the first
6254         non RELRO section in the data segment.
6255         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6256         suffixes of section names.
6257
6258 2010-02-24  Doug Kwan  <dougkwan@google.com>
6259
6260         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6261         flags and attributes merging if an input file is a binary file.
6262         * fileread.cc (Input_file::open): Record format of original file.
6263         * fileread.h (Input_file::Format): New enum type.
6264         (Input_file::Input_file): Initialize data member format_.
6265         (Input_file::format): New method definition.
6266         (Input_file::format_):: New data member.
6267
6268 2010-02-24  Doug Kwan  <dougkwan@google.com>
6269
6270         * arm.cc (Arm_output_data_got): New class.
6271         (ARM_TCB_SIZE): New constant
6272         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6273         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6274         If user uses a script with a SECTIONS clause, issue only a warning
6275         for a misplaced EXIDX input section.  Otherwise, issue an error.
6276         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6277         garbage collection.
6278         (Target_arm::got_mode_index_entry): Handle static linking.
6279         (Target_arm::Scan::local): Ditto.
6280         (Target_arm::Scan::global): Ditto.
6281         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6282         all incorrectly implemented relocations.
6283         (Target_arm::fix_exidx_coverage): Pass layout to
6284         Arm_output_section::fix_exidx_coverage.
6285         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6286         from ".ARM.exidx." and ".ARM.extab.".
6287
6288 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6289
6290         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6291         section if it does not already exist.
6292         * attributes.cc (Attributes_section_data::Attributes_section_data):
6293         Don't crash if size is zero.
6294
6295 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6296             Ian Lance Taylor  <iant@google.com>
6297
6298         * gold.cc (queue_middle_tasks): If no input files were opened,
6299         exit.
6300         * workqueue.h (Task_function::Task_function): Assert that there is
6301         a blocker.
6302
6303 2010-02-22  Doug Kwan  <dougkwan@google.com>
6304
6305         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6306         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6307         types to avoid warnings due to different uint64_t implementations
6308         on different hosts.
6309
6310 2010-02-21  Doug Kwan  <dougkwan@google.com>
6311
6312         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6313         handling of the maximum backward branch offset.
6314         (Arm_relocate_functions::thumb_branch_common): Ditto.
6315         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6316         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6317         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6318         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6319         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6320         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6321         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6322         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6323         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6324         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6325         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6326         thumb2_bl_out_of_range.o): New rules.
6327         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6328         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6329         thumb2_bl_out_of_range
6330         * testsuite/Makefile.in: Regenerate.
6331         * testsuite/arm_bl_in_range.s: New file.
6332         * testsuite/arm_bl_out_of_range.s: Ditto.
6333         * testsuite/arm_branch_in_range.sh: Ditto.
6334         * testsuite/arm_branch_range.t: Ditto.
6335         * testsuite/thumb2_branch_range.t: Ditto.
6336         * testsuite/thumb_bl_in_range.s: Ditto.
6337         * testsuite/thumb_bl_out_of_range.s: Ditto.
6338         * testsuite/thumb_branch_range.t: Ditto.
6339
6340 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6341
6342         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6343         Add reloc offset information.
6344         * icf.cc (get_section_contents): Change iterators to point to the new
6345         vectors. Add reloc offset information to the contents.
6346         * icf.h (Icf::Sections_reachable_info): New typedef.
6347         (Icf::Sections_reachable_list): New typedef.
6348         (Icf::Offset_info): New typedef.
6349         (Icf::Reloc_info): New struct typedef.
6350         (Icf::Reloc_info_list): New typedef.
6351         (Icf::symbol_reloc_list): Delete method.
6352         (Icf::addend_reloc_list): Delete method.
6353         (Icf::section_reloc_list): Delete method.
6354         (Icf::reloc_info_list): New method.
6355         (Icf::reloc_info_list_): New member.
6356
6357 2010-02-19  Doug Kwan  <dougkwan@google.com>
6358
6359         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6360         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6361         * arm.cc (Arm_relocation_functions): New forward declaration.
6362         (Target_arm::Target_arm): Initialize new data members
6363         got_mod_index_offset_ and tls_base_symbol_defined_.
6364         (Target_arm::Relocate::relocate_tls): New method.
6365         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6366          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6367         New methods.
6368         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6369         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6370         (Target_arm::got_mod_index_offset_,
6371         Target_arm::tls_base_symbol_defined_): New data members.
6372         (Target_arm::Scan::local, Target::Scan::global,
6373         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6374         relocations.
6375
6376 2010-02-18  Doug Kwan  <dougkwan@google.com>
6377
6378         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6379         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6380         text section as a parameter becuase some broken tools may not set
6381         the link in section header.
6382         (Target_arm::has_got_section): New method.
6383         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6384         without any mapping symbol as data only.  Remove warning.
6385         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6386         link in its section header, try to discover the link by inspecting the
6387         REL31 relocation at the beginning of the section.
6388         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6389         in error message.
6390         (Target_arm::Scan::global): Treat any reference to the symbol
6391         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6392
6393 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6394
6395         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6396         (Scan::global_reloc_may_be_function_pointer): New function.
6397         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6398         (Scan::global_reloc_may_be_function_pointer): New function.
6399         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6400         (Scan::global_reloc_may_be_function_pointer): New function.
6401         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6402         (Scan::global_reloc_may_be_function_pointer): New function.
6403         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6404         (Scan::global_reloc_may_be_function_pointer): New function.
6405         (Scan::possible_function_pointer_reloc): New function.
6406         (Target_x86_64::can_check_for_function_pointers): New function.
6407         * gc.h (gc_process_relocs): Scan relocation types to determine if
6408         function pointers were taken for targets that support it.
6409         * icf.cc (Icf::find_identical_sections): Include functions for
6410         folding in safe ICF whose pointer is not taken.
6411         * icf.h (Secn_fptr_taken_set): New typedef.
6412         (fptr_section_id_): New member.
6413         (section_has_function_pointers): New function.
6414         (set_section_has_function_pointers): New function.
6415         (check_section_for_function_pointers): New function.
6416         * options.h: Fix comment for safe ICF option.
6417         * target.h (can_check_for_function_pointers): New function.
6418         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6419         Modify icf_safe_test for X86-64.
6420         * testsuite/Makefile.in: Regenerate.
6421         * testsuite/icf_safe_so_test.cc: New file.
6422         * testsuite/icf_safe_so_test.sh: New file.
6423         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6424         (main): Change to take pointer to function kept_func_3.
6425         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6426         folding is done correctly for X86-64.
6427
6428 2010-02-12  David S. Miller  <davem@davemloft.net>
6429
6430         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6431         is_symbolless parameter.
6432         (Output_reloc<SHT_REL>::is_symbolless): New.
6433         (Output_reloc<SHT_REL>::is_symbolless_): New.
6434         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6435         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6436         (Output_reloc<SHT_RELA>::is_symbolless): New.
6437         (Output_data_reloc::add_global): Handle is_symbolless.
6438         (Output_data_reloc::add_global_relative): Likewise.
6439         (Output_data_reloc::add_local): Likewise.
6440         (Output_data_reloc::add_local_relative): Likewise.
6441         (Output_data_reloc::add_symbolless_global_addend): New.
6442         (Output_data_reloc::add_symbolless_local_addend): New.
6443         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6444         is_symbolless.
6445         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6446         instead of ->is_relative_
6447         (Output_reloc::write): Likewise.
6448         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6449         (Output_reloc::write_rel): Simplify.
6450
6451         * sparc.cc (Target_sparc::Scan::local): Use
6452         ->add_symbolless_local_addend as needed.
6453         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6454         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6455         based upon relocation offset.
6456
6457 2010-02-11  Doug Kwan  <dougkwan@google.com>
6458
6459         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6460         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6461         beginning of function.
6462         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6463         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6464         parameter is_32bit in calls to should_apply_static_reloc.
6465         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6466         (check_DATA): Add arm_abs_global.stdout.
6467         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6468         arm_abs_global.stdout): New rules.
6469         (MOSTLLYCLEANFILES): Add arm_abs_global
6470         * Makefile.in: Regenerate.
6471         * testsuite/arm_abs_global.s: New file.
6472         * testsuite/arm_abs_global.sh: Ditto.
6473         * testsuite/arm_abs_lib.s: Ditto.
6474
6475 2010-02-11  Ian Lance Taylor  <iant@google.com>
6476
6477         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6478         Read_relocs task.
6479         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6480         Allocate_commons_task first.
6481         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6482         task, rather than symtab_lock_.
6483         (Gc_process_relocs::~Gc_process_relocs): New function.
6484         (Gc_process_relocs::is_runnable): Check this_blocker_.
6485         (Gc_process_relocs::locks): Use next_blocker_ rather than
6486         blocker_.
6487         (Scan_relocs::~Scan_relocs): New function.
6488         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6489         symtab_lock_.
6490         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6491         next_blocker_.
6492         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6493         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6494         constructor accordingly.
6495         (class Gc_process_relocs): Likewise.
6496         (class Scan_relocs): Likewise.
6497         * common.h (class Allocate_commons_task): Remove symtab_lock_
6498         field, and corresponding constructor parameter.
6499         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6500         symtab_lock_.
6501         (Allocate_commons_task::locks): Likewise.
6502
6503 2010-02-11  Ian Lance Taylor  <iant@google.com>
6504
6505         * gold-threads.h (class Once): Define.
6506         (class Initialize_lock): Rewrite as child of Once.
6507         * gold-threads.cc (class Once_initialize): Define.
6508         (once_pointer_control): New static variable.
6509         (once_pointer, once_arg): New static variables.
6510         (c_run_once): New static function.
6511         (Once::Once, Once::run_once, Once::internal_run): New functions.
6512         (class Initialize_lock_once): Remove.
6513         (initialize_lock_control): Remove.
6514         (initialize_lock_pointer): Remove.
6515         (initialize_lock_once): Remove.
6516         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6517         (Initialize_lock::initialize): Rewrite.
6518         (Initialize_lock::do_run_once): New function.
6519         * archive.cc (Archive::interpret_header): Only clear name if it is
6520         not already empty.
6521         * fileread.cc: Include "gold-threads.h"
6522         (file_counts_lock): New static variable.
6523         (file_counts_initialize_lock): Likewise.
6524         (File_read::release): Only increment counts when using --stats.
6525         Use a lock around the increment.
6526         * parameters.cc (class Set_parameters_target_once): Define.
6527         (set_parameters_target_once): New static variable.
6528         (Parameters::Parameters): Move here from parameters.h.
6529         (Parameters::set_target): Rewrite.
6530         (Parameters::set_target_once): New function.
6531         (Parameters::clear_target): Move here and rewrite.
6532         * parameters.h (class Parameters): Update declarations.  Add
6533         set_parameters_target_once_ field.
6534         (Parameters::Parameters): Move to parameters.cc.
6535         (Parameters::clear_target): Likewise.
6536         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6537         task.
6538         (Start_group::~Start_group): New function.
6539         (Start_group::is_runnable): New function.
6540         (Start_group::locks, Start_group::run): New functions.
6541         (Finish_group::run): Change saw_undefined to size_t.
6542         * readsyms.h (class Start_group): Define.
6543         (class Finish_group): Change saw_undefined_ field to size_t.
6544         (Finish_group::Finish_group): Remove saw_undefined and
6545         this_blocker parameters.  Change all callers.
6546         (Finish_group::set_saw_undefined): New function.
6547         (Finish_group::set_blocker): New function.
6548         * symtab.h (class Symbol_table): Change saw_undefined to return
6549         size_t.  Change saw_undefined_ field to size_t.
6550         * target-select.cc (Set_target_once::do_run_once): New function.
6551         (Target_selector::Target_selector): Initialize set_target_once_
6552         field.  Don't initialize lock_ and initialize_lock_ fields.
6553         (Target_selector::instantiate_target): Rewrite.
6554         (Target_selector::set_target): New function.
6555         * target-select.h (class Set_target_once): Define.
6556         (class Target_selector): Update declarations.  Make
6557         Set_target_once a friend.  Remove lock_ and initialize_lock_
6558         fields.  Add set_target_once_ field.
6559
6560 2010-02-10  Ian Lance Taylor  <iant@google.com>
6561
6562         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6563         queueing any tasks.
6564         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6565         (queue_middle_tasks): Add all blockers before queueing any tasks.
6566         (queue_final_tasks): Likewise.
6567         * token.h (Task_token::add_blockers): New function.
6568         * object.h (Input_objects::number_of_relobjs): New function.
6569
6570 2010-02-10  Ian Lance Taylor  <iant@google.com>
6571
6572         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6573         shared, not if not position independent.
6574         * x86_64.cc (Relocate::relocate_tls): Likewise.
6575         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6576         (tls_pie_pic_test): New target.
6577         * testsuite/Makefile.in: Rebuild.
6578
6579         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6580         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6581         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6582         * testsuite/Makefile.in: Rebuild.
6583
6584 2010-02-09  David S. Miller  <davem@davemloft.net>
6585
6586         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6587         R_SPARC_RELATIVE using ->add_local_relative().
6588         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6589
6590         * output.h (Output_data_dynamic::add_section_size): New method
6591         that takes two Output_data objects.
6592         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6593         entry param.  Handle it in initializers.
6594         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6595         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6596         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6597         arg.
6598         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6599         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6600         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6601         for dynrel_includes_plt.
6602         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6603         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6604         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6605         before .rela.plt
6606         (Target_sparc::do_finalize_sections): Update to pass true for
6607         dynrel_includes_plt.
6608         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6609         output before .rela.plt
6610         (Target_powerpc::do_finalize_sections): Update to pass true for
6611         dynrel_includes_plt when 32-bit.
6612
6613 2010-02-08  Doug Kwan  <dougkwan@google.com>
6614
6615         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6616         method.
6617         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6618         Arm_relobj::scan_section_for_cortex_a8_stubs,
6619         Arm_relobj::do_relocation_section): Instead of calling
6620         Output_section::output_address, use faster
6621         Arm_relobj::simple_input_section_output_address.
6622
6623 2010-02-08  David S. Miller  <davem@davemloft.net>
6624
6625         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6626         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6627         relocation helper function.
6628
6629         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6630         just like R_SPARC_GOT{10,13,22}.
6631         (Target_sparc::Scan::local): Likewise.
6632         (Target_sparc::Relocate:relocate): Likewise.
6633
6634 2010-02-06  Ian Lance Taylor  <iant@google.com>
6635
6636         * configure.ac: Rewrite targetobjs duplicate removal code to use
6637         only shell constructs.
6638         * configure: Rebuild.
6639
6640 2010-02-05  Doug Kwan  <dougkwan@google.com>
6641
6642         PR 11247
6643         * arm.cc (Arm_relobj::section_is_scannable): New method.
6644         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6645         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6646
6647 2010-02-04  Doug Kwan  <dougkwan@google.com>
6648
6649         PR 11247
6650         * arm-reloc-property.cc (cstdio): Include.
6651         * configure.ac (targetobjs): Remove duplicates.
6652         * configure: Regenerate.
6653         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6654         big and little endian version for a given address size.
6655
6656 2010-02-03  Doug Kwan  <dougkwan@google.com>
6657
6658         * arm-reloc-property.cc
6659         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6660         definition.
6661         * arm-reloc-property.h
6662         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6663         New method definition.
6664         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6665         declaration.
6666         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6667         overflow to N.
6668         (GOT_PREL): Change implemented to Y.
6669         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6670         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6671         (Arm_relocate_functions::movw_abs_nc): Remove method.
6672         (Arm_relocate_functions::movt_abs): Ditto.
6673         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6674         (Arm_relocate_functions::thm_movt_abs): Ditto.
6675         (Arm_relocate_functions::movw_rel_nc): Ditto.
6676         (Arm_relocate_functions::movw_rel): Ditto.
6677         (Arm_relocate_functions::movt_rel): Ditto.
6678         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6679         (Arm_relocate_functions:thm_movw_rel): Ditto.
6680         (Arm_relocate_functions:thm_movt_rel): Ditto.
6681         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6682         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6683         New method definitions.
6684         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6685         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6686         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6687         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6688         (Target_arm::Relocate::relocate): Check for non-static or
6689         unimplemented relocation code and exit early.  Change calls to
6690         Target_arm::reloc_uses_thumb_bit and
6691         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6692         instead.  Refactor code to handle similar relocations to increase
6693         code sharing.  Remove check for unsupported relocation code in switch
6694         statement.
6695         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6696         relocation property table to find out size.  Change error message to
6697         print out the name of a relocation code instead of the numeric value.
6698         (Target_arm::scan_reloc_for_stub): Use relocation property table
6699         instead of calling Target_arm::reloc_uses_thumb_bit().
6700
6701 2010-02-02  Doug Kwan  <dougkwan@google.com>
6702
6703         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6704         types of relaxed input section.
6705
6706 2010-02-02  Doug Kwan  <dougkwan@google.com>
6707
6708         * Makefile.am (HFILES): Add arm-reloc-property.h.
6709         (DEFFILES): New.
6710         (TARGETSOURCES): Add arm-reloc-property.cc
6711         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6712         (libgold_a_SOURCES): $(DEFFILES)
6713         * Makefile.in: Regenerate.
6714         * arm-reloc-property.cc: New file.
6715         * arm-reloc-property.h: New file.
6716         * arm-reloc.def: New file.
6717         * arm.cc: Update comments.
6718         (arm-reloc-property.h): New included header.
6719         (arm_reloc_property_table): New global variable.
6720         (Target_arm::do_select_as_default_target): New method definition.
6721         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6722         arm-reloc-property to targ_extra_obj.
6723         * parameters.cc (set_parameters_target): Call
6724         Target::select_as_default_target().
6725         * target.h (Target::select_as_default_target): New method definition.
6726         (Target::do_select_as_default_target): Same.
6727
6728 2010-02-01  Doug Kwan  <dougkwan@google.com>
6729
6730         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6731         first_output_text_section_.
6732         (Arm_exidx_fixup::first_output_text_section): New method definition.
6733         (Arm_exidx_fixup::first_output_text_section_): New data member.
6734         (Arm_exidx_fixup::process_exidx_section): Record the first text
6735         output section seen.
6736         (Arm_output_section::fix_exidx_coverage): Set correct linked section
6737         and entsize in output section header.
6738
6739 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6740
6741         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
6742         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
6743         (Arm_relocate_functions::thm_alu11): New Method.
6744         (Arm_relocate_functions::thm_pc8): New Method.
6745         (Arm_relocate_functions::thm_pc12): New Method.
6746         (Target_arm::Scan::local): Handle the relocations.
6747         (Target_arm::Scan::global): Likewise.
6748         (Target_arm::Relocate::relocate): Likewise.
6749         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
6750
6751 2010-01-29  Doug Kwan  <dougkwan@google.com>
6752
6753         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
6754         of relocation types as ld.
6755
6756 2010-01-29  Doug Kwan  <dougkwan@google.com>
6757
6758         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
6759         to public.
6760         (Arm_relocate_functions::thumb_branch_common): Ditto.
6761         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
6762         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
6763         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
6764         Arm_relocate_functions::jump24): Remove.
6765         (Target_arm::Relocate::relocate): Adjust code to call
6766         Arm_relocation_functions::arm_branch_common and
6767         Arm_relocation_functions::thumb_branch_common instead of their removed
6768         wrappers.  Merge switch-cases together to reduce source code size.
6769
6770 2010-01-29  Doug Kwan  <dougkwan@google.com>
6771
6772         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
6773         output_local_symbol_count_needs_update_.
6774         (Arm_relobj::output_local_symbol_count_needs_update,
6775          Arm_relobj::set_output_local_symbol_count_needs_update,
6776          Arm_relobj::update_output_local_symbol_count): New methods.
6777         (Arm_relobj::output_local_symbol_count_needs_update_): New data
6778         member.
6779         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
6780         of pointed function as in a R_ARM_PREL31 relocation.
6781         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
6782         for output local symbol count updating.
6783         (Target_arm::do_relax): Update output local symbol counts in objects
6784         if necessary.
6785         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
6786
6787 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6788
6789         * arm.cc: Added support for the ARM relocations:
6790         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
6791         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
6792         (Arm_relocate_functions::movw_rel_nc): Renamed (was
6793         movw_prel_nc).
6794         (Arm_relocate_functions::movw_rel): New method.
6795         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
6796         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
6797         thm_movw_prel_nc).
6798         (Arm_relocate_functions::thm_movw_rel): New method.
6799         (Arm_relocate_functions::thm_movt_rel): Renamed (was
6800         thm_movt_prel).
6801         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
6802         relocations.
6803         (Target_arm::Scan::global): Likewise.
6804         (Target_arm::Relocate::relocate): Likewise.
6805         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6806         Likewise.
6807
6808 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6809
6810         * arm.cc: Added support for ARM group relocations.
6811         (Target_arm::reloc_needs_sym_origin): New method.
6812         (Arm_relocate_functions::calc_grp_kn): New method.
6813         (Arm_relocate_functions::calc_grp_residual): New method.
6814         (Arm_relocate_functions::calc_grp_gn): New method.
6815         (Arm_relocate_functions::arm_grp_alu): New Method.
6816         (Arm_relocate_functions::arm_grp_ldr): New Method.
6817         (Arm_relocate_functions::arm_grp_ldrs): New Method.
6818         (Arm_relocate_functions::arm_grp_ldc): New Method.
6819         (Target_arm::Scan::local): Handle the ARM group relocations.
6820         (Target_arm::Scan::global): Likewise.
6821         (Target_arm::Relocate::relocate): Likewise.
6822         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6823         Likewise.
6824
6825 2010-01-26  Doug Kwan  <dougkwan@google.com>
6826
6827         * arm.cc (set): Include.
6828         (class Arm_exidx_fixup): Change type of last_input_section_ to const
6829         pointer type.
6830         (Arm_output_section::Text_section_list): New type.
6831         (Arm_output_section::append_text_sections_to_list): New method.
6832         (Arm_output_section::fix_exidx_coverage): Ditto.
6833         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
6834         (Arm_relobj::convert_input_section_to_relaxed_section): Use
6835         Relobj::set_section_offset() instead of
6836         Sized_relobj::invalidate_section_offset().
6837         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
6838         parameter for section headers. Ignore relocation sections for
6839         unallocated sections and EXIDX sections.
6840         (Target_arm::fix_exidx_coverage): New method.
6841         (Target_arm::output_section_address_less_than): New type.
6842         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
6843         linked text section instead of the EXIDX section.
6844         (Arm_output_section::create_stub_group): Add an assertion to check
6845         that this is not an EXIDX output section.
6846         (Arm_output_section::append_text_sections_to_list): New method.
6847         (Arm_output_section::fix_exidx_coverage): Ditto.
6848         (Arm_relobj::scan_sections_for_stubs): Adjust call to
6849         Arm_relobj::section_needs_reloc_stub_scanning.
6850         (Target_arm::do_relax): Fix EXIDX output section coverage in the
6851         first pass.
6852         (Target_arm::fix_exidx_coverage): New method.
6853         * object.h (Relobj::set_output_section): New method.
6854         (Sized_relobj::invalidate_section_offset): Remove method.
6855         (Sized_relobj::do_invalidate_section_offset): Remove method.
6856         (Sized_relobj::do_set_section_offset): Handle offset value -1.
6857
6858 2010-01-25  Doug Kwan  <dougkwan@google.com>
6859
6860         * arm.cc (Arm_exidx_merged_section::do_output_offset):
6861         Fix warning due to signed and unsigned comparison on a 32-bit host.
6862
6863 2010-01-22  Doug Kwan  <dougkwan@google.com>
6864
6865         * arm.cc (Target_arm::do_relax): Record an output section for section
6866         offset adjustment it contains any stub table that has changed.
6867         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
6868         offsets in an output section if necessary.
6869         * output.cc (Output_section::Output_section): Initialize
6870         section_offsets_need_adjustments_.
6871         (Output_section::add_input_section_for_script): Renamed to
6872         Output_section::add_simple_input_section.
6873         (Output_section::save_states): Add a comment.
6874         (Output_section::discard_states): New method defintion.
6875         (Output_section::adjust_section_offsets): Same.
6876         * output.h (Output_section::add_input_section_for_script): Renamed to
6877         Output_section::add_simple_input_section.
6878         (Output_section::discard_states): New method declaration.
6879         (Output_section::adjust_section_offsets): Same.
6880         (Output_section::section_offsets_need_adjustment,
6881         Output_section::set_section_offsets_need_adjustment): New method
6882         definitions.
6883         (Output_section::section_offsets_need_adjustment_): New data member.
6884         * script-sections.cc
6885         (Output_section_element_input::set_section_address): Adjust code for
6886         renaming of Output_section::add_input_section_for_script.
6887         (Orphan_output_section::set_section_address): Same.
6888
6889 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6890
6891         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
6892         Fix_v4bx enum values .
6893         * gold/options.h (General_options): New option definitions.
6894         (General_options::fix_v4bx): New method.
6895         (General_options::Fix_v4bx): New enum.
6896         * gold/options.cc (General_options::parse_fix_v4bx): New method.
6897         (General_options::parse_fix_v4bx_interworking): New method.
6898
6899 2010-01-22  Doug Kwan  <dougkwan@google.com>
6900
6901         * arm.cc (Arm_exidx_fixup): New class.
6902
6903 2010-01-21  Doug Kwan  <dougkwan@google.com>
6904
6905         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
6906         classes.
6907         (Arm_exidx_section_offset_map): New type.
6908
6909 2010-01-21  Doug Kwan  <dougkwan@google.com>
6910
6911         * arm.cc (Arm_exidx_input_section): New class.
6912         (Arm_relobj::exidx_input_section_by_link,
6913         Arm_relobj::exidx_input_section_by_shndx,
6914         Arm_relobj::make_exidx_input_section): New methods.
6915         (read_arm_attributes_section): Remove.
6916         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
6917         information about them.
6918         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
6919         to here.
6920
6921 2010-01-20  Doug Kwan  <dougkwan@google.com>
6922
6923         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
6924         Input_section_specifier to Section_id.
6925         (Target_arm::new_arm_input_section: Adjust code for change of key
6926         type.
6927         (Target_arm::find_arm_input_section): Ditto.
6928         * gc.h (object.h): Include for Section_id nand Section_id_hash.
6929         (Section_id): Remove.
6930         (Garbage_collection::Section_id_hash): Remove.
6931         * icf.h (object.h): Include for Section_id nand Section_id_hash.
6932         (Section_id): Remove.
6933         (Icf::Section_id_hash): Remove.
6934         * object.h (Section_id, Const_section_id, Section_id_hash,
6935         Const_section_id_hash): New type definitions.
6936         * output.cc (Output_section::add_relaxed_input_section): Change to
6937         use Const_section_id instead of Input_section_specifier as key type.
6938         (Output_section::add_merge_input_section): Ditto.
6939         (Output_section::build_relaxation_map): Change to use Section_id
6940         instead of Input_section_specifier as key type.
6941         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6942         Ditto.
6943         (Output_section::convert_input_sections_to_relaxed_sections): Change
6944         to use Const_section_id instead of Input_section_specifier as key type.
6945         (Output_section::find_merge_section): Ditto.
6946         (Output_section::find_relaxed_input_section): Ditto.
6947         * output.h (Input_section_specifier): Remove class.
6948         (Output_section::Output_section_data_by_input_section_map): Change
6949         key type to Const_section_id.
6950         (Output_section::Output_relaxed_input_section_by_input_section_map):
6951         Ditto.
6952         (Output_section::Relaxation_map): Change key type to Section_id.
6953
6954 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6955
6956         * gold/arm.cc: Added support for R_ARM_V4BX relocation
6957         (class Arm_v4bx_stub): New class.
6958         (DEF_STUBS): Updated definition to support v4_veneer_bx.
6959         (Stub_factory::make_arm_v4bx_stub): New method.
6960         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
6961         (Stub_table::empty): Handle v4bx stubs.
6962         (Stub_table::add_arm_v4bx_stub): New method.
6963         (Stub_table::find_arm_v4bx_stub): New method.
6964         (Arm_relocate_functions::v4bx): New method.
6965         (Target_arm::fix_v4bx): New method.
6966         (Target_arm::Target_arm): Handle R_ARM_V4BX.
6967         (Stub_table::relocate_stubs): Likewise.
6968         (Stub_table::do_write): Likewise.
6969         (Stub_table::update_data_size_and_addralign): Likewise.
6970         (Stub_table::finalize_stubs):  Likewise.
6971         (Target_arm::Scan::local): Likewise.
6972         (Target_arm::Scan::global): Likewise.
6973         (Target_arm::do_finalize_sections): Likewise.
6974         (Target_arm::Relocate::relocate): Likewise.
6975         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6976         Likewise.
6977         (Target_arm::scan_reloc_for_stub): Likewise.
6978         (Target_arm::scan_reloc_section_for_stubs): Likewise.
6979
6980 2010-01-19  Ian Lance Taylor  <iant@google.com>
6981
6982         * output.cc (Output_section_headers::do_sized_write): Write large
6983         segment count to sh_info field.
6984         (Output_file_header::do_sized_write): For large segment count,
6985         write PN_XNUM to e_phnum field.
6986
6987 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6988
6989         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
6990         (Arm_relocate_functions::thm_jump8): New function.
6991         (Arm_relocate_functions::thm_jump11): New function.
6992         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
6993         R_ARM_THM_JUMP11.
6994         (Target_arm::Scan::global): Likewise.
6995         (Target_arm::Relocate::relocate): Likewise.
6996         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
6997         Likewise.
6998
6999 2010-01-14  Doug Kwan  <dougkwan@google.com>
7000
7001         * arm.cc (map, utility): Include headers.
7002         (Target_arm::apply_cortex_a8_workaround): New method.
7003         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7004         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7005         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7006         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7007         the --[no-]fix-cortex-a8 command line options.
7008         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7009         (Target_arm::relocate_stub): Use addend in instruction template.
7010         * options.h (DEFINE_bool): Set the user-set flag.
7011         (General_options): Add --[no-]-fix-cortex options.
7012         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7013         : Update fast look-up map after conversion.
7014
7015 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7016
7017         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7018         in the first pass of do_layout.
7019
7020 2010-01-13  Doug Kwan  <dougkwan@google.com>
7021
7022         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7023         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7024         apparent compiler problem of not folding static constant integral
7025         data members of elfcpp::Elf_sizes<32>.
7026
7027 2010-01-13  Doug Kwan  <dougkwan@google.com>
7028
7029         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7030         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7031         Arm_relobj::scan_section_for_cortex_a8_erratum,
7032         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7033         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7034         sections to scan for relocation stubs into a new method
7035         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7036         relocation and Cortex-A8 stub scanning.
7037         (Target_arm::do_relax): Force stubs to be after stubbed sections
7038         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7039         the beginning of a new relaxation pass.  Update a comment.
7040         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7041
7042 2010-01-12  Ian Lance Taylor  <iant@google.com>
7043
7044         * target-reloc.h (visibility_error): New inline function.
7045         (relocate_section): Call visibility_error.
7046         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7047         (MOSTLYCLEANFILES): Likewise.
7048         (protected_4_pic.o, protected_3.err): New targets.
7049         * testsuite/protected_4.cc: New file.
7050
7051 2010-01-12  Doug Kwan  <dougkwan@google.com>
7052
7053         * arm.cc (Cortex_a8_reloc): New class.
7054         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7055         and cortex_a8_relocs_info_.
7056         (Target_arm::fix_cortex_a8): New method definition.
7057         (Target_arm::Cortex_a8_relocs_info): New type.
7058         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7059         New data member declarations.
7060         (Target_arm::scan_reloc_for_stub): Record information about
7061         relocations for THUMB branches that might be exempted from the
7062         Cortex-A8 workaround.
7063         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7064         at the beginning of a relaxation pass.
7065
7066 2010-01-12  Doug Kwan  <dougkwan@google.com>
7067
7068         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7069         (Arm_relobj::Mapping_symbol_position,
7070          Arm_reloj::Mapping_symbol_position_less,
7071          Arm_relobj::Mapping_symbols_info): New types.
7072         (Target_arm::is_mapping_symbol_name): New method definition.
7073         (Arm_relobj::do_count_local_symbols): Save information about mapping
7074         symbols.
7075
7076 2010-01-11  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7079         Arm_relocate_functions::thumb32_branch_upper,
7080         Arm_relocate_functions::thumb32_branch_lower,
7081         Arm_relocate_functions::thumb32_cond_branch_offset,
7082         Arm_relocate_functions::thumb32_cond_branch_upper,
7083         Arm_relocate_functions::thumb32_cond_branch_lower,
7084         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7085         branch offset encoding.
7086         (Arm_relocate_functions::thumb_branch_common): Use new branch
7087         offset encoding methods to avoid code duplication.
7088         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7089         (Stub_addend_reader::operator()): Use new branch encoding method
7090         to avoid code duplication.
7091
7092 2010-01-11  Doug Kwan  <dougkwan@google.com>
7093
7094         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7095         (Target_arm::do_finalize_sections): Define special EXIDX section
7096         symbols only if referenced.
7097         * gc.h (Garbage_collection::add_reference): New method.
7098         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7099         code duplication.
7100
7101 2010-01-11  Ian Lance Taylor  <iant@google.com>
7102
7103         * script.cc (Version_script_info::build_expression_list_lookup):
7104         Change complaing about duplicate wildcard match from error to
7105         warning.
7106
7107         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7108         of 2009-12-30.
7109         (Version_script_info::Version_script_info): Initialize globs_,
7110         default_version_, default_is_global_, and exact_.  Don't
7111         initialize globals_ or locals_.
7112         (Version_script_info::build_lookup_tables): Build local symbols
7113         first.
7114         (Version_script_info::unquote): New function.
7115         (Version_script_info::add_exact_match): New function.
7116         (Version_script_info::build_expression_list_lookup): Remove lookup
7117         parameter.  Add is_global parameter.  Change all callers.  Handle
7118         wildcard pattern specially.  Unquote pattern.  Call
7119         add_exact_match.
7120         (Version_script_info::get_name_to_match): New function.
7121         (Version_script_info::get_symbol_version): New function.
7122         (Version_script_info::get_symbol_version_helper): Remove.
7123         (Version_script_info::check_unmatched_names): Call unquote.
7124         * script.h (class Version_script_info): Change get_symbol_version
7125         to be non-inline and add is_global parameter; change all callers.
7126         Rewrite symbol_is_local.  Update declarations.  Define struct
7127         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7128         Remove globals_ and locals_ members.  Add exact_, globs_,
7129         default_version_, is_global_.
7130         (Version_script_info::Glob): Remove pattern, add expression and
7131         is_global.  Update constructor.  Change all callers.
7132         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7133         default version.
7134         (Versions::symbol_section_contents): If a symbol is undefined, or
7135         defined in a dynamic object, set the version index to
7136         VER_NDX_LOCAL.
7137         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7138         symbol_is_local.
7139         (Symbol_table::add_from_pluginobj): Likewise.
7140         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7141
7142 2010-01-11  Doug Kwan  <dougkwan@google.com>
7143
7144         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7145         (incremental_dump_LDADD): Add linking option for libintl.
7146         * Makefile.in: Regenerate.
7147
7148 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7149
7150         PR gold/11144
7151         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7152         instead of -Ds.
7153         * testsuite/Makefile.in: Regenerated.
7154
7155 2010-01-10  Doug Kwan  <dougkwan@google.com>
7156
7157         * options.h (DEFINE_var): Use parentheses around argument varname__
7158         in macro body to avoid any unintended subsequent substitutions.
7159
7160 2010-01-10  Ian Lance Taylor  <iant@google.com>
7161
7162         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7163         candidates before doing symbol resolution.
7164
7165         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7166         ODR candidates if only one is weak.
7167
7168 2010-01-08  Ian Lance Taylor  <iant@google.com>
7169
7170         * script.cc (Version_script_info::build_expression_list_lookup):
7171         Don't warn about ambiguous version, just record the ambiguity.
7172         (Version_script_info::get_symbol_version_helper): Give error if
7173         version is ambiguous.
7174
7175 2010-01-08  Doug Kwan  <dougkwan@google.com>
7176
7177         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7178           prev_data_size_ and prev_addralign_.  Remove initializer for
7179           deleted data member has_been_changed_.
7180           (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7181           to determine if the table is empty.
7182           (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7183           Remove.
7184           (Stub_table::add_reloc_stub): Define method in class definition
7185           instead of just declaring it there.
7186           (Stub_table::add_cortex_a8_stub): New method definition.
7187           (Stub_table::update_data_size_and_addralign): Ditto.
7188           (Stub_table::finalize_stubs): Ditto.
7189           (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7190           (Stub_table::do_addralign_): Return address alignment in the
7191           (Stub_table::do_reset_address_and_file_offset): Define method in
7192           class definition instead of declaring it there.  Set current data
7193           size to be the data size of the previous pass.
7194           (Stub_table::set_final_data_size): Use current data size as the
7195           final data size.
7196           (Stub_table::relocate_stub): Change parameter type of stub from
7197           Reloc_stub pointer to Stub pointer.
7198           (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7199           (Stub_table::Cortex_a8_stub_list): New typedef.
7200           (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7201            Stub_table::prev_addralign_): New data member.
7202           (Arm_relobj::Arm_relobj): Initialize data member
7203           section_has_cortex_a8_workaround_.
7204           (Arm_relobj::section_has_cortex_a8_workaround,
7205            Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7206            definitions.
7207           (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7208           declarations.
7209           (Target_arm::relocate_stub): Change parameter type of stub from
7210           Reloc_stub pointer to Stub pointer.
7211           (Insn_template::size, Insn_template::alignment): Handle
7212           THUMB16_SPECIAL_TYPE.
7213           (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7214            Stub_table::update_data_size_and_addralign,
7215            Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7216           definitions.
7217           (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7218           (Stub_table::do_write): Ditto.
7219           (Target_arm::do_relax): Adjust code for changes in Stub_table.
7220
7221 2010-01-08  Ian Lance Taylor  <iant@google.com>
7222
7223         PR 11108
7224         * symtab.h (class Symbol): Remove fields is_target_special_ and
7225         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7226         (Symbol::is_defined_in_discarded_section): New function.
7227         (Symbol::set_is_defined_in_discarded_section): New function.
7228         (Symbol::has_plt_offset): Rewrite.
7229         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7230         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7231         Don't initialize is_target_special_ or has_plt_offset_.
7232         Initialize is_defined_in_discarded_section_.
7233         (Symbol_table::add_from_relobj): If appropriate, set
7234         is_defined_in_discarded_section.
7235         * resolve.cc (Symbol::override_base_with_special): Don't test
7236         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7237         * target-reloc.h (relocate_section): Do special handling for
7238         symbols defined in discarded sections for global symbols as well
7239         as local symbols.
7240
7241 2010-01-08  Ian Lance Taylor  <iant@google.com>
7242
7243         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7244         the SHT_SYMTAB case.
7245
7246 2010-01-08  Ian Lance Taylor  <iant@google.com>
7247
7248         * object.cc (Sized_relobj::do_layout): Don't get confused if
7249         layout_eh_frame returns NULL.
7250
7251 2010-01-08  Ian Lance Taylor  <iant@google.com>
7252
7253         PR 11084
7254         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7255         dynamic symbol table, use the normal symbol table.
7256         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7257         symbol table.
7258
7259 2010-01-08  Ian Lance Taylor  <iant@google.com>
7260
7261         PR 11072
7262         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7263         sections.
7264
7265 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7266
7267         * version.cc (print_version): Change to "Copyright 2010".
7268
7269 2010-01-08  Ian Lance Taylor  <iant@google.com>
7270
7271         PR 10287
7272         PR 11063
7273         * i386.cc (class Target_i386): Change return type of plt_section
7274         to be non-const.
7275         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7276         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7277         tls_desc_rel_ field.
7278         (Output_data_plt_i386::rel_tls_desc): New function.
7279         (Target_i386::rel_tls_desc_section): New function.
7280         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7281         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7282         R_386_TLS_DESC reloc in rel_tls_desc_section.
7283         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7284         Define struct Tlsdesc_info.
7285         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7286         (Target_x86_64::do_reloc_symbol_index): New function.
7287         (Target_x86_64::add_tlsdesc_info): New function.
7288         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7289         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7290         tlsdesc_rel_ field.
7291         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7292         all callers.
7293         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7294         (Target_x86_64::rela_tlsdesc_section): New function.
7295         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7296         handling.
7297         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7298         (Target_x86_64::do_reloc_addend): New function.
7299         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7300         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7301         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7302         (Output_reloc::type): New function.
7303         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7304         (Output_reloc::is_target_specific): New function.
7305         (Output_reloc::target_arg): New function.
7306         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7307         absolute relocs and target specific relocs.
7308         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7309         add_target_specific.
7310         (class Output_data_reloc) [SHT_RELA]: Likewise.
7311         * output.cc (Output_reloc::Output_reloc): Add four new versions
7312         for absolute relocs and target specific relocs.
7313         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7314         (Output_reloc::get_symbol_index): Likewise.
7315         (Output_reloc::local_section_offset): Check that local_sym_index_
7316         is not TARGET_CODE or 0.
7317         (Output_reloc::symbol_value): Likewise.
7318         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7319         reloc.
7320         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7321         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7322         functions.
7323         * layout.cc (add_target_dynamic_tags): Use output section for
7324         DT_PLTRELSZ and DT_JMPREL.
7325
7326 2010-01-07  Ian Lance Taylor  <iant@google.com>
7327
7328         PR 11061
7329         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7330         function.
7331         (class Output_data_reloc_generic): Define.
7332         (class Output_data_reloc_base): Change base class to
7333         Output_data_reloc_generic.  Change add() method to call
7334         bump_relative_reloc_count for a relative reloc.  Remove
7335         sort_relocs_ field.
7336         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7337         to sort_relocs().
7338         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7339         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7340         appropriate.
7341         * layout.h (class Layout): Update declaration.
7342
7343 2010-01-07  Ian Lance Taylor  <iant@google.com>
7344
7345         * output.h (class Output_data): Add const version of
7346         output_section and do_output_section.
7347         (class Output_section_data): Add const version of
7348         do_output_section.
7349         (class Output_section): Likewise.
7350         * layout.cc (Layout::add_target_dynamic_tags): New function.
7351         * layout.h (class Layout): Update declarations.
7352         * arm.cc (Target_arm::do_finalize_sections): Use
7353         add_target_dynamic_tags.
7354         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7355         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7356         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7357         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7358
7359 2010-01-07  Ian Lance Taylor  <iant@google.com>
7360
7361         PR 11042
7362         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7363         object as needed.
7364
7365 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7366             Ian Lance Taylor  <iant@google.com>
7367
7368         PR 11019
7369         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7370         Xindex::read_symtab_xindex.
7371
7372 2010-01-07  Doug Kwan  <dougkwan@google.com>
7373
7374         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7375         (Insn_template::thumb16_bcond_insn): New method declaration.
7376         (Insn_template): Fix spelling.
7377         (Stub::thumb16_special): New method declaration.
7378         (Stub::do_write): Define virtual method which was previously pure
7379         virtual.
7380         (Stub::do_thumb16_special): New method declaration.
7381         (Stub::do_fixed_endian_write): New template member.
7382         (Reloc_stub::do_write): Remove.
7383         (Reloc_stub::do_fixed_endian_write): Remove.
7384         (Cortex_a8_stub): New class definition.
7385         (Stub_factory::make_cortex_a8_stub): New method definition.
7386         (Stub_factory::Stub_factory): Add missing static storage class
7387         qualifier for elf32_arm_stub_a8_veneer_blx.
7388
7389 2010-01-07  Ian Lance Taylor  <iant@google.com>
7390
7391         PR 10980
7392         * options.h (class General_options): Add --warn-unresolved-symbols
7393         and --error-unresolved-symbols.
7394         * errors.cc (Errors::undefined_symbol): Implement
7395         --warn-unresolved-symbols.
7396
7397         * options.h (class General_options): Add -z text and -z textoff.
7398         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7399
7400 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7401
7402         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7403         (Garbage_collection::cident_sections): New function.
7404         (Garbage_collection::add_cident_section): New function.
7405         (Garbage_collection::cident_sections_): New member.
7406         (gc_process_relocs): Add references to sections whose names are C
7407         identifiers.
7408         * gold.h (cident_section_start_prefix): New constant.
7409         (cident_section_stop_prefix): New constant.
7410         (is_cident): New function.
7411         * layout.cc (Layout::define_section_symbols): Replace string constants
7412         with the newly defined constants.
7413         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7414         C identifiers.
7415         * testsuite/Makefile.am: Add gc_orphan_section_test.
7416         * testsuite/Makefile.in: Regenerate.
7417         * testsuite/gc_orphan_section_test.cc: New file.
7418         * testsuite/gc_orphan_section_test.sh: New file.
7419
7420 2010-01-06  Ian Lance Taylor  <iant@google.com>
7421
7422         PR 10980
7423         * options.h (class General_options): Add --warn-shared-textrel.
7424         * layout.cc (Layout::finish_dynamic_section): Implement
7425         --warn-shared-textrel.
7426
7427         PR 10980
7428         * options.h (class General_options): Add --warn-multiple-gp.
7429
7430 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7431
7432         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7433         $(THREADSLIB) and $(LIBDL).
7434         * Makefile.in: Rebuild.
7435
7436 2010-01-06  Ian Lance Taylor  <iant@google.com>
7437
7438         PR 10980
7439         * options.cc (General_options::parse_section_start): New function.
7440         (General_options::section_start): New function.
7441         (General_options::General_options): Initialize all members.
7442         * options.h: Include <map>
7443         (class General_options): Add --section-start.  Add section_starts_
7444         member.
7445         * layout.cc (Layout::attach_allocated_section_to_segment): If
7446         --section-start was used, set the address of the segment.  Remove
7447         local sort_sections.
7448         (Layout::relaxation_loop_body): If the address of the load segment
7449         has been set by --section-start, don't use it.
7450         * output.h (Output_segment::update_flags_for_output_section): New
7451         function.
7452         * output.cc (Output_segment::add_output_section): Call
7453         update_flags_for_output_section.
7454
7455 2010-01-05  Ian Lance Taylor  <iant@google.com>
7456
7457         PR 10980
7458         * options.h (class General_options): Add --undefined-version.
7459         * script.cc (struct Version_expression): Add was_matched_by_symbol
7460         field.
7461         (Version_script_info::matched_symbol): New function.
7462         (Version_script_info::get_symbol_version_helper): Call
7463         matched_symbol.
7464         (Version_script_info::check_unmatched_names): New function.
7465         * script.h (class Version_script_info): Update declarations.
7466         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7467
7468         * options.h (class General_options): Use DEFINE_bool_alias for
7469         allow_multiple_definition.
7470         * resolve.cc (Symbol_table::should_override): Don't test
7471         allow_multiple_definition.
7472
7473         PR 10980
7474         * options.h (class General_options): Add --cref.
7475         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7476         until after printing cref table.
7477         * cref.cc: Include "symtab.h".
7478         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7479         (Cref_table_compare::operator()): New function.
7480         (Cref_inputs::gather_cref): New function.
7481         (filecol): New static const.
7482         (Cref_inputs::print_cref): New function.
7483         (Cref::print_cref): New function.
7484         * cref.h: Include <cstdio>.
7485         (class Cref): Update declarations.
7486         * mapfile.h (Mapfile::file): New function.
7487         * object.h (class Object): Define Symbols.  Declare virtual
7488         do_get_global_symbols.
7489         (Object::get_global_symbols): New function.
7490         * object.cc (Input_objects::add_object): Pass object to cref_ if
7491         --cref.
7492         (Input_objects::archive_start): Likewise.
7493         (Input_objects::archive_stop): Likewise.
7494         (Input_objects::print_cref): New function.
7495         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7496         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7497         --cref.
7498         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7499         function.
7500         * plugin.h (class Sized_pluginobj): Update declarations.
7501
7502 2010-01-05  Ian Lance Taylor  <iant@google.com>
7503
7504         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7505         to is_default_version.  Rename insdef to insdefault.
7506         (Symbol_table::add_from_relobj): Rename def to is_default_version
7507         and local to is_forced_local.
7508         (Symbol_table::add_from_pluginobj): Likewise.
7509         (Symbol_table::add_from_dynobj): Likewise.
7510         (Symbol_table::define_special_symbol): Rename insdef to
7511         insdefault.
7512
7513 2010-01-04  Ian Lance Taylor  <iant@google.com>
7514
7515         PR 10980
7516         * options.h (class General_options): Add
7517         --allow-multiple-definition and -z muldefs.
7518         * resolve.cc (Symbol_table::should_override): Don't warn about a
7519         multiple symbol definition if --allow-multiple-definition or -z
7520         muldefs.
7521
7522         PR 10980
7523         * options.h (class General_options): Add --add-needed and
7524         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7525         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7526         error if --copy-dt-needed-entries aka --add-needed is used and
7527         would cause a change in behaviour.
7528
7529         PR 10980
7530         * options.h (class General_options): Add -G as a short version of
7531         --shared.  Add no-op options -assert, -g, and -i.
7532
7533 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7534
7535         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7536         check for .text or .gnu.linkonce.t sections.
7537         * icf.cc (Icf::find_identical_sections): Ditto.
7538         Change the detection for mangled function name within the section
7539         name.
7540         * icf.h (is_section_foldable_candidate): New function.
7541
7542 2009-12-30  Ian Lance Taylor  <iant@google.com>
7543
7544         PR 10980
7545         * options.h (class General_options): Permit two dashes with
7546         --retain-symbols-file.
7547
7548 2009-12-30  Ian Lance Taylor  <iant@google.com>
7549
7550         PR 10979
7551         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7552         don't put the file header and segment headers in the text
7553         segment.
7554
7555         PR 10979
7556         * common.cc (Sort_commons::operator()): Stabilize sort when both
7557         entries are NULL.
7558         (Symbol_table::do_allocate_commons_list): When allocating common
7559         symbols, skip a symbol which is no longer common.
7560         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7561         an object before checking its type.
7562         * testsuite/common_test_2.c: New file.
7563         * testsuite/common_test_3.c: New file.
7564         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7565         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7566         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7567         (common_test_2_pic.o, common_test_2.so): New targets.
7568         (common_test_3_pic.o, common_test_3.so): New targets.
7569         * testsuite/Makefile.in: Rebuild.
7570
7571         PR 10979
7572         * script.cc (read_input_script): If we see a new SECTIONS clause,
7573         and we have added an input section, give an error.
7574         * layout.h (class Layout): Add have_added_input_section function.
7575         Add have_added_input_section_ field.
7576         * layout.cc (Layout::Layout): Initialize
7577         have_added_input_section_.
7578         (Layout::layout): Set have_added_input_section_.
7579         (Layout::layout_eh_frame): Likewise.
7580
7581 2009-12-30  Ian Lance Taylor  <iant@google.com>
7582
7583         PR 10931
7584         * options.h (class General_options): Add --sort-common option.
7585         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7586         * common.cc (Sort_common): Add sort_order parameter to
7587         constructor.  Add sort_order_ field.
7588         (Sort_commons::operator): Check sort_order_.
7589         (Symbol_table::allocate_commons): Determine the sort order.
7590         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7591         Change all callers.
7592         (Symbol_table::do_allocate_commons_list): Likewise.
7593
7594 2009-12-30  Ian Lance Taylor  <iant@google.com>
7595
7596         PR 10916
7597         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7598         symbols from this object, don't change the visibility of an
7599         undefined symbol.
7600         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7601
7602 2009-12-30  Ian Lance Taylor  <iant@google.com>
7603
7604         PR 10861
7605         * script.h (class Version_script_info): Define Language enum.
7606         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7607         new fields globals_, locals_, and is_finalized_.
7608         * script.cc: Various formatting fixes.
7609         (class Parser_closure): Change language_stack_ from a vector of
7610         std::string to one of Version_script_info::Language.  Adjust all
7611         uses accordingly.
7612         (class Lazy_demangler): Remove.
7613         (struct Version_expression): Change language from std::string to
7614         Version_script_info::Language.
7615         (Version_script_info::Version_script_info): New function.
7616         (Version_script_info::~Version_script_info): Don't call clear.
7617         (Version_script_info::finalize): New function.
7618         (Version_script_info::build_lookup_tables): New function.
7619         (Version_script_info::build_expression_list_lookup): New
7620         function.
7621         (Version_script_info::get_symbol_version_helper): Rewrite to use
7622         lookup tables.
7623         (Version_script_info::print_expression_list): Adjust to use
7624         Version_script_info::Language.
7625         (script_push_lex_into_version_mode): Check that the version script
7626         has not been finalized.
7627         (version_script_push_lang): Change language string to
7628         Version_script_info::Language.
7629         * options.cc (Command_line::version_script): New function.
7630         * options.h (class General_options): Add finalize_dynamic_list
7631         function.  Change version_script from declaration to definition.
7632         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7633         * testsuite/version_script.map: Remove duplicate def of foo.
7634         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7635         version_script.map.
7636         * testsuite/Makefile.in: Rebuild.
7637
7638 2009-12-30  Ian Lance Taylor  <iant@google.com>
7639
7640         PR 10843
7641         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7642         if the input symbol index is 0, make the output symbol index 0.
7643
7644 2009-12-30  Ian Lance Taylor  <iant@google.com>
7645
7646         PR 10670
7647         * options.h (class General_options): Add -x/--discard-all.
7648         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7649         --discard-all.  If the local symbol needs a dynamic entry, check
7650         that before handling --discard-locals.
7651
7652 2009-12-30  Ian Lance Taylor  <iant@google.com>
7653
7654         PR 10450
7655         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7656         flags to PF_R.
7657         (Output_segment::add_output_section): Don't change the flags if
7658         the type is PT_TLS.
7659
7660         PR 10450
7661         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7662         GNU hash table if they need a dynamic value.  Otherwise, don't add
7663         them if they are defined in a dynamic object or are forced local.
7664
7665 2009-12-29  Ian Lance Taylor  <iant@google.com>
7666
7667         PR 10450
7668         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7669         .gnu.hash table for a 32-bit target.
7670
7671         PR 10450
7672         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7673         regular and a dynamic object only needs a dynamic symbol table
7674         entry if it is externally visible.
7675
7676         PR 10450
7677         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7678         constructor.  Add global_offset_table_ field.
7679         (Target_i386::got_section): Set global_offset_table_.
7680         (Target_i386::do_finalize_sections): Set global_offset_table_
7681         size.
7682         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7683         in constructor.  Add global_offset_table_ field.
7684         (Target_x86_64::got_section): Set global_offset_table_.
7685         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7686         size.
7687
7688         * layout.cc (Layout::Layout): Initialize increase_relro_.
7689         (Layout::get_output_section): Add is_relro, is_last_relro, and
7690         is_first_non_relro parameters.  Change all callers.
7691         (Layout::choose_output_section): Likewise.
7692         (Layout::add_output_section_data): Likewise.
7693         (Layout::make_output_section): Likewise.
7694         (Layout::set_segment_offsets): Clear increase_relro when using a
7695         linker script.
7696         * layout.h (class Layout): Add increase_relro method.  Add
7697         increase_relro_ field.  Update declarations.
7698         * output.cc (Output_section::Output_section): Initialize
7699         is_last_relro_ and is_first_non_relro_.
7700         (Output_segment::add_output_section): Group relro sections is
7701         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7702         (Output_segment::maximum_alignment): Remove relro handling.
7703         (Output_segment::set_section_addresses): Add increase_relro
7704         parameter.  Change all callers.  Add initial alignment to align
7705         relro sections on separate page.  Remove old relro handling.
7706         (Output_segment::set_section_list_addresses): Remove in_relro
7707         parameter.  Change all callers.
7708         (Output_segment::set_offset): Add increase parameter.  Change all
7709         callers.  Remove old relro handling.
7710         * output.h (class Output_section): Add new methods: is_last_relro,
7711         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7712         Add is_last_relro_ and is_first_non_relro_ fields.
7713         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7714         Create separate .got.plt section.  Call increase_relro.
7715         * x86_64.cc (Target_x86_64::got_section): Likewise.
7716         * testsuite/relro_script_test.t: Add .got.plt.
7717
7718         PR 10450
7719         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7720         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7721         (Layout::finalize): Call set_dynamic_symbol_size.
7722         (Layout::set_dynamic_symbol_size): New function.
7723         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7724         set_dynamic_symbol_size.
7725
7726         PR 10450
7727         * output.h (class Output_section): Add is_entsize_zero_ field.
7728         * output.cc (Output_section::Output_section): Initialize
7729         is_entsize_zero_.
7730         (Output_section::set_entsize): If two different entsizes are
7731         requested, force it to zero.
7732         (Output_section::add_input_section): Set flags for .debug_str
7733         before updating section flags.  Set entsize.
7734         (Output_section::update_flags_for_input_section): Set SHF_MERGE
7735         and SHF_STRING if all input sections have those flags.
7736
7737 2009-12-29   Rafael Espindola  <espindola@google.com>
7738
7739         * main.cc (main): Fix the sys time reporting.
7740         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
7741         reporting.
7742
7743 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
7744
7745         * options.cc (General_options::parse_version): Allow -v to exit
7746         without an error if there is nothing to link.
7747
7748 2009-12-29  Ian Lance Taylor  <iant@google.com>
7749
7750         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
7751         using a version of gcc before 4.1.
7752         * configure: Rebuild.
7753
7754 2009-12-28  Chris Demetriou  <cgd@google.com>
7755
7756         * attributes.cc (Output_attributes_section_data::do_write): Use
7757         std::vector::front rather than std::vector::data.
7758
7759 2009-12-28  Ian Lance Taylor  <iant@google.com>
7760
7761         * symtab.h (class Symbol_table): Add enum Defined.
7762         * resolve.cc (Symbol_table::should_override): Add defined
7763         parameter.  Change all callers.  Test whether object is NULL
7764         before calling a method on it.
7765         (Symbol_table::report_resolve_problem): Add defined parameter.
7766         Change all callers.
7767         (Symbol_table::should_override_with_special): Likewise.
7768         * symtab.cc (Symbol_table::define_in_output_data): Add defined
7769         parameter.  Change all callers.
7770         (Symbol_table::do_define_in_output_data): Likewise.
7771         (Symbol_table::define_in_output_segment): Likewise.
7772         (Symbol_table::do_define_in_output_segment): Likewise.
7773         (Symbol_table::define_as_constant): Likewise.
7774         (Symbol_table::do_define_as_constant): Likewise.
7775         * script.h (class Symbol_assignment): Add is_defsym parameter to
7776         constructor; change all callers.
7777         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
7778         parameter.  Change all callers.  Add is_defsym_ field.
7779         (class Parser_closure): Add parsing_defsym parameter to
7780         constructor; change all callers.  Add parsing_defsym accessor
7781         function.  Add parsing_defsym_ field.
7782
7783 2009-12-28  Ian Lance Taylor  <iant@google.com>
7784
7785         * gold.cc (queue_middle_tasks): Fix formatting.
7786         * object.cc (Relobj::is_section_name_included): Likewise.
7787
7788 2009-12-23  Ian Lance Taylor  <iant@google.com>
7789
7790         * i386.cc (Target_i386::do_calls_non_split): Recognize
7791         -fsplit-stack prologue for a function with a static chain.
7792         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
7793         -fsplit-stack prologue when using %r11.
7794
7795 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
7796
7797         * options.cc (General_options::parse_version): Make -v continue and do
7798         the link like GNU ld does.
7799
7800 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
7801
7802         * Makefile.am (CCFILES): Add timer.cc.
7803         (HFILES): Add timer.h.
7804         * configure.ac: Check for sysconf and times.
7805         * main.cc: include timer.h.
7806         (main): Use Timer instead of get_run_time.
7807         * timer.cc: New.
7808         * timer.h: New.
7809         * workqueue.cc: include timer.h.
7810         (Workqueue::find_and_run_task):
7811         Report user, sys and wall time.
7812         * Makefile.in: Regenerate.
7813         * config.in: Regenerate.
7814         * configure: Regenerate.
7815
7816 2009-12-16  Doug Kwan  <dougkwan@google.com>
7817
7818         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
7819         sections.
7820         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
7821         relaxed input sections.
7822         * output.cc (Output_section::find_relaxed_input_section): Change
7823         return type to Output_relaxed_input_section pointer.  Adjust code
7824         for new type of relaxed_input_section_map_.
7825         * output.h (Output_section::find_relaxed_input_section): Change
7826         return type to Output_relaxed_input_section pointer.
7827         (Output_section::Output_relaxed_input_section_by_input_section_map):
7828         New type.
7829         (Output_section::relaxed_input_section_map_): Change type to
7830         Output_section::Output_relaxed_input_section_by_input_section_map.
7831         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
7832         input section.
7833
7834 2009-12-15  Ian Lance Taylor  <iant@google.com>
7835
7836         * layout.cc (Layout::create_shstrtab): Only write out after input
7837         sections if we are compressing debug sections.
7838
7839 2009-12-15  Ian Lance Taylor  <iant@google.com>
7840
7841         * archive.cc (Archive::add_symbols): Only look up a symbol without
7842         a version if there is, in fact, a version.
7843
7844 2009-12-14  Ian Lance Taylor  <iant@google.com>
7845
7846         Revert -Wshadow changes, all changes from:
7847         2009-12-11  Doug Kwan  <dougkwan@google.com>
7848         2009-12-11  Nick Clifton  <nickc@redhat.com>
7849         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
7850
7851 2009-12-11  Doug Kwan  <dougkwan@google.com>
7852
7853         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
7854         due to -Wshadow.
7855         * attributes.cc (Object_attribute::size): Ditto.
7856         (Attributes_section_data::size): Ditto.
7857         (Attributes_section_data::Attributes_section_data): Ditto.
7858         (Output_attributes_section_data::do_write): Ditto.
7859         * attributes.h (Object_attribute::set_type): Ditto.
7860         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
7861
7862 2009-12-11  Nick Clifton  <nickc@redhat.com>
7863
7864         * archive.cc: Fix shadowed variable warnings.
7865         * arm.cc: Likewise.
7866         * compressed_output.cc: Likewise.
7867         * compressed_output.h: Likewise.
7868         * configure: Likewise.
7869         * dwarf_reader.cc: Likewise.
7870         * dynobj.cc: Likewise.
7871         * dynobj.h: Likewise.
7872         * ehframe.cc: Likewise.
7873         * ehframe.h: Likewise.
7874         * errors.cc: Likewise.
7875         * expression.cc: Likewise.
7876         * fileread.cc: Likewise.
7877         * fileread.h: Likewise.
7878         * freebsd.h: Likewise.
7879         * i386.cc: Likewise.
7880         * icf.cc: Likewise.
7881         * incremental.h: Likewise.
7882         * layout.cc: Likewise.
7883         * layout.h: Likewise.
7884         * mapfile.cc: Likewise.
7885         * merge.cc: Likewise.
7886         * merge.h: Likewise.
7887         * object.cc: Likewise.
7888         * object.h: Likewise.
7889         * options.h: Likewise.
7890         * output.cc: Likewise.
7891         * output.h: Likewise.
7892         * parameters.cc: Likewise.
7893         * plugin.cc: Likewise.
7894         * powerpc.cc: Likewise.
7895         * reduced_debug_output.cc: Likewise.
7896         * reduced_debug_output.h: Likewise.
7897         * reloc.cc: Likewise.
7898         * reloc.h: Likewise.
7899         * resolve.cc: Likewise.
7900         * script-sections.cc: Likewise.
7901         * script.cc: Likewise.
7902         * script.h: Likewise.
7903         * sparc.cc: Likewise.
7904         * symtab.cc: Likewise.
7905         * symtab.h: Likewise.
7906         * target-select.cc: Likewise.
7907         * target-select.h: Likewise.
7908         * token.h: Likewise.
7909         * workqueue.cc: Likewise.
7910         * workqueue.h: Likewise.
7911         * x86_64.cc: Likewise.
7912
7913 2009-12-10  Doug Kwan  <dougkwan@google.com>
7914
7915         * arm.cc (attributes.h): New include.
7916         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
7917         (Arm_relobj::~Arm_relobj): Delete object pointed by
7918         attributes_section_data_.
7919         (Arm_relobj::attributes_section_data): New method definition.
7920         (Arm_relobj::attributes_section_data_): New data member declaration.
7921         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
7922         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
7923         attributes_section_data_.
7924         (Arm_dynobj::attributes_section_data): New method definition.
7925         (Arm_dynobj::attributes_section_data_): New data member declaration.
7926         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
7927         initialization value of may_use_blx_ to false.
7928         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
7929         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
7930         object attributes to compute results instead of hard-coding.
7931         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
7932         Target_arm::get_secondary_compatible_arch,
7933         Target_arm::set_secondary_compatible_arch
7934         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7935         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
7936         New method declarations.
7937         (Target_arm::get_aeabi_object_attribute): New method definition.
7938         (Target_arm::attributes_section_data_): New data member declaration.
7939         (read_arm_attributes_section): New template definition.
7940         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
7941         (Arm_dynobj::do_read_symbols): Ditto.
7942         (Target_arm::do_finalize_sections): Merge attributes sections from
7943         input.  Check for BLX use after attributes section merging.
7944         Fix __exidx_start and __exidx_end visibility.  Create an
7945         .ARM.attributes section if necessary.
7946         (Target_arm::get_secondary_compatible_arch,
7947         Target_arm::set_secondary_compatible_arch,
7948         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
7949         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
7950         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
7951         New method definitions.
7952
7953 2009-12-09  Ian Lance Taylor  <iant@google.com>
7954
7955         * plugin.cc (Plugin::load): Don't cast from void* to a function
7956         pointer.
7957
7958 2009-12-09  Ian Lance Taylor  <iant@google.com>
7959
7960         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
7961         information fields.
7962
7963 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
7964
7965         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
7966         Replace two_file_shared_1.so with two_file_shared_2.so.
7967         * testsuite/Makefile.in: Regenerated.
7968
7969 2009-12-08  Doug Kwan  <dougkwan@google.com>
7970
7971         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
7972         (HFILES): Add attributes.h and int_encoding.h.
7973         * Makefile.in: Regenerate.
7974         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
7975         function definitions to int_encoding.cc
7976         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
7977         prototypes to int_encoding.h
7978         * reduced_debug_output.cc (int_encoding.h): New include.
7979         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
7980         function definitions to int_encoding.cc
7981         (insert_into_vector, read_from_pointer): Move template definitions to
7982         int_encoding.h
7983         * attributes.cc: New file.
7984         * attributes.h: New file.
7985         * int_encoding.cc: New file.
7986         * int_encoding.h: New file.
7987
7988 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
7989
7990         PR gold/11055
7991         * incremental-dump.cc (dump_incremental_inputs): New.
7992         (main): Use dump_incremental_inputs.
7993
7994 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
7995
7996         PR gold/10893
7997         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
7998         checking elfcpp::STT_FUNC.
7999         (Target_i386::Relocate::relocate): Likewise.
8000         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8001
8002         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8003         symbols from shared libraries into normal FUNC symbols.
8004
8005         * symtab.h (Symbol): Add is_func and use it.
8006
8007 2009-12-05  Doug Kwan  <dougkwan@google.com>
8008
8009         * arm.cc (Target_arm::arm_info): Initialize new fields
8010         attributes_section and attributes_vendor.
8011         * i386.cc (Target_i386::i386_info): Same.
8012         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8013         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8014         fields attributes_section and attributes_vendor.
8015         * sparc.cc (Target_sparc::sparc_info): Same.
8016         * target.h (Target::attributes_section, Target::attributes_vendor,
8017         Target::is_attributes_section, Target::attribute_arg_type,
8018         Target::attributes_order): New method definitions.
8019         (Target::Target_info::attributes_section,
8020         Target::Target_info::attributes_vendor): New fields.
8021         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8022         virtual method definitions.
8023         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8024         attributes_section and attributes_vendor.
8025         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8026
8027 2009-12-05  Doug Kwan  <dougkwan@google.com>
8028
8029         * arm.cc: Update comments about interworking and stub generation.
8030         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8031         considered as non-PIC.
8032         (Arm_relocate_functions::base_abs): Fix formatting.
8033         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8034         of function to use GOT entry address instead of offset.
8035         (Target_arm::Scan::global): Issue an error if a symbol would need a
8036         PLT does not get one because it is untyped.  Remove code to create
8037         dynamic symbols for relative branches.
8038         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8039         takes unsigned integer instead of boolean.
8040
8041 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8042
8043         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8044         (two_file_test_LDADD): Likewise.
8045         (common_test_1_LDADD): Likewise.
8046         (exception_test_LDADD) Likewise.
8047         (weak_test_LDADD): Likewise.
8048         (many_sections_test_LDADD): Likewise.
8049         (initpri1_LDADD): Likewise.
8050         (script_test_1_LDADD): Likewise.
8051         (script_test_2_LDADD): Likewise.
8052         (justsyms_LDADD): Likewise.
8053         (binary_test_LDADD): Likewise.
8054         (large_LDADD): Likewise.
8055         * testsuite/Makefile.in: Regenerated.
8056
8057 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8058
8059         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8060         (Symbol_table::override_with_special): Likewise.
8061         (Symbol_table::add_from_object): Likewise.
8062
8063 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8064
8065         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8066         Don't set the data_offset twice.
8067
8068 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8069
8070         * testsuite/Makefile.in: Regenerate.
8071
8072 2009-12-03  Doug Kwan  <dougkwan@google.com>
8073
8074         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8075         (Target_arm::do_finalize_sections): Add parameter for symbol table
8076         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8077         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8078         parameter for symbol table pointer.
8079         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8080         an additional parameter for a pointer to symbol table.
8081         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8082         parameter for a symbol table pointer.
8083         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8084         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8085         Ditto.
8086         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8087         parameter for a symbol table pointer.
8088
8089 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8090
8091         * incremental.cc (Incremental_inputs_header)
8092         (Incremental_inputs_header_write, Incremental_inputs_entry)
8093         (Incremental_inputs_entry_write): Move ...
8094         * incremental.h (Incremental_inputs_header)
8095         (Incremental_inputs_header_write, Incremental_inputs_entry)
8096         (Incremental_inputs_entry_write): here.
8097
8098 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8099
8100         * incremental.cc (make_sized_incremental_binary): Set the target.
8101         Error if it is incompatible.
8102         * output.h (Output_file): Add filename method.
8103
8104 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8105
8106         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8107         from the get_* methods.
8108
8109 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8110
8111         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8112         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8113         Write 0 for the data_offset of scripts.
8114
8115 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8116
8117         * testsuite/Makefile.am: Add the incremental_test.sh test.
8118         * testsuite/incremental_test.sh: New.
8119         * testsuite/incremental_test_1.c: New.
8120         * testsuite/incremental_test_2.c: New.
8121
8122 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8123
8124        * incremental-dump.cc (main): Fix typos.
8125
8126 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8127
8128         PR gold/11025
8129         * incremental-dump.cc (main): Use llu to print 64 bit values.
8130
8131 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8132             H.J. Lu  <hongjiu.lu@intel.com>
8133
8134         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8135         $(LIBDL).
8136         (incremental_dump_LDADD): Likewise.
8137         * Makefile.in: Regenerated.
8138
8139 2009-11-25  Doug Kwan  <dougkwan@google.com>
8140
8141         Revert:
8142
8143         2009-11-25  Doug Kwan  <dougkwan@google.com>
8144
8145                 * arm.cc (Target_arm::Target_arm): Move method definition
8146                 outside of class definition.  Add code to handle
8147                 --target1-rel, --target1-abs and --target2= options.
8148                 (Target_arm::get_reloc_reloc_type): Change method to be
8149                 non-static and const.
8150                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8151                 New data member declaration.
8152                 (Target_arm::Scan::local, Target_arm::Scan::global,
8153                 Target_arm::Relocate::relocate,
8154                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8155                 Adjust call to Target_arm::get_real_reloc_type.
8156                 (Target_arm::get_real_reloc_type): Use command line options
8157                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8158                 * options.h (--target1-rel, --target1-abs, --target2): New
8159                 ARM-only options.
8160
8161 2009-11-25  Doug Kwan  <dougkwan@google.com>
8162
8163         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8164         class definition.  Add code to handle --target1-rel, --target1-abs
8165         and --target2= options.
8166         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8167         and const.
8168         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8169         member declaration.
8170         (Target_arm::Scan::local, Target_arm::Scan::global,
8171         Target_arm::Relocate::relocate,
8172         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8173         call to Target_arm::get_real_reloc_type.
8174         (Target_arm::get_real_reloc_type): Use command line options to
8175         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8176         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8177         options.
8178
8179 2009-11-25  Doug Kwan  <dougkwan@google.com>
8180
8181         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8182         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8183         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8184         formatting.
8185         (Arm_relocate_functions::thm_call): Replace body with a call to
8186         Arm_relocate_functions::thumb_branch_common.
8187         (Arm_relocate_functions::thm_jump24,
8188         Arm_relocate_functions::thm_xpc22): New method definitions.
8189         (Arm_relocate_functions::thumb_branch_common): New method definition.
8190         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8191         operator.
8192         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8193         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8194
8195 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8196
8197         * Makefile.am: Build incremental-dump
8198         * Makefile.in: Regenerate.
8199         * incremental-dump.cc: New.
8200         * incremental.cc (Incremental_inputs_header_data,
8201         Incremental_inputs_entry_data): Move to incremental.h
8202         * incremental.h: (Incremental_inputs_header_data,
8203         Incremental_inputs_entry_data): Move from incremental.cc
8204
8205 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8206
8207         * incremental.cc (Incremental_inputs_header,
8208         Incremental_inputs_header_write, Incremental_inputs_entry,
8209         Incremental_inputs_entry_write): Add a typedef with the data type.
8210
8211 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8212
8213         * incremental.cc (Incremental_inputs_header,
8214         Incremental_inputs_header_write, Incremental_inputs_entry,
8215         Incremental_inputs_entry_write): Update comment about which
8216         type has the filed descriptions.
8217
8218 2009-11-15  Doug Kwan  <dougkwan@google.com>
8219
8220         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8221         (Arm_relocate_functions::arm_branch_common): Change method defintion
8222         in class definition to a method declaration and update list of formal
8223         parameters.
8224         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8225         Arm_relocation_functions::jump24): Adjust call to
8226         Arm_relocate_functions::arm_branch_common.  Update list of formal
8227         parameters.
8228         (Arm_relocate_functions::xpc25): New method definition.
8229         (Arm_relocate_functions::arm_branch_common): Move method defintion
8230         out from class definition.  Use stubs for mode-switching and extending
8231         branch ranges.
8232         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8233         specially.  Change code to enable use of stubs in ARM branches.
8234
8235 2009-11-10  Doug Kwan  <dougkwan@google.com>
8236
8237         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8238         in method declaration.
8239         (Target_arm::relocate_stub): New method declaration.
8240         (Target_arm::default_target): Change to return a pointer instead of
8241         a const reference.
8242         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8243         Target_arm::default_target.
8244         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8245         method definition.
8246         (Target_arm::relocate_section): Adjust view.
8247         (Target_arm::relocate_stub): New method definition.
8248
8249 2009-11-10  Doug Kwan  <dougkwan@google.com>
8250
8251         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8252         a format warning.
8253         * incremental.cc (open_incremental_binary): Initialized local
8254         variables to avoid warnings.
8255         * object.cc (make_elf_object): Ditto.
8256         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8257         a format warning.
8258
8259 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8260
8261         PR gold/10930
8262         * testsuite/plugin_test.c: Include "config.h".
8263
8264 2009-11-09  Doug Kwan  <dougkwan@google.com>
8265
8266         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8267         (arm_symbol_value): Remove.
8268         (Arm_relocate_functions::arm_branch_common,
8269         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8270         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8271         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8272         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8273         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8274         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8275         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8276         Arm_relocate_functions::thm_mobw_abs_nc,
8277         Arm_relocate_functions::thm_mov_abs,
8278         Arm_relocate_functions::movw_prel_nc,
8279         Arm_relocate_functions::thm_movt_abs,
8280         Arm_relocate_functions::movt_prel,
8281         Arm_relocate_functions::thm_movw_prel_nc,
8282         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8283         (Target_arm::Relocate::relocate): Only decompose address into two
8284         parts if relocation type uses the thumb-bit and pass the actual
8285         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8286         calls to methods in Arm_relocate_functions for this change.
8287
8288 2009-11-08  Ian Lance Taylor  <iant@google.com>
8289
8290         PR 10925
8291         * reloc.cc: Instantiate
8292         Sized_relobj::initialize_input_to_output_maps and
8293         Sized_relobj:free_input_to_output_maps.
8294
8295 2009-11-06  Ian Lance Taylor  <iant@google.com>
8296
8297         PR 10876
8298         * defstd.cc (in_segment): Set only_if_ref true for "end".
8299
8300 2009-11-06  Doug Kwan  <dougkwan@google.com>
8301
8302         * arm.cc (class Reloc_stub): Correct a comment.
8303         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8304         (Target_arm::scan_section_for_stubs): New method declaration.
8305         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8306         Change methods from private to protected.
8307         (Target_arm::do_may_relax): New method definition.
8308         (Target_arm::do_relax, Target_arm::group_sections,
8309         Target_arm::scan_reloc_for_stub,
8310         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8311         (Target_arm::arm_input_section_map_): New data member declaration.
8312         (Target_arm::scan_reloc_for_stub,
8313         Target_arm::scan_reloc_section_for_stubs,
8314         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8315         Target_arm::do_relax): New method definitions.
8316
8317 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8318
8319         * configure.ac: Check for (struct stat)::st_mtim
8320         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8321         * config.in: Regenerate.
8322         * configure: Regenerate.
8323
8324 2009-11-05  Ian Lance Taylor  <iant@google.com>
8325
8326         PR 10910
8327         * output.cc (Output_segment::add_output_section): Add missing
8328         return statement.
8329
8330 2009-11-04  Ian Lance Taylor  <iant@google.com>
8331
8332         PR 10880
8333         * object.h (class Object): Add is_needed and set_is_needed
8334         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8335         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8336         defined in a dynamic object and referenced by a regular object,
8337         set is_needed for the dynamic object.
8338         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8339         if the file is marked with as_needed and it is not needed.
8340
8341 2009-11-04  Ian Lance Taylor  <iant@google.com>
8342
8343         PR 10887
8344         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8345         tags if data is discarded by linker script.
8346         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8347         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8348         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8349         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8350
8351 2009-11-04  Ian Lance Taylor  <iant@google.com>
8352
8353         * layout.cc (Layout::get_output_section): Add is_interp and
8354         is_dynamic_linker_section parameters.  Change all callers.
8355         (Layout::choose_output_section): Likewise.
8356         (Layout::make_output_section): Likewise.
8357         (Layout::add_output_section_data): Add is_dynamic_linker_section
8358         parameter.  Change all callers.
8359         * layout.h (class Layout): Update declarations.
8360         * output.h (class Output_section): Add is_interp, set_is_interp,
8361         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8362         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8363         generate_code_fills_at_write_ to a bitfield.
8364         * output.cc (Output_section::Output_sections): Initialize new
8365         fields.
8366         (Output_segment::add_output_section): Add do_sort parameter.
8367         Change all callers.
8368
8369 2009-11-03  Ian Lance Taylor  <iant@google.com>
8370
8371         PR 10860
8372         * options.h (class General_options): Add --warn-common.
8373         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8374         merging two common symbols.
8375         (Symbol_table::should_override): Handle --warn-common when merging
8376         a common symbol with a defined symbol.  Use report_resolve_problem
8377         for multiple definitions.
8378         (Symbol_table::report_resolve_problem): New function.
8379         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8380
8381 2009-11-03  Doug Kwan  <dougkwan@google.com>
8382
8383         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8384         stub_factory_.
8385         (Target_arm::stub_factory): New method definition.
8386         (Target_arm::new_arm_input_section,
8387         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8388         Target_arm::reloc_uses_thumb_bit): New method declarations.
8389         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8390         New type definitions.
8391         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8392         member declarations.
8393         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8394         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8395         New method definitions.
8396
8397 2009-11-03  Ian Lance Taylor  <iant@google.com>
8398
8399         * options.h (class General_options): Add --warn_constructors.
8400
8401 2009-11-03  Ian Lance Taylor  <iant@google.com>
8402
8403         PR 10893
8404         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8405         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8406
8407 2009-11-03  Ian Lance Taylor  <iant@google.com>
8408
8409         PR 10895
8410         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8411         --msgid-bugs-address.
8412         (install-pdf): New target.
8413         (install-data_yes): Look up one directory to find mkinstalldirs.
8414
8415 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8416
8417         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8418         tree.
8419
8420 2009-10-30  Doug Kwan  <dougkwan@google.com>
8421
8422         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8423
8424 2009-10-30  Doug Kwan  <dougkwan@google.com>
8425
8426         * arm.cc (Stub_addend_reader): New struct template definition
8427         and partial specializations.
8428         (Stub_addend_reader::operator()): New method definition for a
8429         partially specialized template.
8430
8431 2009-10-30  Doug Kwan  <dougkwan@google.com>
8432
8433         * arm.cc (Arm_relobj::processor_specific_flags): New method
8434         definition.
8435         (Arm_relobj::do_read_symbols): New method declaration.
8436         (Arm_relobj::processor_specific_flags_): New data member declaration.
8437         (Arm_dynobj): New class definition.
8438         (Target_arm::do_finalize_sections): Add input_objects parameter.
8439         (Target_arm::do_adjust_elf_header): New method declaration.
8440         (Target_arm::are_eabi_versions_compatible,
8441         (Target_arm::merge_processor_specific_flags): New method declaration.
8442         (Target_arm::do_make_elf_object): New overloaded method definitions
8443         and declaration.
8444         (Arm_relobj::do_read_symbols): New method definition.
8445         (Arm_dynobj::do_read_symbols): Ditto.
8446         (Target_arm::do_finalize_sections): Add input_objects parameters.
8447         Merge processor-specific flags from all input objects.
8448         (Target_arm::are_eabi_versions_compatible,
8449         Target_arm::merge_processor_specific_flags,
8450         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8451         New method definitions.
8452         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8453         Input_objects pointer type parameter.
8454         * layout.cc (Layout::finalize): Pass input objects to target's.
8455         finalize_sections function.
8456         * output.cc (Output_file_header::do_sized_write): Set ELF file
8457         header's processor-specific flags.
8458         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8459         Input_objects pointer type parameter.
8460         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8461         * target.h (Input_objects): New forward class declaration.
8462         (Target::processor_specific_flags,
8463         Target::are_processor_specific_flags_sect): New method definitions.
8464         (Target::finalize_sections): Add input_objects parameter.
8465         (Target::Target): Initialize processor_specific_flags_ and
8466         are_processor_specific_flags_set_.
8467         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8468         parameter.
8469         (Target::set_processor_specific_flags): New method definition.
8470         (Target::processor_specific_flags_,
8471         Target::are_processor_specific_flags_set_): New data member
8472         declarations.
8473         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8474         Input_objects pointer type parameter.
8475
8476 2009-10-30  Doug Kwan  <dougkwan@google.com>
8477
8478         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8479
8480 2009-10-28  Ian Lance Taylor  <iant@google.com>
8481
8482         * object.h (class Relobj): Drop options parameter from
8483         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8484         do_scan_relocs, do_relocate.  Change all callers.
8485         (class Sized_relobj): Drop options parameters from
8486         do_gc_process_relocs, do_scan_relocs, do_relocate,
8487         do_relocate_sections, relocate_sections, emit_relocs_scan,
8488         emit_relocs_scan_reltype.  Change all callers.
8489         (struct Relocate_info): Remove options field and all references to
8490         it.
8491         * reloc.h (class Read_relocs): Remove options constructor
8492         parameter and options_ field.  Change all callers.
8493         (class Gc_process_relocs, class Scan_relocs): Likewise.
8494         (class Relocate_task): Likewise.
8495         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8496         all callers.
8497         (scan_relocatable_relocs): Likewise.
8498         * target.h (class Sized_target): Remove options parameter from
8499         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8500         all callers.
8501         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8502         callers.
8503         * arm.cc: Update functions to remove options parameters.
8504         * i386.cc: Likewise.
8505         * powerpc.cc: Likewise.
8506         * sparc.cc: Likewise.
8507         * x86_64.cc: Likewise.
8508         * testsuite/testfile.cc: Likewise.
8509
8510 2009-10-28  Doug Kwan  <dougkwan@google.com>
8511
8512         * arm.cc (Arm_relobj): New class definition.
8513         (Arm_relobj::scan_sections_for_stubs,
8514         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8515         New method definitions.
8516
8517 2009-10-28  Cary Coutant  <ccoutant@google.com>
8518
8519         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8520         (Plugin::cleanup_done_): New member.
8521         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8522         (Plugin_manager::cleanup_done_): Remove.
8523         (Plugin_manager::add_input_file): Edit error message.
8524         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8525         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8526
8527 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8528
8529         * fileread.cc: (File_read::View::~View): Use the new
8530         data_ownership_ filed.
8531         (File_read::~File_read): Dispose the new whole_file_view_.
8532         (File_read::open): Mmap the whole file if needed.
8533         (File_read::open): Use whole_file_view_ instead of contents_.
8534         (File_read::find_view): Use whole_file_view_ if applicable.
8535         (File_read::do_read): Use whole_file_view_ instead of contents_.
8536         (File_read::make_view): Use whole_file_view_ instead of contents_,
8537         update File_read::View::View call.
8538         (File_read::find_or_make_view): Update File_read::View::View
8539         call.
8540         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8541         remove contents_
8542         (File_read::View::Data_ownership): New enum.
8543         (File_read::View::View): Replace bool mapped_ with Data_ownership
8544         argument.
8545         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8546         (File_read::View::data_ownership_): New field.
8547         (File_read::contents_): Remove (replaced by whole_file_view_).
8548         (File_read::whole_file_view_): New field.
8549         * options.h (class General_options): Add --keep-files-mapped.
8550
8551 2009-10-27  Cary Coutant  <ccoutant@google.com>
8552
8553         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8554         * testsuite/Makefile.am (plugin_test_5): New test case.
8555         * testsuite/Makefile.in: Regenerate.
8556
8557 2009-10-25  Doug Kwan  <dougkwan@google.com>
8558
8559         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8560         from private to protected to allow access by child class.
8561         (Sized_relobj::do_relocate_sections): New method declaration.
8562         (Sized_relobj::relocate_sections): Virtualize.
8563         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8564         Sized_relobj::relocate_sections.  Instantiate template explicitly
8565         for different target sizes and endianity.
8566
8567 2009-10-24  Doug Kwan  <dougkwan@google.com>
8568
8569         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8570         (Arm_input_section::as_arm_input_section): New method.
8571         (Arm_output_section): New class definition.
8572         (Arm_output_section::create_stub_group,
8573         Arm_output_section::group_sections): New method definitions.
8574
8575 2009-10-22  Doug Kwan  <dougkwan@google.com>
8576
8577         * arm.cc (Arm_input_section): New class definition.
8578         (Arm_input_section::init, Arm_input_section:do_write,
8579         Arm_input_section::set_final_data_size,
8580         Arm_input_section::do_reset_address_and_file_offset): New method
8581         definitions.
8582
8583 2009-10-21  Doug Kwan  <dougkwan@google.com>
8584
8585         * arm.cc (Stub_table, Arm_input_section): New forward class
8586         declarations.
8587         (Stub_table): New class defintion.
8588         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8589         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8590         New method definition.
8591
8592 2009-10-21  Doug Kwan  <dougkwan@google.com>
8593
8594         * arm.cc: Update copyright comments.
8595         (Target_arm): New forward class template declaration.
8596         (Arm_address): New type.
8597         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8598         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8599         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8600         constants.
8601         (Insn_template): Same.
8602         (DEF_STUBS): New macro.
8603         (Stub_type): New enum type.
8604         (Stub_template): New class definition.
8605         (Stub): Same.
8606         (Reloc_stub): Same.
8607         (Stub_factory): Same.
8608         (Target_arm::Target_arm): Initialize may_use_blx_ and
8609         should_force_pic_veneer_.
8610         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8611         Target_arm::should_force_pic_veneer,
8612         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8613         Target_arm::using_thumb_only, Target_arm:;default_target): New
8614         method defintions.
8615         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8616         New data member declarations.
8617         (Insn_template::size, Insn_template::alignment): New method defintions.
8618         (Stub_template::Stub_template): New method definition.
8619         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8620         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8621         (Stub_factory::Stub_factory): New method definition.
8622         * gold.h (string_hash): New template.
8623         * output.h (Input_section_specifier::hash_value): Use
8624         gold::string_hash.
8625         (Input_section_specifier::string_hash): Remove.
8626         * stringpool.cc (Stringpool_template::string_hash): Use
8627         gold::string_hash.
8628
8629 2009-10-20  Doug Kwan  <dougkwan@google.com>
8630
8631         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8632         symbols of relaxed input sections.
8633         * output.h (Output_section::find_relaxed_input_section): Make
8634         method public.
8635
8636 2009-10-16  Doug Kwan  <dougkwan@google.com>
8637
8638         * dynobj.cc (Versions::Versions): Initialize version_script_.
8639         Only insert base version symbol definition for a shared object
8640         if version script defines any version versions.
8641         (Versions::define_base_version): New method definition.
8642         (Versions::add_def): Check that base version is not needed.
8643         (Versions::add_need): Define base version lazily.
8644         * dynobj.h (Versions::define_base_version): New method declaration.
8645         (Versions::needs_base_version_): New data member declaration.
8646         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8647         (check_DATA): Add no_version_test.stdout.
8648         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8649         New make rules.
8650         * testsuite/Makefile.in: Regenerate.
8651         * testsuite/no_version_test.c: New file.
8652         * testsuite/no_version_test.sh: Ditto.
8653
8654 2009-10-16  Doug Kwan  <dougkwan@google.com>
8655
8656         * expression.cc (class Segment_start_expression): New class definition.
8657         (Segment_start_expression::value): New method definition.
8658         (script_exp_function_segment_start): Return a new
8659         Segment_start_expression.
8660         * gold/script-c.h (script_saw_segment_start_expression): New function
8661         prototype.
8662         * script-sections.cc (Script_sections::Script_sections): Initialize
8663         SAW_SEGMENT_START_EXPRESSION_ to false.
8664         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8665         and -Tbbs options to specify section addresses if given in
8666         command line and no SEGMENT_START expression is seen in a script.
8667         * script-sections.h (Script_sections::saw_segment_start_expression,
8668         Script_sections::set_saw_segment_start_expression): New method
8669         definition.
8670         (Script_sections::saw_segment_start_expression_): New data member
8671         declaration.
8672         * script.cc (script_saw_segment_start_expression): New function.
8673         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8674         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8675         script_test_7.sh and script_test_8.sh.
8676         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8677         script_test_8.stdout.
8678         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8679         (script_test_6, script_test_6.stdout, script_test_7,
8680         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8681         * Makefile.in: Regenerate.
8682         * testsuite/script_test_6.sh: New file.
8683         * testsuite/script_test_6.t: Same.
8684         * testsuite/script_test_7.sh: Same.
8685         * testsuite/script_test_7.t: Same.
8686         * testsuite/script_test_8.sh: Same.
8687
8688 2009-10-16  Doug Kwan  <dougkwan@google.com>
8689
8690         * output.cc (Output_segment::set_section_list_address): Cast
8691         expressions to unsigned long long type to avoid format warnings.
8692
8693 2009-10-15  Ian Lance Taylor  <iant@google.com>
8694
8695         * script.cc (Script_options::add_symbol_assignment): Always add a
8696         dot assignment to script_sections_.
8697         * script-sections.cc (Script_sections::add_dot_assignment):
8698         Initialize if necessary.
8699
8700         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8701         program headers with no load segment if there is a linker script.
8702
8703         * layout.cc (Layout::set_segment_offsets): Align the file offset
8704         to the segment aligment for -N or -n with no load segment.
8705         * output.cc (Output_segment::add_output_section): Don't crash if
8706         the first section is a TLS section.
8707         (Output_segment::set_section_list_addresses): Print an error
8708         message if the address moves backward in a linker script.
8709         * script-sections.cc
8710         (Output_section_element_input::set_section_addresses): Don't
8711         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8712         (Orphan_output_section::set_section_addresses): Likewise.
8713
8714 2009-10-15  Doug Kwan  <dougkwan@google.com>
8715
8716         * layout.cc (Layout::finish_dynamic_section): Generate tags
8717         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8718         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8719         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8720
8721 2009-10-14  Ian Lance Taylor  <iant@google.com>
8722
8723         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8724         fields.
8725         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8726         data_shdr fields of relinfo.
8727         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8728         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8729         R_386_TLS_LDO_32, adjust based on section flags.
8730         (Target_i386::Relocate::fix_up_ldo): Remove.
8731
8732 2009-10-13  Ian Lance Taylor  <iant@google.com>
8733
8734         Add support for -pie.
8735         * options.h (class General_options): Add -pie and
8736         --pic-executable.
8737         (General_options::output_is_position_independent): Test -pie.
8738         (General_options::output_is_executable): Return true if not shared
8739         and not relocatable.
8740         (General_options::output_is_pie): Remove.
8741         * options.cc (General_options::finalize): Reject incompatible uses
8742         of -pie.
8743         * gold.cc (queue_middle_tasks): A -pie link is not static.
8744         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
8745         * symtab.cc (Symbol::final_value_is_known): Return false if
8746         output_is_position_independent.
8747         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
8748         output_is_position_independent.
8749         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
8750         output_is_position_independent.
8751         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
8752         output_is_position_independent.
8753         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
8754         two_file_pie_test.
8755         (basic_pie_test.o, basic_pie_test): New targets.
8756         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
8757         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
8758         (two_file_pie_test): New target.
8759         * testsuite/Makefile.in: Rebuild.
8760         * README: Remove note saying that -pie is not supported.
8761
8762 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
8763
8764         * options.h (class General_options): Add -init and -fini.
8765         * layout.cc (Layout::finish_dynamic_section): Emit
8766         given init and fini functions.
8767
8768 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
8769
8770         * gc.h (gc_process_relocs): Check if icf is enabled using new
8771         function.
8772         * gold.cc (queue_initial_tasks): Likewise.
8773         (queue_middle_tasks): Likewise.
8774         * object.cc (do_layout): Likewise.
8775         * symtab.cc (is_section_folded): Likewise.
8776         * main.cc (main): Likewise.
8777         * reloc.cc (Read_relocs::run): Likewise.
8778         (Sized_relobj::do_scan_relocs): Likewise.
8779         * icf.cc (is_function_ctor_or_dtor): New function.
8780         (Icf::find_identical_sections): Check if function is ctor or dtor when
8781         safe icf is chosen.
8782         * options.h (General_options::icf): Change option to be an enum.
8783         (Icf_status): New enum.
8784         (icf_enabled): New method.
8785         (icf_safe_folding): New method.
8786         (set_icf_status): New method.
8787         (icf_status_): New variable.
8788         * (options.cc) (General_options::finalize): Set icf_status_.
8789         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
8790         icf_test and icf_keep_unique_test to use the --icf enum flag.
8791         * testsuite/icf_safe_test.sh: New file.
8792         * testsuite/icf_safe_test.cc: New file.
8793
8794 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
8795
8796         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
8797         includes to gc.h and icf.h.
8798         * arm.cc: Include gc.h.
8799         * gold.cc: Likewise.
8800         * i386.cc: Likewise.
8801         * powerpc.cc: Likewise.
8802         * sparc.cc: Likewise.
8803         * x86_64.cc: Likewise.
8804         * gc.h: Include icf.h.
8805
8806 2009-10-11  Ian Lance Taylor  <iant@google.com>
8807
8808         * plugin.cc: Include "gold.h" before other header files.
8809
8810 2009-10-10  Chris Demetriou  <cgd@google.com>
8811
8812         * options.h (Input_file_argument::Input_file_type): New enum.
8813         (Input_file_argument::is_lib_): Replace with...
8814         (Input_file_argument::type_): New member.
8815         (Input_file_argument::Input_file_argument): Take Input_file_type
8816         'type' rather than boolean 'is_lib' as second argument.
8817         (Input_file_argument::is_lib): Use type_.
8818         (Input_file_argument::is_searched_file): New function.
8819         (Input_file_argument::may_need_search): Handle is_searched_file.
8820         * options.cc (General_options::parse_library): Support -l:filename.
8821         (General_options::parse_just_symbols): Update for Input_file_argument
8822         changes.
8823         (Command_line::process): Likewise.
8824         * archive.cc (Archive::get_file_and_offset): Likewise.
8825         * plugin.cc (Plugin_manager::release_input_file): Likewise.
8826         * script.cc (read_script_file, script_add_file): Likewise.
8827         * fileread.cc (Input_file::Input_file): Likewise.
8828         (Input_file::will_search_for): Handle is_searched_file.
8829         (Input_file::open): Likewise.
8830         * readsyms.cc (Read_symbols::get_name): Likewise.
8831         * testsuite/Makefile.am (searched_file_test): New test.
8832         * testsuite/Makefile.in: Regenerate.
8833         * testsuite/searched_file_test.cc: New file.
8834         * testsuite/searched_file_test_lib.cc: New file.
8835
8836 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8837             Ian Lance Taylor  <iant@google.com>
8838
8839         * descriptor.cc: Include <cstdio> and "binary-io.h".
8840         (Descriptors::open): Open the files in binary mode always.
8841         * script.cc (Lex::get_token): Treat \r as whitespace.
8842
8843 2009-10-09  Ian Lance Taylor  <iant@google.com>
8844
8845         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
8846
8847 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8848             Ian Lance Taylor  <iant@google.com>
8849
8850         * configure.ac: Check for readv function also.
8851         * fileread.cc (readv): Define if not HAVE_READV.
8852         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
8853         does not exist.
8854         * config.in: Regenerate.
8855         * configure: Regenerate.
8856
8857 2009-10-09  Doug Kwan  <dougkwan@google.com>
8858
8859         * layout.cc (Layout::make_output_section): Call target hook to make
8860         ordinary output section.
8861         (Layout::finalize): Adjust parameter list of call the
8862         Target::may_relax().
8863         * layout.h (class Layout::section_list): New method.
8864         * merge.h (Output_merge_base::entsize): Change visibility to public.
8865         (Output_merge_base::is_string, Output_merge_base::do_is_string):
8866         New methods.
8867         (Output_merge_string::do_is_string): New method.
8868         * object.cc (Sized_relobj::do_setup): renamed from
8869         Sized_relobj::set_up.
8870         * object.h (Sized_relobj::adjust_shndx,
8871         Sized_relobj::initializ_input_to_output_maps,
8872         Sized_relobj::free_input_to_output_maps): Change visibilities to
8873         protected.
8874         (Sized_relobj::setup): Virtualize.
8875         (Sized_relobj::do_setup): New method declaration.
8876         (Sized_relobj::invalidate_section_offset,
8877         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
8878         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
8879         * options.cc (parse_int): New function.
8880         * options.h (parse_int): New declaration.
8881         (DEFINE_int): New macro.
8882         (stub_group_size): New option.
8883         * output.cc (Output_section::Output_section): Initialize memebers
8884         merge_section_map_, merge_section_by_properties_map_,
8885         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
8886         (Output_section::add_input_section): Handled deferred code-fill
8887         generation and remove an old comment.
8888         (Output_section::add_relaxed_input_section): New method definition.
8889         (Output_section::add_merge_input_section): Use merge section by
8890         properties map to speed to search.  Update merge section maps
8891         as appropriate.
8892         (Output_section::build_relaxation_map): New method definition.
8893         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8894         Same.
8895         (Output_section::relax_input_section): Renamed to
8896         Output_section::convert_input_sections_to_relaxed_sections and change
8897         interface to take a vector of pointers to relaxed sections.
8898         (Output_section::find_merge_section,
8899         Output_section::find_relaxed_input_section): New method definitions.
8900         (Output_section::is_input_address_mapped,
8901         Output_section::output_offset, Output_section::output_address):
8902         Use output section data maps to speed up searching.
8903         (Output_section::find_starting_output_address): Add comments.
8904         (Output_section::do_write,
8905         Output_section::write_to_postprocessing_buffer): Do code-fill
8906         generation as appropriate.
8907         (Output_section::get_input_sections): Invalidate relaxed input section
8908         map.
8909         (Output_section::restore_states): Adjust type of checkpoint .
8910         Invalidate relaxed input section map.
8911         * output.h (Output_merge_base): New class declaration.
8912         (Input_section_specifier): New class defintion.
8913         (class Output_relaxed_input_section) Change base class to
8914         Output_section_data_build.
8915         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
8916         base class initializer.
8917         (Output_section::add_relaxed_input_section): New method declaration.
8918         (Output_section::Input_section): Change visibility to protected.
8919         (Output_section::Input_section::relobj,
8920         Output_section::Input_section::shndx): Handle relaxed input sections.
8921         Output_section::input_sections) Change visibility to protected.  Also
8922         define overload to return a non-const pointer.
8923         (Output_section::Merge_section_properties): New class defintion.
8924         (Output_section::Merge_section_by_properties_map,
8925         Output_section::Output_section_data_by_input_section_map,
8926         Output_section::Relaxation_map): New types.
8927         (Output_section::relax_input_section): Rename method to
8928         Output_section::convert_input_sections_to_relaxed_sections and change
8929         interface to take a vector of relaxed section pointers.
8930         (Output_section::find_merge_section,
8931         Output_section::find_relaxed_input_section,
8932         Output_section::build_relaxation_map,
8933         Output_section::convert_input_sections_in_list_to_relaxed_sections):
8934         New method declarations.
8935         (Output_section::merge_section_map_
8936         Output_section::merge_section_by_properties_map_,
8937         Output_section::relaxed_input_section_map_,
8938         Output_section::is_relaxed_input_section_map_valid_,
8939         Output_section::generate_code_fills_at_write_): New data members.
8940         * script-sections.cc
8941         (Output_section_element_input::set_section_addresses): Call
8942         current_data_size and addralign methods of relaxed input sections.
8943         (Orphan_output_section::set_section_addresses): Call current_data_size
8944         and addralign methods of relaxed input sections.
8945         * symtab.cc (Symbol_table::compute_final_value): Extract template
8946         from the body of Symbol_table::sized_finalize_symbol.
8947         (Symbol_table::sized_finalized_symbol): Call
8948         Symbol_table::compute_final_value.
8949         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
8950         (Symbol_table::compute_final_value): New templated method declaration.
8951         * target.cc (Target::do_make_output_section): New method defintion.
8952         * target.h (Target::make_output_section): New method declaration.
8953         (Target::relax): Add more parameters for input objects, symbol table
8954         and layout.  Adjust call to do_relax.
8955         (Target::do_make_output_section): New method declaration.
8956         (Target::do_relax): Add parameters for input objects, symbol table
8957         and layout.
8958
8959 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8960
8961         * pread.c: Include stdio.h.
8962
8963 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8964
8965         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
8966         defined.
8967
8968 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
8969
8970         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8971         Change read_shndx type to unsigned int.
8972         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8973         int.
8974         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8975         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
8976         Change read_shndx type to unsigned int.
8977         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
8978         int.
8979         (Sized_dwarf_line_info::read_line_mappings): Likewise.
8980         * layout.cc (Layout::create_symtab_sections): Cast the result of
8981         local_symcount * symsize to off_t in the gold_assert.
8982
8983 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8984
8985         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
8986         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
8987         R_ARM_BASE_ABS.
8988         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
8989         (Arm_relocate_functions::thm_abs5): New function.
8990         (Arm_relocate_functions::abs12): New function.
8991         (Arm_relocate_functions::abs16): New function.
8992         (Arm_relocate_functions::base_abs): New function.
8993         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
8994         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
8995         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
8996         R_ARM_BASE_ABS.
8997         (Scan::global): Likewise.
8998         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
8999         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9000         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9001         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9002         R_ARM_BASE_ABS.
9003
9004 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9005
9006         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9007         (Arm_relocate_functions::movt_prel): New function.
9008         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9009         (Arm_relocate_functions::thm_movt_prel): New function.
9010         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9011         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9012         (Scan::global, Relocate::relocate): Likewise.
9013         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9014
9015 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9016
9017         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9018         Incremental_checker.
9019         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9020         unsigned int.
9021         (class Incremental_inputs_header): New class.
9022         (Incremental_inputs_header_writer): Edit comment.
9023         (Incremental_inputs_entry): New class.
9024         (Incremental_inputs_entry_writer): Edit comment.
9025         (Sized_incremental_binary::do_find_incremental_inputs_section):
9026         Add *strtab_shndx parameter, fill it.
9027         (Sized_incremental_binary::do_check_inputs): New method.
9028         (Incremental_checker::can_incrementally_link_output_file): Use
9029         Sized_incremental_binary::check_inputs.
9030         (Incremental_inputs::report_command_line): Save command line in
9031         command_line_.
9032         * incremental.h:
9033         (Incremental_binary::find_incremental_inputs_section): New
9034         method.
9035         (Incremental_binary::do_find_incremental_inputs_section): Add
9036         strtab_shndx parameter.
9037         (Incremental_binary::do_check_inputs): New pure virtual method.
9038         (Sized_incremental_binary::do_check_inputs): Declare.
9039         (Incremental_checker::Incremental_checker): Add incremental_inputs
9040         parameter, use it to initialize incremental_inputs_.
9041         (Incremental_checker::incremental_inputs_): New field.
9042         (Incremental_checker::command_line): New method.
9043         (Incremental_checker::inputs): New method.
9044         (Incremental_checker::command_line_): New field.
9045
9046 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9047
9048         * incremental.cc: Include <cstdarg> and "target-select.h".
9049         (vexplain_no_incremental): New function.
9050         (explain_no_incremental): New function.
9051         (Incremental_binary::error): New method.
9052         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9053         method.
9054         (make_sized_incremental_binary): New function.
9055         (open_incremental_binary): New function.
9056         (can_incrementally_link_file): Add checks if output is ELF and has
9057         inputs section.
9058         * incremental.h: Include "elfcpp_file.h" and "output.h".
9059         (Incremental_binary): New class.
9060         (Sized_incremental_binary): New class.
9061         (open_incremental_binary): Declare.
9062         * object.cc (is_elf_object): Use
9063         elfcpp::Elf_recognizer::is_elf_file.
9064         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9065         * output.h (Output_file::filesize): New method.
9066
9067 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9068
9069         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9070         New function.
9071         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9072         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9073         function.
9074         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9075         function.
9076         (Arm_relocate_functions::movw_abs_nc): New function.
9077         (Arm_relocate_functions::movt_abs): New function.
9078         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9079         (Arm_relocate_functions::thm_movt_abs): New function.
9080         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9081         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9082         (Scan::global): Likewise.
9083         (Relocate::relocate): Likewise.
9084         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9085
9086 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9087
9088         * arm.cc (Arm_relocate_functions::got_prel) New function.
9089         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9090         (Relocate::relocate): Likewise.
9091         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9092
9093 2009-10-06  Ian Lance Taylor  <iant@google.com>
9094
9095         * options.h (class General_options): Define
9096         split_stack_adjust_size parameter.
9097         * object.h (class Object): Add uses_split_stack_ and
9098         has_no_split_stack_ fields.  Add uses_split_stack and
9099         has_no_split_stack accessor functions.  Declare
9100         handle_split_stack_section.
9101         (class Reloc_symbol_changes): Define.
9102         (class Sized_relobj): Define Function_offsets.  Declare
9103         split_stack_adjust, split_stack_adjust_reltype, and
9104         find_functions.
9105         * object.cc (Object::handle_split_stack_section): New function.
9106         (Sized_relobj::do_layout): Call handle_split_stack_section.
9107         * dynobj.cc (Sized_dynobj::do_layout): Call
9108         handle_split_stack_section.
9109         * reloc.cc (Sized_relobj::relocate_sections): Call
9110         split_stack_adjust for executable sections in split_stack
9111         objects.  Pass reloc_map to relocate_section.
9112         (Sized_relobj::split_stack_adjust): New function.
9113         (Sized_relobj::split_stack_adjust_reltype): New function.
9114         (Sized_relobj::find_functions): New function.
9115         * target-reloc.h: Include "object.h".
9116         (relocate_section): Add reloc_symbol_changes parameter.  Change
9117         all callers.
9118         * target.h (class Target): Add calls_non_split method.  Declare
9119         do_calls_non_split virtual method.  Declare match_view and
9120         set_view_to_nop.
9121         * target.cc: Include "elfcpp.h".
9122         (Target::do_calls_non_split): New function.
9123         (Target::match_view): New function.
9124         (Target::set_view_to_nop): New function.
9125         * gold.cc (queue_middle_tasks): Give an error if mixing
9126         split-stack and non-split-stack objects with -r.
9127         * i386.cc (Target_i386::relocate_section): Add
9128         reloc_symbol_changes parameter.
9129         (Target_i386::do_calls_non_split): New function.
9130         * x86_64.cc (Target_x86_64::relocate_section): Add
9131         reloc_symbol_changes parameter.
9132         (Target_x86_64::do_calls_non_split): New function.
9133         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9134         parameter.
9135         * powerpc.cc (Target_powerpc::relocate_section): Add
9136         reloc_symbol_changes parameter.
9137         * sparc.cc (Target_sparc::relocate_section): Add
9138         reloc_symbol_changes parameter.
9139         * configure.ac: Call AM_CONDITIONAL for the default target.
9140         * configure: Rebuild.
9141         * testsuite/Makefile.am (TEST_AS): New variable.
9142         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9143         (check_DATA): Add split_i386 and split_x86_64 files.
9144         (SPLIT_DEFSYMS): Define.
9145         (split_i386_[1234n].o): New targets.
9146         (split_i386_[124]): New targets.
9147         (split_i386_[1234r].stdout): New targets.
9148         (split_x86_64_[1234n].o): New targets.
9149         (split_x86_64_[124]): New targets.
9150         (split_x86_64_[1234r].stdout): New targets.
9151         (MOSTLYCLEANFILES): Add new executables.
9152         * testsuite/split_i386.sh: New file.
9153         * testsuite/split_x86_64.sh: New file.
9154         * testsuite/split_i386_1.s: New file.
9155         * testsuite/split_i386_2.s: New file.
9156         * testsuite/split_i386_3.s: New file.
9157         * testsuite/split_i386_4.s: New file.
9158         * testsuite/split_i386_n.s: New file.
9159         * testsuite/split_x86_64_1.s: New file.
9160         * testsuite/split_x86_64_2.s: New file.
9161         * testsuite/split_x86_64_3.s: New file.
9162         * testsuite/split_x86_64_4.s: New file.
9163         * testsuite/split_x86_64_n.s: New file.
9164         * testsuite/testfile.cc (Target_test): Update relocation_section
9165         function.
9166         * testsuite/Makefile.in: Rebuild.
9167
9168 2009-10-06  Ian Lance Taylor  <iant@google.com>
9169
9170         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9171         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9172         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9173         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9174         the address on ldo_addrs_.
9175         (Target_i386::Relocate::fix_up_ldo): New function.
9176
9177 2009-10-06   Rafael Espindola  <espindola@google.com>
9178
9179         * plugin.cc (add_input_library): New.
9180         (Plugin::load): Add add_input_library to tv.
9181         (Plugin_manager::add_input_file): Add the is_lib argument.
9182         (add_input_file): Update call to Plugin_manager::add_input_file.
9183         (add_input_library): New.
9184         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9185
9186 2009-09-30  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9189         symbol and call Symbol::may_need_copy_reloc to determine if
9190         a copy reloc is needed.
9191         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9192         nocopyreloc is given in command line.
9193         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9194         given in command line.
9195         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9196         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9197         of the removed Target_i386::may_need_copy_reloc.
9198         * options.h (copyreloc): New option with default value false.
9199         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9200         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9201         instead of the removed Target_powerpc::may_need_copy_reloc.
9202         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9203         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9204         instead of the removed Target_sparc::may_need_copy_reloc.
9205         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9206         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9207         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9208         instead of the removed Target_x86_64::may_need_copy_reloc.
9209
9210 2009-09-30  Ian Lance Taylor  <iant@google.com>
9211
9212         * object.h (class Object): Remove target_ field, and target,
9213         sized_target, and set_target methods.
9214         (Object::sized_target): Remove.
9215         (class Sized_relobj): Update declarations.  Remove sized_target.
9216         * object.cc (Sized_relobj::setup): Remove target parameter.
9217         Change all callers.
9218         (Input_objects::add_object): Don't do anything with the target.
9219         (make_elf_sized_object): Add punconfigured parameter.  Change all
9220         callers.  Set or test parameter target.
9221         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9222         Change all callers.
9223         * parameters.cc (Parameters::set_target): Change parameter type to
9224         be non-const.
9225         (Parameters::default_target): Remove.
9226         (set_parameters_target): Change parameter type to be non-const.
9227         (parameters_force_valid_target): New function.
9228         (parameters_clear_target): New function.
9229         * parameters.h (class Parameters): Update declarations.  Remove
9230         default_target method.  Add sized_target and clear_target
9231         methods.  Change target_ to be non-const.
9232         (set_parameters_target): Update declaration.
9233         (parameters_force_valid_target): Declare.
9234         (parameters_clear_target): Declare.
9235         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9236         as NULL if we aren't searching.
9237         (Add_symbols::run): Don't check for compatible target.
9238         * fileread.cc (Input_file::open_binary): Call
9239         parameters_force_valid_target.
9240         * gold.cc (queue_middle_tasks): Likewise.
9241         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9242         set_target on object.
9243         * dynobj.h (class Sized_dynobj): Update declarations.
9244         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9245         make_elf_object returns NULL.
9246         (Archive::include_member): Don't check whether object target is
9247         compatible.
9248         * output.cc (Output_section::add_input_section): Get target from
9249         parameters.
9250         (Output_section::relax_input_section): Likewise.
9251         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9252         parameters.
9253         (Sized_relobj::do_scan_relocs): Likewise.
9254         (Sized_relobj::relocate_sections): Likewise.
9255         * resolve.cc (Symbol_table::resolve): Likewise.
9256         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9257         parameter.  Change all callers.
9258         (Symbol_table::add_from_object): Get target from parameters.
9259         (Symbol_table::add_from_relobj): Don't check object target.
9260         (Symbol_table::add_from_dynobj): Likewise.
9261         (Symbol_table::define_special_symbol): Get target from
9262         parameters.
9263         * symtab.h (class Symbol_table): Update declaration.
9264         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9265         parameter.  Change all callers.  Clear parameter target.
9266         (Binary_test): Test target here.
9267         * testsuite/object_unittest.cc (gold_testsuite): Remove
9268         target_test_pointer parameter.  Change all callers.
9269         (Object_test): Test target here.
9270
9271 2009-09-26  Ian Lance Taylor  <iant@google.com>
9272
9273         * testsuite/initpri1.c: Don't try to use constructor priorities if
9274         compiling with gcc before 4.3.
9275
9276 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9277
9278         * testsuite/retain_symbols_file_test.sh (check_present): Change
9279         output file name to retain_symbols_file_test.stdout.
9280         (check_absent): Likewise.
9281
9282 2009-09-18  Craig Silverstein  <csilvers@google.com>
9283
9284         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9285         * options.cc: Include <cerrno> and <fstream>.
9286         (General_options::finalize): Parse -retain-symbols-file tag.
9287         * options.h: New flag.
9288         (General_options): New method should_retain_symbol, new
9289         variable symbols_to_retain.
9290         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9291         should_retain_symbol map.
9292         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9293         * testsuite/Makefile.in: Regenerate.
9294         * testsuite/retain_symbols_file_test.sh: New file.
9295
9296 2009-09-18  Nick Clifton  <nickc@redhat.com>
9297
9298         * po/es.po: Updated Spanish translation.
9299
9300 2009-09-17  Doug Kwan  <dougkwan@google.com>
9301
9302         * debug.h (DEBUG_RELAXATION): New constant.
9303         (DEBUG_ALL): Add DEBUG_RELAXATION.
9304         (debug_string_to_enum): Add relaxation debug option.
9305         * layout.cc
9306         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9307         Layout::Relaxation_debug_check::read_sections,
9308         Layout::Relaxation_debug_check::read_sections): New method definitions.
9309         (Layout::Layout): Initialize data members
9310         record_output_section_data_from_scrips_,
9311         script_output_section_data_list_ and relaxation_debug_check_.
9312         (Layout::save_segments, Layout::restore_segments,
9313         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9314         Layout::relaxation_loop_body): New method definitions.
9315         (Layout::finalize): Support relaxation.  Move section layout code to
9316         Layout::relaxation_loop_body.
9317         (Layout::set_asection_address_from_script): Move code for orphan
9318         section placement out.
9319         (Layout::place_orphan_sections_in_script): New method definition.
9320         * layout.h (Output_segment_headers, Output_file_header):
9321         New forward class declarations.
9322         (Layout::~Layout): Define.
9323         (Layout::new_output_section_data_from_script): New method definition.
9324         (Layout::place_orphan_sections_in_script): New method declaration.
9325         (Layout::Segment_states): New type declaration.
9326         (Layout::save_segments, Layout::restore_segments,
9327         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9328         Layout::relaxation_loop_body): New method declarations.
9329         (Layout::Output_section_data_list): New type declaration.
9330         (Layout::Relaxation_debug_check): New class definition.
9331         (Layout::record_output_section_data_from_script_,
9332         Layout::script_output_section_data_list_, Layout::segment_states_,
9333         Layout::relaxation_debug_check_): New data members.
9334         * output.cc: (Output_section_headers::do_size): New method definition.
9335         (Output_section_headers::Output_section_headers): Move size
9336         computation to Output_section_headers::do_size.
9337         (Output_segment_headers::do_size): New method definition.
9338         (Output_file_header::Output_file_header): Move size computation to
9339         Output_file_header::do_size and call it.
9340         (Output_file_header::do_size): New method definition.
9341         (Output_data_group::Output_data_group): Adjust call to
9342         Output_section_data.
9343         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9344         (Output_symtab_xindex::do_write): Add array bound check.
9345         (Output_section::Input_section::print_to_mapfile): Handle
9346         RELAXED_INPUT_SECTION_CODE.
9347         (Output_section::Output_section): Initialize data member checkpoint_.
9348         (Output_section::~Output_section): Delete checkpoint object pointed
9349         by checkpoint_.
9350         (Output_section::add_input_section): Always add an Input_section if
9351         relaxing.
9352         (Output_section::add_merge_input_section): Add assert.
9353         (Output_section::relax_input_section): New method definition.
9354         (Output_section::set_final_data_size): Set load address to zero for
9355         an unallocated section.
9356         (Output_section::do_address_and_file_offset_have_reset_values):
9357         New method definition.
9358         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9359         Handle relaxed input section.
9360         (Output_section::sort_attached_input_sections): Checkpoint input
9361         section list lazily.
9362         (Output_section::get_input_sections): Change type of input_sections to
9363         list of Simple_input_section pointers.  Checkpoint input section list
9364         lazily.  Also handle relaxed input sections.
9365         (Output_section::add_input_section_for_script): Take a reference to
9366         a Simple_input_section object instead of Relobj pointer and section
9367         index as parameter.  Handle relaxed input sections.
9368         (Output_section::save_states, Output_section::restore_states): New
9369         method definitions.
9370         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9371         (Output_data::is_data_size_fixed): New method definition.
9372         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9373         if it is fixed.
9374         (Output_data::address_and_file_offset_have_reset_values): New method
9375         definition.
9376         (Output_data::do_address_and_file_offset_have_reset_values): New method
9377         definition.
9378         (Output_data::set_data_size): Check that data size is not fixed.
9379         (Output_data::fix_data_size): New method definition.
9380         (Output_data::is_data_size_fixed_): New data member.
9381         (Output_section_headers::set_final_data_size): New method definition.
9382         (Output_section_headers::do_size): New method declaration.
9383         (Output_segment_headers::set_final_data_size): New method definition.
9384         (Output_segment_headers::do_size): New method declaration.
9385         (Output_file_header::set_final_data_size)::New method definition.
9386         (Output_file_header::do_size)::New method declaration.
9387         (Output_section_data::Output_section_data): Add new parameter
9388         is_data_size_fixed and use it to fix data size.
9389         (Output_data_const::Output_data_const): Adjust call to base class
9390         constructor and fix data size.
9391         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9392         base class constructor and fix data size.
9393         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9394         base class constructor and fix data size.
9395         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9396         class constructor and fix data size.
9397         (Output_data_group::set_final_data_size): New method definition.
9398         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9399         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9400         class constructor and fix data size.
9401         (Output_relaxed_input_section): New class definition.
9402         (Output_section::Simple_input_section): New class definition.
9403         (Output_section::get_input_sections): Adjust parameter list.
9404         (Output_section::add_input_section_for_script): Same.
9405         (Output_section::save_states, Output_section::restore_states,
9406         Output_section::do_address_and_file_offset_have_reset_values,
9407         (Output_section::Input_section::Input_section): Handle
9408         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9409         Output_relaxed_input_section.
9410         (Output_section::Input_section::is_input_section,
9411         Output_section::Input_section::set_output_section): Handle relaxed
9412         input section.
9413         (Output_section::Input_section::is_relaxed_input_section,
9414         Output_section::Input_section::output_section_data,
9415         Output_section::Input_section::relaxed_input_section): New method
9416         definitions.
9417         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9418         value.
9419         (Output_section::Input_section::u1_): Update comments.
9420         (Output_section::Input_section::u2_): Add new union member poris.
9421         (Output_section::Checkpoint_output_section): New classs definition.
9422         (Output_section::relax_input_section): New method declaration.
9423         (Output_section::checkpoint_): New data member.
9424         (Output_segment): Update comments.
9425         (Output_segment::Output_segment): Un-privatize copy constructor.
9426         (Output_segment::operator=): Un-privatize.
9427         * script-sections.cc (Output_section_element::Input_section_list):
9428         Change element type to Output_section::Simple_input_section.
9429         (Output_section_element_dot_assignment::set_section_addresses):
9430         Register output section data for relaxation clean up.
9431         (Output_data_exression::Output_data_expression): Adjust call to base
9432         constructor to fix data size.
9433         (Output_section_element_data::set_section_addresses): Register
9434         Output_data_expression object for relaxation clean up.
9435         (struct Input_section_info): Replace Relobj pointer and section index
9436         pair with Output_section::Simple_input_section and Convert struct to a
9437         class.
9438         (Input_section_sorter::operator()): Adjust access to
9439         Input_section_info data member to use accessors.
9440         (Output_section_element_input::set_section_addresses): Use layout
9441         parameter.  Adjust code to use Output_section::Simple_input_section
9442         and Input_secction_info classes.  Register filler for relaxation
9443         clean up.
9444         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9445         and section index pair with Output_section::Simple_input_section
9446         class.  Adjust code accordingly.
9447         (Phdrs_element::release_segment): New method definition.
9448         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9449         segment list.
9450         (Script_sections::release_segments): New method definition.
9451         * gold/script-sections.h (Script_sections::release_segments): New
9452         method declaration.
9453         * gold/target.h (Target::may_relax, Target::relax,
9454         Target::do_may_relax, Target::do_relax): New method definitions.
9455
9456 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9457
9458         * arm.cc (has_signed_unsigned_overflow): New function.
9459         (Arm_relocate_functions::abs8): New function.
9460         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9461         (Target_arm::Scan::global): Likewise.
9462         (Target_arm::relocate::relocate): Likewise.
9463         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9464         Likewise.
9465
9466 2009-09-16  Cary Coutant  <ccoutant@google.com>
9467
9468         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9469         * testsuite/Makefile.in: Regenerate.
9470
9471 2009-09-11  Nick Clifton  <nickc@redhat.com>
9472
9473         * po/gold.pot: Updated by the Translation project.
9474
9475 2009-09-08  Cary Coutant  <ccoutant@google.com>
9476
9477         * output.cc (Output_file::open): Add execute permission to empty file.
9478         * testsuite/Makefile.am (permission_test): New test.
9479         * testsuite/Makefile.in: Regenerate.
9480
9481 2009-09-02  Ian Lance Taylor  <iant@google.com>
9482
9483         * output.cc (Output_file::resize): Call map_no_anonymous rather
9484         than map.
9485
9486 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9487
9488         * gold.cc: Include "incremental.h".
9489         (queue_initial_tasks): Call Incremental_checker methods.
9490         * incremental.cc: Include "output.h".
9491         (Incremental_checker::can_incrementally_link_output_file): New
9492         method.
9493         * incremental.h (Incremental_checker): New class.
9494
9495         * output.cc (Output_file::open_for_modification): New method.
9496         (Output_file::map_anonymous): Changed return type to bool.  Record
9497         map in base_ field.
9498         (Output_file::map_no_anonymous): New method, broken out of map.
9499         (Output_file::map): Use map_no_anonymous and map_anonymous.
9500         * output.h (class Output_file): Update declarations.
9501
9502 2009-08-24  Cary Coutant  <ccoutant@google.com>
9503
9504         * options.h (Command_line::Pre_options): New class.
9505         (Command_line::pre_options): New member.
9506         * options.cc (gold::options::ready_to_register): New variable.
9507         (One_option::register_option): Do nothing if not registering options.
9508         Assert if same short option registered twice.
9509         (General_options::General_options): Turn off option registration when
9510         done constructing.
9511         (Command_line::Pre_options::Pre_options): New constructor.
9512
9513 2009-08-24  Cary Coutant  <ccoutant@google.com>
9514
9515         * options.h (General_options::no_keep_memory): Remove incorrect
9516         short option.
9517
9518 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9519
9520         * Makefile.am (am__skiplex, am__skipyacc): New.
9521         * Makefile.in: Regenerate.
9522
9523 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9524
9525         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9526         (INCLUDES): ... this.
9527         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9528         (AM_CPPFLAGS): Renamed from ...
9529         (INCLUDE): ... this.
9530         * Makefile.in, testsuite/Makefile.in: Regenerate.
9531
9532         * Makefile.in: Regenerate.
9533         * aclocal.m4: Likewise.
9534         * config.in: Likewise.
9535         * configure: Likewise.
9536         * testsuite/Makefile.in: Likewise.
9537
9538         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9539         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9540         * Makefile.in: Regenerate.
9541         * testsuite/Makefile.in: Regenerate.
9542
9543 2009-08-19  Cary Coutant  <ccoutant@google.com>
9544
9545         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9546         symbols in shared libraries overridden by hidden or internal symbols
9547         in the main program.
9548
9549 2009-08-19  Chris Demetriou  <cgd@google.com>
9550
9551         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9552         checking source file names in error messages.
9553
9554 2009-08-18  Doug Kwan  <dougkwan@google.com>
9555
9556         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9557         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9558         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9559         an elfcpp::Ehdr as parameter.
9560         * object.cc (Object::set_target): Remove the version that looks up
9561         a target and sets it.
9562         (Sized_relobj::setup): Take a Target object instead of
9563         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9564         (make_elf_sized_object): Find target and ask target to
9565         make an ELF object.
9566         * object.h: (Object::set_target): Remove the version that looks up
9567         a target and sets it.
9568         (Sized_relobj::setup): Take a Target object instead of
9569         an elfcpp:Ehdr as parameter.
9570         * target.cc: Include dynobj.h.
9571         (Target::do_make_elf_object_implementation): New.
9572         (Target::do_make_elf_object): New.
9573         * target.h (Target::make_elf_object): New template declaration.
9574         (Target::do_make_elf_object): New method declarations.
9575         (Target::do_make_elf_object_implementation): New template declaration.
9576
9577 2009-08-14  Ian Lance Taylor  <iant@google.com>
9578
9579         * gold.h (FUNCTION_NAME): Define.
9580         (gold_unreachable): Use FUNCTION_NAME.
9581
9582 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9583
9584         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9585         symbol in the --keep-unique list is not found.
9586
9587 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9588
9589         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9590         been maked as --keep-unique.
9591         (Icf::unfold_section): New function.
9592         * icf.h (Icf::unfold_section): New function.
9593         * options.h (General_options::keep_unique): New option.
9594         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9595         * testsuite/Makefile.in: Regenerate.
9596         * testsuite/icf_keep_unique_test.sh: New file.
9597         * testsuite/icf_keep_unique_test.cc: New file.
9598
9599 2009-08-12  Cary Coutant  <ccoutant@google.com>
9600
9601         PR 10471
9602         * resolve.cc (Symbol_table::resolve): Check for references from
9603         dynamic objects to hidden and internal symbols.
9604         * testsuite/Makefile.am (hidden_test.sh): New test.
9605         * testsuite/Makefile.in: Regenerate.
9606         * testsuite/hidden_test.sh: New script.
9607         * testsuite/hidden_test_1.c: New test source.
9608         * testsuite/hidden_test_main.c: New test source.
9609
9610 2009-08-11  Doug Kwan  <dougkwan@google.com>
9611
9612         * arm.cc: Update comments.
9613         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9614         segment to locate the .ARM.exidx section if present.
9615
9616 2009-08-09  Doug Kwan  <dougkwan@google.com>
9617
9618         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9619         patch.
9620
9621 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9622         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9623         compiler warnings.
9624
9625 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9626
9627         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9628         valid tls_segment only for non-debug-section relocations.
9629         * testsuite/Makefile.am: Add gc_tls_test.
9630         * testsuite/Makefile.in: Regenerate.
9631         * testsuite/gc_tls_test.cc: New file.
9632         * testsuite/gc_tls_test.sh: New file.
9633
9634 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9635
9636         * icf.cc: New file.
9637         * icf.h: New file.
9638         * Makefile.am (CCFILES): Add icf.cc.
9639         (HFILES): Add icf.h
9640         * Makefile.in: Regenerate.
9641         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9642         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9643         section, symbol and addend information for the relocs.
9644         * gold.cc (queue_middle_tasks): Call identical code folding.
9645         * gold.h: Add defines for multimap.
9646         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9647         to the call of finalize_local_symbols.
9648         * main.cc (main): Create object of class Icf.
9649         * object.cc (Sized_relobj::do_layout): Allow this function to be
9650         called twice during icf.
9651         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9652         to sections marked as identical by icf.
9653         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9654         when available.
9655         (Sized_relobj::do_section_entsize): New function.
9656         * object.h (Object::section_entsize): New function.
9657         (Object::do_section_entsize): New pure virtual function.
9658         (Relobj::finalize_local_symbols): Add new parameter.
9659         (Relobj::do_section_entsize): New function.
9660         * options.h (General_options::icf): New option.
9661         (General_options::icf_iterations): New option.
9662         (General_options::print_icf_sections): New option.
9663         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9664         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9665         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9666         icf.
9667         * symtab.cc (Symbol_table::is_section_folded): New function.
9668         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9669         to sections marked as identical by icf.
9670         * symtab.h (Symbol_table::set_icf): New function.
9671         (Symbol_table::icf): New function.
9672         (Symbol_table::is_section_folded): New function.
9673         (Symbol_table::icf_): New data member.
9674         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9675         * testsuite/Makefile.am: Add commands to build icf_test.
9676         * testsuite/Makefile.in: Regenerate.
9677         * testsuite/icf_test.sh: New file.
9678         * testsuite/icf_test.cc: New file.
9679
9680 2009-07-24  Chris Demetriou  <cgd@google.com>
9681
9682         * layout.cc (is_compressible_debug_section): Fix incorrect
9683         comment about compressed section names.
9684
9685 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9686
9687         PR 10419
9688         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9689
9690 2009-07-16  Ian Lance Taylor  <iant@google.com>
9691
9692         PR 10400
9693         * layout.h: #include <map>.
9694         (class Kept_section): Change from struct to class.  Add accessors
9695         and setters.  Add section size to Comdat_group mapping.  Change
9696         Comdat_group to std::map.  Add is_comdat_ field.  Add
9697         linkonce_size field in union.
9698         (class Layout): Update declaration of find_or_add_kept_section.
9699         Don't declare find_kept_object.
9700         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9701         parameter.  Add object, shndx, is_comdat, and is_group_name
9702         parameters.  Change all callers.  Adjust for new Kept_section.
9703         (Layout::find_kept_object): Remove.
9704         * object.cc (Sized_relobj::include_section_group): Update use of
9705         Kept_section.  Rename secnum to shndx.  Only record
9706         Kept_comdat_section if sections are the same size.
9707         (Sized_relobj::include_linkonce_section): Update use of
9708         Kept_section.  Only record Kept_comdat_section if sections are the
9709         same size.  Set size of linkonce section.
9710         (Sized_relobj::map_to_kept_section): Update call to
9711         get_kept_comdat_section.
9712         * object.h (class Sized_relobj): Rename fields in
9713         Kept_comdat_section to drop trailing underscores; change object
9714         field to Relobj*.  Change Kept_comdat_section_table to store
9715         struct rather than pointer.
9716         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9717         Add kept_object and kept_shndx parameters.  Change all callers.
9718         (Sized_relobj::get_kept_comdat_section): Change return type to
9719         bool.  Add kept_object and kept_shndx parameters.  Change all
9720         callers.
9721         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9722         Layout::find_or_add_kept_section.
9723
9724 2009-07-09  Ian Lance Taylor  <iant@google.com>
9725
9726         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9727         Reserve space in the hash table.
9728
9729 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9730
9731         * fileread.cc (File_read::get_mtime): New method.
9732         * fileread.h (Timespec): New structure.
9733         (File_read::get_mtime): New method.
9734         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
9735         Renamed from timestamp_nsec.
9736         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
9737         Elf_Xword.
9738         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
9739         timestamp_nsec.
9740         (Incremental_inputs::report_archive): Save mtime; style fix.
9741         (Incremental_inputs::report_obejct): Save mtime; style fix.
9742         (Incremental_inputs::report_script): Save mtime; style fix.
9743         (Incremental_inputs::finalize_inputs): Style fix.
9744         (Incremental_inputs::finalize): Style fix.
9745         (Incremental_inputs::create_input_section_data): Store inputs
9746         mtime.
9747         * incremental.h (Incremental_inputs::report_script): Add mtime
9748         argument.
9749         (Incremental_inputs::Input_info::Input_info): Intialize only one
9750         union member.
9751         (Incremental_inputs::Input_info::archive): Move to nameless
9752         union.
9753         (Incremental_inputs::Input_info::obejct): Move to nameless union.
9754         (Incremental_inputs::Input_info::script): Move to nameless union.
9755         (Incremental_inputs::mtime): New field.
9756         * script.cc (read_input_script): Pass file mtime to
9757         Incremental_input.
9758         * script.h (Script_info::inputs): Style fix.
9759
9760 2009-07-01  Ian Lance Taylor  <ian@airs.com>
9761
9762         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
9763         instead of 32.
9764
9765 2009-06-24  Ian Lance Taylor  <iant@google.com>
9766
9767         PR 10156
9768         * layout.cc (Layout::choose_output_section): If we find an
9769         existing section, update the flags.
9770         (Layout::create_notes): New function, broken out of
9771         Layout::finalize.
9772         (Layout::finalize): Don't create note sections.
9773         (Layout::create_note): Don't crash if linker script discards
9774         section.
9775         (Layout::create_gold_note): Likewise.
9776         (Layout::create_build_id): Likewise.  Don't set
9777         after_input_sections on the section.
9778         (Layout::create_executable_stack_info): Remove target parameter.
9779         Change caller.
9780         * layout.h (class Layout): Declare create_notes.  Update
9781         declaration of create_executable_stack_info.
9782         * gold.cc (queue_middle_tasks): Call create_notes.
9783         * output.cc (Output_section::update_flags_for_input_section): Move
9784         here from output.h.  If SHF_ALLOC flag is newly set, mark address
9785         invalid.
9786         * output.h (Output_data::mark_address_invalid): New function.
9787         (class Output_section): Only declare, not define,
9788         update_flags_for_input_section.  Remove set_flags.
9789
9790 2009-06-24  Ian Lance Taylor  <iant@google.com>
9791
9792         * script-sections.cc (Output_section_definition::
9793         set_section_addresses): Rename shadowing local load_address to
9794         laddr.
9795
9796 2009-06-24  Ian Lance Taylor  <iant@google.com>
9797
9798         PR 10244
9799         * reloc.cc (relocate_sections): Skip empty relocation sections.
9800
9801 2009-06-23  Ian Lance Taylor  <iant@google.com>
9802
9803         PR 10156
9804         * layout.cc (Layout::create_note): Use choose_output_section
9805         rather than make_output_section.
9806
9807 2009-06-23  Ian Lance Taylor  <iant@google.com>
9808
9809         PR 10237
9810         * options.cc (General_options::parse_V): Set printed_version_.
9811         (General_options::General_options): Initialize printed_version_.
9812         * options.h (class General_options): Add printed_version_ field.
9813         * gold.cc (queue_initial_tasks): If there are no input files,
9814         don't give a fatal error if we printed the version information.
9815         (queue_middle_tasks): If using -r with a shared object, give a
9816         fatal error rather than an ordinary error.
9817
9818 2009-06-23  Ian Lance Taylor  <iant@google.com>
9819
9820         PR 10219
9821         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
9822         (Layout::make_output_section): Set have_stabstr_section_ if we see
9823         a .stab*str section.
9824         (Layout::finalize): Call link_stabs_sections.
9825         (Layout::link_stabs_sections): New file.
9826         * layout.h (class Layout): Add have_stabstr_section_ field.
9827         Declare link_stabs_sections.
9828
9829 2009-06-23  Doug Kwan  <dougkwan@google.com>
9830
9831         * Makefile.am (libgold_a_LIBADD): New.
9832         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
9833         * Makefile.in: Regenerate.
9834         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
9835         * configure: Regenerate.
9836         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
9837         * fileread.cc: Include sys/state.h
9838         * gold.h: Declare memmem and strndup if found missing.
9839         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
9840
9841 2009-06-23  Ian Lance Taylor  <iant@google.com>
9842
9843         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
9844         * configure: Rebuild.
9845
9846 2009-06-23  Ian Lance Taylor  <iant@google.com>
9847
9848         PR 10147
9849         * object.cc (Object::section_contents): Don't try to get a view if
9850         the section has length zero.
9851         (Object::handle_gnu_warning_section): If the section is empty, use
9852         the name of the section as the warning.
9853
9854 2009-06-23  Ian Lance Taylor  <iant@google.com>
9855
9856         PR 10133
9857         * stringpool.h (class Stringpool_template): Add optimize_ field.
9858         (Stringpool_template::set_optimize): New function.
9859         * stringpool.cc (Stringpool_template::Stringpool_template):
9860         Initialize optimize_ field.
9861         (Stringpool_template::set_string_offsets): Test local optimize
9862         fild rather than parameter.
9863         * layout.cc (Layout::Layout): Call set_optimize on the section
9864         name stringpool.
9865
9866 2009-06-22  Ian Lance Taylor  <iant@google.com>
9867
9868         PR 10030
9869         * yyscript.y: Parse TARGET.
9870         * script.cc (script_set_target): New function.
9871         * script-c.h (script_set_target): Declare.
9872         * options.cc (General_options::string_to_object_format): Rename
9873         from string_to_object_format in anonymous namespace.  Change
9874         callers.
9875         * options.h (class General_options): Declare
9876         string_to_object_format.
9877
9878 2009-06-22  Ian Lance Taylor  <iant@google.com>
9879
9880         * script-sections.cc (Script_sections::create_segments): Don't put
9881         program headers in a PT_LOAD segment if -n or -N.
9882
9883 2009-06-22  Ian Lance Taylor  <iant@google.com>
9884
9885         PR 10141
9886         * options.h (class General_options): Add -z lazy and -z now.  Sort
9887         -z options into alphabetical order.
9888         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
9889
9890 2009-06-21  Ian Lance Taylor  <iant@google.com>
9891
9892         * layout.cc (Layout::make_output_section): Call
9893         Target::new_output_section.
9894         (Layout::attach_allocated_section_to_segment): Put large section
9895         sections in a separate load segment with the large segment flag
9896         set.
9897         (Layout::segment_precedes): Sort large data segments after other
9898         load segments.
9899         (align_file_offset): New static function.
9900         (Layout::set_segment_offsets): Use align_file_offset.
9901         * output.h (class Output_section): Add is_small_section_ and
9902         is_large_section_ fields.
9903         (Output_section::is_small_section): New function.
9904         (Output_section::set_is_small_section):  New function.
9905         (Output_section::is_large_section): New function.
9906         (Output_section::set_is_large_section): New function.
9907         (Output_section::is_large_data_section): New function.
9908         (class Output_segment): Add is_large_data_segment_ field.
9909         (Output_segment::is_large_data_segment): New function.
9910         (Output_segment::set_is_large_data_segment): New function.
9911         * output.cc (Output_section::Output_section): Initialize new
9912         fields.
9913         (Output_segment::Output_segment): Likewise.
9914         (Output_segment::add_output_section): Add assertion that large
9915         data sections always go in large data segments.  Force small data
9916         sections to the end of the list of data sections.  Force small BSS
9917         sections to the start of the list of BSS sections.  For large BSS
9918         sections to the end of the list of BSS sections.
9919         * symtab.h (class Symbol): Declare is_common_shndx.
9920         (Symbol::is_defined): Check Symbol::is_common_shndx.
9921         (Symbol::is_common): Likewise.
9922         (class Symbol_table): Define enum Commons_section_type.  Update
9923         declarations.  Add small_commons_ and large_commons_ fields.
9924         * symtab.cc (Symbol::is_common_shndx): New function.
9925         (Symbol_table::Symbol_table): Initialize new fields.
9926         (Symbol_table::add_from_object): Put small and large common
9927         symbols in the right list.
9928         (Symbol_table::sized_finalized_symbol): Check
9929         Symbol::is_common_shndx.
9930         (Symbol_table::sized_write_globals): Likewise.
9931         * common.cc (Symbol_table::do_allocate_commons): Allocate new
9932         common symbol lists.  Don't call do_allocate_commons_list if the
9933         list is empty.
9934         (Symbol_table::do_allocate_commons_list): Remove is_tls
9935         parameter.  Add comons_section_type parameter.  Change all
9936         callers.  Handle small and large common symbols.
9937         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
9938         Symbol::is_common_shndx.
9939         * resolve.cc (symbol_to_bits): Likewise.
9940         * target.h (Target::small_common_shndx): New function.
9941         (Target::small_common_section_flags): New function.
9942         (Target::large_common_shndx): New function.
9943         (Target::large_common_section_flags): New function.
9944         (Target::new_output_section): New function.
9945         (Target::Target_info): Add small_common_shndx, large_common_shndx,
9946         small_common_section_flags, and large_common_section_flags
9947         fields.
9948         (Target::do_new_output_section): New virtual function.
9949         * arm.cc (Target_arm::arm_info): Initialize new fields.
9950         * i386.cc (Target_i386::i386_info): Likewise.
9951         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
9952         Likewise.
9953         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
9954         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
9955         (Target_x86_64::do_new_output_section): New function.
9956         * configure.ac: Define conditional MCMODEL_MEDIUM.
9957         * testsuite/Makefile.am (check_PROGRAMS): Add large.
9958         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
9959         (large_LDFLAGS): Define.
9960         * testsuite/large.c: New file.
9961         * testsuite/testfile.cc (Target_test::test_target_info):
9962         Initialize new fields.
9963         * configure, testsuite/Makefile.in: Rebuild.
9964
9965 2009-06-05  Doug Kwan  <dougkwan@google.com>
9966
9967         * Makefile.am (CCFILES): Add target.cc.
9968         * Makefile.in: Regenerate.
9969         * i386.cc (class Target_i386): Define new virtual method to
9970         override do_is_local_label_name in parent.
9971         * object.cc (Sized_relobj::do_count_local_symbols): Discard
9972         local symbols if --discard-locals or -X is given.
9973         * options.h (class General_options): Declare new options
9974         '--discard-locals' and '-X' for discarding locals.
9975         * target.h (class Target): Define new methods is_local_label_name.
9976         Declare new virtual method do_is_local_label_name.
9977         * target.cc: New file.
9978         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
9979         (check_SCRIPTS): Add discard_locals_test.sh.
9980         (check_DATA): Add discard_local_tests.syms.
9981         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
9982         (discard_local_tests.syms, discard_locals_test.o): New make rules.
9983         * testsuite/Makefile.in: Regenerate.
9984         * testsuite/discard_locals_test.c: New file.
9985         * testsuite/discard_locals_test.sh: Same.
9986
9987 2009-06-05  Doug Kwan  <dougkwan@google.com>
9988
9989         * object.cc (Sized_relobj::Sized_relobj): Initialize
9990         discarded_eh_frame_shndx_ to -1U.
9991         (Sized_relobj::do_layout): Record index of a discard .eh_frame
9992         section.
9993         (Sized_relobj::do_count_local_symbols): Skip local symbols in
9994         a discarded .eh_frame section.
9995         (Sized_relobj::do_finalize_local_symbols): Ditto.
9996         * object.h (class Sized_relobj): Declare new member
9997         discarded_eh_frame_shndx_.
9998         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
9999         (local_labels_test.o, local_labels_test): New rules.
10000         * testsuite/Makefile.in: Regenerate.
10001
10002 2009-06-04  Doug Kwan  <dougkwan@google.com>
10003
10004         * layout.cc (Layout::section_name_mapping): Add mapping for
10005         special ARM sections.
10006
10007 2009-06-03  Doug Kwan  <dougkwan@google.com>
10008
10009         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10010         (utils::has_overflow): Same.
10011
10012 2009-06-03  Ian Lance Taylor  <iant@google.com>
10013
10014         * layout.cc (Layout::section_name_mapping): New array, replacing
10015         Layout::linkonce_mapping.
10016         (Layout::section_name_mapping_count): New variable, replacing
10017         Layout::linkonce_mapping_count.
10018         (Layout::linkonce_output_name): Remove.
10019         (Layout::output_section_name): Rewrite.
10020         * layout.h (class Layout): Rename Linkonce_mapping to
10021         Section_name_mapping, linkonce_mapping to section_name_mapping,
10022         linkonce_mapping_count to section_name_mapping_count.  Don't
10023         declare linkonce_output_name.
10024
10025 2009-06-03  Doug Kwan  <dougkwan@google.com>
10026
10027         * gold/arm.cc (namespace utils): New.
10028         (Target_arm::reloc_is_non_pic): Define new method.
10029         (class Arm_relocate_functions): New.
10030         (Target_arm::Relocate::relocate): Handle relocation types used by
10031         Android.
10032
10033 2009-06-03  Ian Lance Taylor  <iant@google.com>
10034
10035         * arm.cc (Target_arm::scan::global): Use || instead of |.
10036
10037 2009-06-02  Doug Kwan  <dougkwan@google.com>
10038
10039         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10040         issued_non_pic_error_.
10041         (class Target_arm::Scan): Declare new method check_non_pic.
10042         Define new method symbol_needs_plt_entry.
10043         Declare new data member issued_non_pic_error_.
10044         (class Target_arm::Relocate): Declare new method
10045         should_apply_static_reloc.
10046         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10047         (Target_arm::Scan::check_non_pic): Define new method.
10048         (Target_arm::Scan::local): Handle a small subset of reloc types used
10049         by Android.
10050         (Target_arm::Scan::local): Same.
10051         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10052
10053 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10054
10055         * incremental.cc (Incremental_inputs::report_command_line): Filter
10056         out --incremental-* options.
10057
10058 2009-05-29  Doug Kwan  <dougkwan@google.com>
10059
10060         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10061         template class.
10062         (class Target_arm): Update comment.
10063         (Target_arm::Target_arm): Initialize new data members GOT_,
10064         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10065         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10066         and Target_arm::rel_dyn_section.
10067         Declare new_enum Target_arm::Got_type.
10068         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10069         and DYNBSS_.
10070         Update commments for member do_dynsym_value.
10071         (Target_arm::got_size, Target_arm::plt_section,
10072         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10073         new methods inside class defintion.
10074         (Target_arm::got_section): Define new method.
10075         (Target_arm::rel_dyn_section): Same.
10076         (Output_data_plt_arm): New template class.
10077         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10078         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10079         (Output_data_plt_arm::add_entry): Same.
10080         (Output_data_plt_arm::first_plt_entry): Define new
10081         static data member for PLT instruction template.
10082         (Output_data_plt_arm::plt_entry): Same.
10083         (Output_data_plt_arm::do_write): Define new method.
10084         (Target_arm::make_plt_entry): Same.
10085         (Target_arm::do_finalize_sections): Same.
10086         (Target_arm::do_dynsym_value): Same.
10087
10088 2009-05-28  Doug Kwan  <dougkwan@google.com>
10089
10090         * Makefile.am (TARGETSOURCES): Add arm.cc.
10091         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10092         * Makefile.in: Regenerate.
10093         * arm.cc: New file.
10094         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10095
10096 2009-05-26  Doug Kwan  <dougkwan@google.com>
10097
10098         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10099         (General_options::check_excluded_libs): Strip off directories in
10100         archive name before matching like GNU ld does.
10101         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10102         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10103         (exclude_libs_test_LDFLAGS): Add linker option
10104         -Wl,--exclude-libs,libexclude_libs_test_3
10105         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10106         an explicit archive without using -l.
10107         (alt/libexclude_libs_test_3.a): New make rule.
10108         * testsuite/Makefile.in: Regenerate.
10109         * testsuite/exclude_libs_test.c : Declare lib3_default().
10110         (main): Call it.
10111         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10112         * exclude_libs_test_3.c: New file.
10113
10114 2009-05-26  Nick Clifton  <nickc@redhat.com>
10115
10116         * po/id.po: New Indonesian translation.
10117         * po/gold.pot: Updated template file.
10118
10119 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10120
10121         * testsuite/Makefile.am: Add -ffunction-sections to compile
10122         gc_comdat_test files.  Add -Wl,--gc-sections to build
10123         gc_comdat_test.
10124         * testsuite/Makefile.in: Regenerate.
10125         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10126
10127 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10128
10129         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10130         kept comdat section was garbage collected.
10131         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10132         * testsuite/Makefile.in: Regenerate.
10133         * testsuite/gc_comdat_test.sh: New file.
10134         * testsuite/gc_comdat_test_1.cc: New file.
10135         * testsuite/gc_comdat_test_2.cc: New file.
10136
10137 2009-05-19  Doug Kwan  <dougkwan@google.com>
10138
10139         * archive.cc (Archive::Archive): Move constructor from archive.h
10140         to here.  Initialize no_export_.
10141         (Archive::get_elf_object_for_member): Set no_export flag of object.
10142         * archive.h (Archive::Archive): Move constructor body to
10143         archive.cc.
10144         (Archive::no_export): New method.
10145         (Archive::no_export_): New field.
10146         * object.h (Object::Object): Initialize no_export_ to false.
10147         (Object::no_export, Object::set_no_export): New methods.
10148         (Object::no_export_): New field.
10149         * options.cc (General_options::parse_exclude_libs): New method.
10150         (General_options::check_excluded_libs) Same.
10151         * options.h (exclude_libs): New option.
10152         (General_options::check_excluded_libs): New method declaration.
10153         (General_options::excluded_libs_): New field.
10154         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10155         default or protected visibility if an object has no-export flag set.
10156         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10157         (check_SCRIPTS): Add exclude_libs_test.sh.
10158         (check_DATA): Add exclude_libs_test.syms.
10159         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10160         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10161         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10162         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10163         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10164         libexclude_libs_test_2.a): New rules.
10165         * testsuite/Makefile.in: Regenerate.
10166         * testsuite/exclude_libs_test.c: New file.
10167         * testsuite/exclude_libs_test.sh: Ditto.
10168         * testsuite/exclude_libs_test_1.c: Ditto.
10169         * testsuite/exclude_libs_test_2.c: Ditto.
10170
10171 2009-05-15  Ian Lance Taylor  <iant@google.com>
10172
10173         * configure.ac: Check for declarations for cases where libiberty.h
10174         checks HAVE_DECL_xxx.
10175         * configure, config.in: Rebuild.
10176
10177 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10178
10179         * gold.h (Incremental_argument_list): Remove (invalid) forward
10180         declaration.
10181         * incremental.cc (Incremental_inputs::report_achive): New method.
10182         (Incremental_inputs::report_object): New method.
10183         (Incremental_inputs::report_script): New method.
10184         (Incremental_inputs::finalize_inputs): New method.
10185         (Incremental_inputs::finalize): Call finalize_inputs().
10186         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10187         Create inputs entries.
10188         * incremental.h (Incremental_input_type): New enum.
10189         (Incremental_inputs::Incremental_input): Initialize new fields.
10190         (Incremental_inputs::report_inputs): New method.
10191         (Incremental_inputs::report_achive): New method.
10192         (Incremental_inputs::report_object): New method.
10193         (Incremental_inputs::report_script): New method.
10194         (Incremental_inputs::finalize_inputs): New method.
10195         (Incremental_inputs::Input_info): New struct.
10196         (Incremental_inputs::Input_info_map): New typedef.
10197         (Incremental_inputs::lock_): New field.
10198         (Incremental_inputs::Inputs_): New field.
10199         (Incremental_inputs::Inputs_map): New field.
10200         * main.cc (main): Call Incremental_input::report_inputs.
10201         * options.h (Input_argument_list): Typedef moved from
10202         Input_arguments.
10203         (Input_file_group::Files): Remove, use ::Input_argument_list.
10204         (Input_file_group::Input_argument_list): Remove, use
10205         ::Input_argument_list.
10206         * plugin.cc (Plugin_manager::add_input_file): Add error in
10207         incremental build.
10208         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10209         functions.
10210         * script.cc (read_input_script): Call
10211         Incremental_input::report_script.
10212         * script.h (Script_info): New class.
10213
10214 2009-04-27  Ian Lance Taylor  <iant@google.com>
10215
10216         * x86_64.cc (do_adjust_output_section): Set entsize to
10217         plt_entry_size.
10218
10219 2009-04-23  Elliott Hughes  <enh@google.com>
10220
10221         * output.cc (Output_file::close): After short writes, continue
10222         writing from the correct offset in the buffer being written.
10223
10224 2009-04-23  Chris Demetriou  <cgd@google.com>
10225
10226         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10227         * configure: Regenerate.
10228         * config.in: Regenerate.
10229         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10230         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10231
10232 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10233
10234         * incremental.cc (Incremental_inputs_header_data): Renamed from
10235         Incremental_input_header_data.
10236         (Incremental_inputs_header_data::data_size): New field.
10237         (Incremental_inputs_header_data::put_input_file_count): Renamed
10238         from input_file_count.
10239         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10240         from command_line_offset.
10241         (Incremental_inputs_header_data::put_reserved): Renamed from
10242         put_reserved.
10243         (Incremental_inputs_entry_data): Renamed from
10244         Incremental_input_entry_data.
10245         (Incremental_inputs_entry_data::data_size): New field.
10246         (Incremental_inputs::report_command_line): New method.
10247         (Incremental_inputs::finalize): New method.
10248         (Incremental_inputs::create_incremental_inputs_data): New method.
10249         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10250         * incremental.h: New file.
10251         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10252        (Layout::finalize): Create incremental inputs section in
10253         incremental builds.
10254        (Layout::create_incremental_info_sections): New method.
10255         * layout.h (Layout::incremental_inputs): New method.
10256        (Layout::create_incremental_info_sections): New method.
10257        (Layout::incremental_inputs_): New field.
10258         * main.cc (main): Notify Incremental_input of the command line.
10259
10260 2009-04-01  Ian Lance Taylor  <iant@google.com>
10261             Mikolaj Zalewski  <mikolajz@google.com>
10262
10263         * gold.h (reserve_unordered_map): Define, three versions, one for
10264         each version of Unordered_map.
10265         * layout.cc (Layout::Layout): Remove options parameter.  Add
10266         number_of_input_files parameter.  Don't initialize options_.
10267         Initialize number_of_input_files_ and resized_signatures_.  Move
10268         sections_are_attached_.
10269         (Layout::layout_group): Reserve space for group_signatures_.
10270         (Layout::find_or_add_kept_section): Change name parameter to be a
10271         reference.  Resize signatures_ map when it gets large enough.
10272         (Layout::layout_eh_frame): Use parameters->options() instead of
10273         this->options_.
10274         (Layout::make_output_section): Likewise.
10275         (Layout::attach_allocated_section_to_segment): Likewise.
10276         (Layout::finalize, Layout::create_executable_stack): Likewise.
10277         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10278         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10279         * layout.h (class Layout): Update declarations.  Remove options_
10280         field.  Add number_of_input_files_ and resized_signatures_
10281         fields.  Move sections_are_attached_ field.
10282         * main.cc (main): Pass number of input files to Layout
10283         constructor.  Don't pass options.
10284
10285 2009-03-30  Ian Lance Taylor  <iant@google.com>
10286
10287         * ffsll.c (ffsll): Correct implementation.
10288
10289 2009-03-27  Ian Lance Taylor  <iant@google.com>
10290
10291         * ffsll.c: New file.
10292         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10293         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10294         * ftruncate.c (ftruncate): Declare before definition.
10295         * mremap.c (mremap): Likewise.
10296         * pread.c (pread): Likewise.
10297         * configure, Makefile.in, config.in: Rebuild.
10298
10299         * mremap.c: New file.
10300         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10301         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10302         (mremap): Declare if HAVE_MREMAP is not defined.
10303         * configure, Makefile.in, config.in: Rebuild.
10304
10305 2009-03-27  Cary Coutant  <ccoutant@google.com>
10306
10307         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10308         position independent.
10309         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10310         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10311
10312 2009-03-24  Cary Coutant  <ccoutant@google.com>
10313
10314         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10315         an executable.
10316         (needs_dynamic_reloc): Likewise.
10317
10318 2009-03-24  Ian Lance Taylor  <iant@google.com>
10319
10320         * yyscript.y (file_cmd): Recognize EXTERN.
10321         (extern_name_list, extern_name_list_body): New nonterminals.
10322         * script.cc (script_add_extern): Define.
10323         * script-c.h (script_add_extern): Declare.
10324
10325 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10326
10327         * object.cc (is_elf_object): Define.
10328         * object.h (is_elf_object): Declare.
10329         * archive.cc (Archive::get_elf_object_for_member): Call
10330         is_elf_object.
10331         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10332
10333 2009-03-24  Elliott Hughes  <enh@google.com>
10334
10335         * output.cc (Output_file::map_anonymous): Define.
10336         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10337         try an anonymous one.  Report the size if the mmap fails.
10338         * output.h (class Output_file): Declare map_anonymous.
10339
10340 2009-03-24  Ian Lance Taylor  <iant@google.com>
10341
10342         * target-select.cc (instantiate_target): Don't acquire the lock if
10343         the instantiated_target_ field has already been set.
10344
10345 2009-03-23  Ian Lance Taylor  <iant@google.com>
10346
10347         * gold-threads.h (class Initialize_lock): Define.
10348         * gold-threads.cc (class Initialize_lock_once): Define.
10349         (initialize_lock_control): New static variable.
10350         (initialize_lock_pointer): New static variable.
10351         (initialize_lock_once): New static function.
10352         (Initialize_lock::Initialize_lock): Define.
10353         (Initialize_lock::initialize): Define.
10354         * target-select.h: Include "gold-threads.h".
10355         (class Target_selector): Add lock_ and initialize_lock_ fields.
10356         Don't define instantiate_target, just declare it.
10357         * target-select.cc (Target_selector::Target_selector): Initialize
10358         new fields.
10359         (Target_selector::instantiate_target): Define.
10360         * descriptors.h: Include "gold-threads.h".
10361         (class Descriptors): Add initialize_lock_ field.
10362         * descriptors.cc (Descriptors::Descriptors): Initialize new
10363         field.
10364         (Descriptors::open): Use initialize_lock_ field
10365         * errors.h (class Errors): Add initialize_lock_ field.
10366         * errors.cc (Errors::Errors): Initialize new field.
10367         (Errors::initialize_lock): Use initialize_lock_ field.
10368         * powerpc.cc (class Target_selector_powerpc): Remove
10369         instantiated_target_ field.  In do_recognize call
10370         instantiate_target rather than do_instantiate_target.  In
10371         do_instantiate_target just allocate a new target.
10372         * sparc.cc (class Target_selector_sparc): Likewise.
10373
10374         * freebsd.h: New file.
10375         * i386.cc: Include "freebsd.h".
10376         (Target_i386): Derive from Target_freebsd rather than
10377         Sized_target.
10378         (Target_selector_i386): Derive from Target_selector_freebsd rather
10379         than Target_selector.
10380         * x86_64.cc: Include "freebsd.h".
10381         (Target_x86_64): Derive from Target_freebsd rather than
10382         Sized_target.
10383         (Target_selector_x86_64): Derive from Target_selector_freebsd
10384         rather than Target_selector.
10385         * target.h (class Target): Add adjust_elf_header and
10386         do_adjust_elf_header.
10387         * output.cc (Output_file_header:: do_sized_write): Call target
10388         adjust_elf_header routine.
10389         * configure.tgt: Set targ_osabi.
10390         * configure.ac: Define GOLD_DEFAULT_OSABI.
10391         * parameters.cc (Parameters::default_target): Pass
10392         GOLD_DEFAULT_OSABI to select_target.
10393         * target-select.h (class Target_selector): Make instantiate_target
10394         protected rather than private.
10395         * Makefile.am (HFILES): Add freebsd.h.
10396         * configure, Makefile.in, config.in: Rebuild.
10397
10398         * merge.cc (do_add_input_section): Correct pend value.  Change
10399         message about last entry not being null terminated from error to
10400         warning.
10401
10402 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10403
10404         * incremental.cc: New file.
10405         * Makefile.am (CCFILES): Add incremental.cc.
10406         * Makefile.in: Rebuild.
10407
10408 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10409
10410         * layout.cc (Layout::output_section_name): Preserve names
10411         of '.note.' sections.
10412
10413 2009-03-19  Ian Lance Taylor  <iant@google.com>
10414
10415         * descriptors.cc (Descriptors::open): Check that the options are
10416         valid before using them.
10417
10418 2009-03-18  Ian Lance Taylor  <iant@google.com>
10419
10420         * script-sections.h: Include <list>.
10421         (class Script_sections): Change Sections_elements from std::vector
10422         to std::list.  Typedef public Elements_iterator.  Add
10423         orphan_section_placement_, data_segment_align_start_, and
10424         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10425         field.
10426         * script-sections.cc (class Orphan_section_placement): New class.
10427         (class Sections_element): Add virtual functions is_relro and
10428         orphan_section_init.  Remove virtual function place_orphan_here.
10429         (class Output_section_definition): Add is_relro and
10430         orphan_section_init.  Remove place_orphan_here.
10431         (class Orphan_output_section): Likewise.
10432         (Script_sections::Script_sections): Update for field changes.
10433         (Script_sections::data_segment_align): Set saw_data_segment_align_
10434         and data_segment_align_start_, not data_segment_align_index.
10435         (Script_sections::data_segment_relro_end): Check
10436         saw_data_segment_align_.  Use data_segment_align_start_ rather
10437         than data_segment_align_index_.
10438         (Script_sections::place_orphan): Rewrite to use
10439         Orphan_section_placement.
10440
10441 2009-03-17  Ian Lance Taylor  <iant@google.com>
10442
10443         * archive.cc (Archive::add_symbols): Check for a version attached
10444         to the symbol name in the archive map.
10445         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10446         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10447         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10448         (ver_test_11.a): New target.
10449         * testsuite/Makefile.in: Rebuild.
10450
10451         * configure.ac: Check for chsize and posix_fallocate.  Replace
10452         ftruncate.
10453         * ftruncate.c: New file, from gnulib.
10454         * output.cc (posix_fallocate): Define dummy version if not
10455         HAVE_POSIX_FALLOCATE.
10456         (Output_file::map): Call posix_fallocate rather than lseek and
10457         write.
10458         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10459         * configure, Makefile.in, config.in: Rebuild.
10460
10461 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10462
10463         * layout.h (Layout::create_note): Add section_name parameter.
10464         * layout.cc (Layout::create_note): Likewise.
10465         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10466
10467 2009-03-17  Ian Lance Taylor  <iant@google.com>
10468
10469         * descriptors.cc: Include "options.h".
10470         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10471         (Descriptors::open): Always use O_CLOEXEC when opening a new
10472         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10473         then set FD_CLOEXEC.
10474
10475         * sparc.cc (class Target_sparc): Add has_got_section.
10476         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10477         make sure we have a GOT section.
10478
10479         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10480         (Target_sparc::Scan::local): Likewise.
10481         (Target_sparc::Scan::global): Likewise.
10482         (Target_sparc::Relocate::relocate): Likewise.
10483         (Target_sparc::Relocate::relocate_tls): Likewise.
10484
10485         * symtab.cc (Symbol_table::define_default_version): New function,
10486         broken out of add_from_object.
10487         (Symbol_table::add_from_object): Call define_default_version.
10488         (Symbol_table::define_special_symbol): Add resolve_oldsym
10489         parameter.  Change all callers.  If the version for a symbol comes
10490         from a version script, resolve it with the symbol with the same
10491         name with no version.  Also add the symbol without a version if
10492         appropriate.
10493         (do_define_in_output_data): If resolving with oldsym, don't delete
10494         sym.
10495         (do_define_in_output_segment): Likewise.
10496         (do_define_as_constant): Likewise.
10497         * symtab.h (class Symbol_table): Update declarations.
10498
10499 2009-03-13  Ian Lance Taylor  <iant@google.com>
10500
10501         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10502         (Read_symbols::requeue): New function.
10503         (Read_symbols::do_read_symbols): If make_elf_object fails because
10504         the target type is not configured, and the file was searched for,
10505         issue a warning and retry with the next directory.
10506         (Add_symbols::run): If the file has an incompatible format, and
10507         it was searched for, requeue the Read_symbols task.  On error,
10508         release the object.
10509         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10510         dirindex parameter to constructor.  Change all callers.  Declare
10511         incompatible_warning and requeue.
10512         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10513         input_argument_ and input_group_ fields.  Add them to
10514         constructor.  Change all callers.
10515         (class Read_script): Add dirindex_ field.  Add it to constructor.
10516         Change all callers.
10517         * archive.cc (Archive::setup): Remove input_objects parameter.
10518         Change all callers.
10519         (Archive::get_file_and_offset): Likewise.
10520         (Archive::read_all_symbols): Likewise.
10521         (Archive::read_symbols): Likewise.
10522         (Archive::get_elf_object_for_member): Remove input_objects
10523         parameter.  Add punconfigured parameter.  Change all callers.
10524         (Archive::add_symbols): Change return type to bool.  Check return
10525         value of include_member.
10526         (Archive::include_all_members): Likewise.
10527         (Archive::include_member): Change return type to bool.  Return
10528         false if first included object has incompatible target.  Set
10529         included_member_ field.
10530         (Add_archive_symbols::run): If add_symbols returns false, requeue
10531         Read_symbols task.
10532         * archive.h (class Archive): Add included_member_ field.
10533         Initialize it in constructor.  Add input_file and searched_for
10534         methods.  Update declarations.
10535         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10536         input_argument_ fields.  Add them to constructor.  Change all
10537         callers.
10538         * script.cc: Include "target-select.h".
10539         (class Parser_closure): Add skip_on_incompatible_target_ and
10540         found_incompatible_target_ fields.  Add
10541         skip_on_incompatible_target parameter to constructor.  Change all
10542         callers.  Add methods skip_on_incompatible_target,
10543         clear_skip_on_incompatible_target, found_incompatible_target, and
10544         set_found_incompatible_target.
10545         (read_input_script): Add dirindex parameter.  Change all callers.
10546         If parser finds an incompatible target, requeue Read_symbols
10547         task.
10548         (script_set_symbol): Clear skip_on_incompatible_target in
10549         closure.
10550         (script_add_assertion, script_parse_option): Likewise.
10551         (script_start_sections, script_add_phdr): Likewise.
10552         (script_check_output_format): New function.
10553         * script.h (read_input_script): Update declaration.
10554         * script-c.h (script_check_output_format): Declare.
10555         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10556         (ignore_cmd): Remove OUTPUT_FORMAT.
10557         * fileread.cc (Input_file::Input_file): Add explicit this.
10558         (Input_file::will_search_for): New function.
10559         (Input_file::open): Add pindex parameter.  Change all callers.
10560         * fileread.h (class Input_file): Add input_file_argument method.
10561         Declare will_search_for.  Update declarations.
10562         * object.cc (make_elf_object): Add punconfigured parameter.
10563         Change all callers.
10564         * object.h (class Object): Make input_file public.  Add
10565         searched_for method.
10566         (make_elf_object): Update declaration.
10567         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10568         restart search.
10569         * dirsearch.h (class Dirsearch): Update declaration.
10570         * options.h (class General_options): Add --warn-search-mismatch.
10571         * parameters.cc (Parameters::is_compatible_target): New function.
10572         * parameters.h (class Parameters): Declare is_compatible_target.
10573         * workqueue.cc (Workqueue::add_blocker): New function.
10574         * workqueue.h (class Workqueue): Declare add_blocker.
10575
10576         * fileread.cc (Input_file::open): Remove options parameter.
10577         Change all callers.
10578         (Input_file::open_binary): Likewise.
10579         * script.cc (read_input_script): Likewise.
10580         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10581         options parameter from constructor.  Change all callers.
10582         (class Read_script): Likewise.
10583         * fileread.h (class Input_file): Update declarations.
10584         * script.h (read_input_script): Update declaration.
10585
10586 2009-03-10  Nick Clifton  <nickc@redhat.com>
10587
10588         * po/es.po: New Spanish translation.
10589
10590 2009-03-06  Cary Coutant  <ccoutant@google.com>
10591
10592         * options.cc (parse_short_option): Keep dash_z from registering itself.
10593
10594 2009-03-03  Ian Lance Taylor  <iant@google.com>
10595
10596         PR 9918
10597         * target-reloc.h (relocate_section): Pass output_section to
10598         relocate.
10599         * i386.cc (Target_i386::should_apply_static_reloc): Add
10600         output_section parameter.  Change all callers.
10601         (Target_i386::Relocate::relocate): Add output_section parameter.
10602         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10603         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10604         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10605         * testsuite/two_file_shared.sh: New script.
10606         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10607         (check_DATA): Add two_file_shared.dbg.
10608         (two_file_shared.dbg): New target.
10609         * testsuite/Makefile.in: Rebuild.
10610
10611 2009-03-01  Ian Lance Taylor  <iant@google.com>
10612
10613         * configure.ac: Check for byteswap.h.
10614         * configure: Rebuild.
10615         * config.in: Rebuild.
10616
10617 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10618
10619         * layout.cc (Layout::find_or_add_kept_section): New function.
10620         (Layout::add_comdat): Removed.
10621         * layout.h (struct Kept_section): Move out of class Layout.
10622         Remove trailing underscores from field names.  Add group_sections
10623         field.  Rename group_ field to is_group.  Change all uses.
10624         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10625         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10626         comdat_groups_ field.
10627         (Sized_relobj::include_section_group): Use
10628         find_or_add_kept_section and Kept_section::group_sections.
10629         (Sized_relobj::include_linkonce_section): Likewise.
10630         * object.cc (class Sized_relobj): Don't define Comdat_group or
10631         Comdat_group_table.  Remove find_comdat_group and
10632         add_comdat_group.  Remove comdat_groups_ field.
10633         * plugin.cc (include_comdat_group): Use
10634         Layout::find_or_add_kept_section.
10635
10636 2009-02-28  Ian Lance Taylor  <iant@google.com>
10637
10638         * README: --gc-sections and map files are now supported.  Document
10639         some build requirements.
10640
10641         PR 6992
10642         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10643         relocatable link set the value of the section symbol to zero.
10644         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10645         relocatable link don't include the section address in the local
10646         symbol value.
10647
10648 2009-02-27  Ian Lance Taylor  <iant@google.com>
10649
10650         PR 6811
10651         * options.h (class Search_directory): Add is_system_directory.
10652         (class General_options): Declare is_in_system_directory.
10653         * options.cc (get_relative_sysroot): Make static.
10654         (get_default_sysroot): Make static.
10655         (General_optoins::is_in_system_directory): New function.
10656         * fileread.cc (Input_file::is_in_system_directory): New function.
10657         * fileread.h (class Input_file): Declare is_in_system_directory.
10658         * object.h (class Object): Add is_in_system_directory.
10659         (class Input_objects): Remove system_library_directory_ field.
10660         * object.cc (Input_objects::add_object): Don't set
10661         system_library_directory_.
10662         (input_objects::found_in_system_library_directory): Remove.
10663         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10664         parameter.  Change all callers.
10665         (Symbol_table::sized_write_globals): Likewise.
10666         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10667         Call Object::is_in_system_directory.
10668         * symtab.h (class Symbol_table): Update declarations.
10669
10670         PR 5990
10671         * descriptors.h (Open_descriptor): Add is_on_stack field.
10672         * descriptors.cc (Descriptors::open): If the descriptor is on the
10673         top of the stack, remove it.  Initialize is_on_stack field.
10674         (Descriptors::release): Only add pod to stack if it is not on the
10675         stack already.
10676         (Descriptors::close_some_descriptor): Clear stack_next and
10677         is_on_stack fields.
10678
10679         PR 7091
10680         * output.cc (Output_section::find_starting_output_address): Rename
10681         from starting_output_address; add PADDR parameter; change return
10682         type.
10683         * output.h (class Output_section): Declare
10684         find_starting_output_address instead of starting_output_address.
10685         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10686         section symbol for which we can't find a merge section.
10687
10688         PR 9836
10689         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10690         hidden or internal, force the symbol to be local.
10691         * resolve.cc (Symbol::override_visibility): Define.
10692         (Symbol::override_base): Use override_visibility.
10693         (Symbol_table::resolve): Likewise.
10694         (Symbol::override_base_with_special): Likewise.
10695         (Symbol_table::override_with_special): If the visibility is hidden
10696         or internal, force the symbol to be local.
10697         * symtab.h (class Symbol): Add set_visibility and
10698         override_visibility.
10699         * testsuite/ver_test_1.sh: New file.
10700         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10701         (check_DATA): Add ver_test_1.syms.
10702         (ver_test_1.syms): New target.
10703         * testsuite/Makefile.in: Rebuild.
10704
10705 2009-02-25  Cary Coutant  <ccoutant@google.com>
10706
10707         * layout.cc (Layout::choose_output_section): Don't rename sections
10708         when using a linker script that has a SECTIONS clause.
10709         * Makefile.in: Regenerate.
10710
10711         * testsuite/Makefile.am (script_test_5.sh): New test case.
10712         * testsuite/Makefile.in: Regenerate.
10713         * testsuite/script_test_5.cc: New file.
10714         * testsuite/script_test_5.sh: New file.
10715         * testsuite/script_test_5.t: New file.
10716
10717 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10718
10719         * archive.cc (Archive::include_member): Update calls to add_symbols.
10720         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10721         the Layout argument.
10722         * dynobj.h (do_add_symbols): Add the Layout argument.
10723         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10724         Layout argument.
10725         * object.h (Object::add_symbols): Add the Layout argument.
10726         (Object::do_add_symbols): Add the Layout argument.
10727         (Sized_relobj::do_add_symbols): Add the Layout argument.
10728         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10729         Unify the two versions.
10730         (Add_plugin_symbols): Remove.
10731         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10732         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10733         (Add_plugin_symbols): Remove.
10734         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
10735         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
10736         (Add_symbols::run): Make it work with Pulginobj.
10737
10738 2009-02-06  Ian Lance Taylor  <iant@google.com>
10739
10740         * object.cc (Sized_relobj::do_layout): Make info message start
10741         with lower case letter.
10742
10743 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
10744
10745         * binary.cc: Fix file comment.
10746
10747         * options.h (enum Incremental_disposition): Define.
10748         (class General_options): Add new options: --incremental,
10749         --incremental_changed, --incremental_unchanged,
10750         --incremental_unknown.  Add incremental_disposition_ and
10751         implicit_incremental_ fields.
10752         (General_options::incremental_disposition): New function.
10753         (class Position_dependent_options): Add incremental_disposition
10754         option.
10755         (Position_dependent_options::copy_from_options): Set incremental
10756         dispositions.
10757         * options.cc (General_options::parse_incremental_changed): New
10758         function.
10759         (General_options::parse_incremental_unchanged): New function.
10760         (General_options::parse_incremental_unknown): New function.
10761         (General_options::General_options): Initialize new fields
10762         incremental_disposition_ and implicit_incremental_.
10763         (General_options::finalize): Check for uasge of --incremental-*
10764         without --incremental.
10765
10766 2009-02-06  Chris Demetriou  <cgd@google.com>
10767
10768         * gold.h (gold_undefined_symbol): Change to take only a Symbol
10769         pointer and to report location as the file name associated with
10770         the symbol.
10771         (gold_undefined_symbol_at_location): New function to replace the
10772         old gold_undefined_symbol functionality.
10773         * target-reloc.h (relocate_section): Update to use
10774         gold_undefined_symbol_at_location.
10775         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
10776         Call gold_undefined_symbol function rather than gold_error.
10777         * errors.h (Errors::undefined_symbol): Take location as a
10778         string, rather than calculating it from a relocation.
10779         * errors.cc (Errors::fatal): Print "fatal error:" before the
10780         formatted message.
10781         (Errors::error, Errors::error_at_location): Print "error: "
10782         before the formatted message.
10783         (Errors::undefined_symbol): Take location as a string, rather
10784         than calculating it from a relocation.
10785         (gold_undefined_symbol_at_location): New function akin to
10786         old gold_undefined_symbol, calculates location from relocation.
10787         (gold_undefined_symbol): Change to take only a Symbol pointer
10788         and to report location as the file name associated with the symbol.
10789         * testsuite/debug_msg.sh: Update for changed error messages.
10790         * testsuite/undef_symbol.sh: Likewise.
10791
10792 2009-02-04  Duncan Sands  <baldrick@free.fr>
10793
10794         PR 9812
10795         * reduced_debug_output.h
10796         (Output_reduced_debug_abbrev_section::failed): Use format for
10797         gold_warning.
10798         (Output_reduced_debug_info_section::faild): Likewise.
10799
10800 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
10801
10802         * script.cc (Lazy_demangler): New class.
10803         (Version_script_info::get_symbol_version_helper): Demangle a
10804         symbol only once.
10805
10806 2009-01-29  Cary Coutant  <ccoutant@google.com>
10807
10808         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
10809         to __tls_get_addr.
10810         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10811
10812 2009-01-28  Ian Lance Taylor  <iant@google.com>
10813
10814         * version.cc (version_string): Bump to 1.9.
10815
10816         * gold.h: Include <cstring> and <stdint.h>.
10817         * version.cc: Include <cstdio>.
10818         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
10819         warning.
10820         * reduced_debug_output.cc (insert_into_vector): Rename from
10821         Insert_into_vector; change all callers.  Use Swap_unaligned to
10822         avoid aliasing issue; remove union since it is unnecessary.
10823
10824 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
10825
10826         * Makefile.am (CCFILES): Add gc.cc.
10827         (HFILES): Add gc.h.
10828         * Makefile.in: Regenerate.
10829         * gold.cc (Gc_runner): New class.
10830         (queue_initial_tasks): Call garbage collection related tasks
10831         when corresponding options are invoked.
10832         (queue_middle_gc_tasks): New function.
10833         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
10834         processed early before laying out sections during garbage collection.
10835         * gold.h (queue_middle_gc_tasks): New function.
10836         (is_prefix_of): Move from "layout.cc".
10837         * i386.cc (Target_i386::gc_process_relocs): New function.
10838         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
10839         * main.cc (main): Create object of class "Garbage_collection".
10840         * object.cc (Relobj::copy_symbols_data): New function.
10841         (Relobj::is_section_name_included): New function.
10842         (Sized_relobj::do_layout): Allow this function to be called twice
10843         during garbage collection and defer layout of section during the
10844         first call.
10845         * object.h (Relobj::get_symbols_data): New function.
10846         (Relobj::is_section_name_included): New function.
10847         (Relobj::copy_symbols_data): New function.
10848         (Relobj::set_symbols_data): New function.
10849         (Relobj::get_relocs_data): New function.
10850         (Relobj::set_relocs_data): New function.
10851         (Relobj::is_output_section_offset_invalid): New pure virtual function.
10852         (Relobj::gc_process_relocs): New function.
10853         (Relobj::do_gc_process_relocs): New pure virtual function.
10854         (Relobj::sd_): New data member.
10855         (Sized_relobj::is_output_section_offset_invalid): New function.
10856         (Sized_relobj::do_gc_process_relocs): New function.
10857         * options.h (General_options::gc_sections): Modify to not be a no-op.
10858         (General_options::print_gc_sections): New option.
10859         * plugin.cc (Plugin_finish::run): Remove function call to
10860         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
10861         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
10862         * reloc.cc (Read_relocs::run): Add task to process relocs and
10863         determine unreferenced sections when doing garbage collection.
10864         (Gc_process_relocs): New class.
10865         (Sized_relobj::do_gc_process_relocs): New function.
10866         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
10867         sections that are garbage collected.
10868         * reloc.h (Gc_process_relocs): New class.
10869         * sparc.cc (Target_sparc::gc_process_relocs): New function.
10870         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
10871         symbols whose corresponding sections are garbage collected.
10872         (Symbol_table::Symbol_table): Add new parameter for the garbage
10873         collection object.
10874         (Symbol_table::gc_mark_undef_symbols): New function.
10875         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10876         (Symbol_table::gc_mark_dyn_syms): New function.
10877         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
10878         as garbage.
10879         (Symbol_table::add_from_object): Likewise.
10880         (Symbol_table::add_from_relobj): When building shared objects, do not
10881         treat externally visible symbols as garbage.
10882         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
10883         table information for static and relocatable links.
10884         * symtab.h (Symbol_table::set_gc): New function.
10885         (Symbol_table::gc): New function.
10886         (Symbol_table::gc_mark_undef_symbols): New function.
10887         (Symbol_table::gc_mark_symbol_for_shlib): New function.
10888         (Symbol_table::gc_mark_dyn_syms): New function.
10889         (Symbol_table::gc_): New data member.
10890         * target.h (Sized_target::gc_process_relocs): New pure virtual
10891         function.
10892         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
10893         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
10894
10895 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
10896
10897         * options.h (General_options::gc_sections): Define as a no-op for now.
10898         (General_options::no_keep_memory): Ditto.
10899         (General_options::Bshareable): Define.
10900         * options.cc (General_options::finalize): Honor -Bshareable.
10901
10902 2009-01-20  Andreas Schwab  <schwab@suse.de>
10903
10904         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
10905         read the value in the contents, since we don't use it.  Use the
10906         template endianness when writing.
10907         (Relocate::relocate): Use it for R_PPC_REL16_HA.
10908
10909 2009-01-19  Andreas Schwab  <schwab@suse.de>
10910
10911         * configure.tgt (powerpc64-*): Fix targ_obj.
10912
10913 2009-01-15  Ian Lance Taylor  <iant@google.com>
10914
10915         * object.cc (Sized_relobj::write_local_symbols): Don't write out
10916         local symbols when stripping all symbols.
10917
10918 2009-01-14  Cary Coutant  <ccoutant@google.com>
10919
10920         * output.cc (Output_reloc): Add explicit instantiations.
10921
10922 2009-01-14  Cary Coutant  <ccoutant@google.com>
10923
10924         * archive.cc (Archive::get_elf_object_for_member): Remove call
10925         to File_read::claim_for_plugin.
10926         * descriptors.cc (Descriptors::open): Remove reference to
10927         is_claimed.
10928         (Descriptors::claim_for_plugin): Remove.
10929         * descriptors.h (Descriptors::claim_for_plugin): Remove.
10930         (Descriptors::is_claimed): Remove.
10931         (claim_descriptor_for_plugin): Remove.
10932         * fileread.cc (File_read::claim_for_plugin): Remove.
10933         * fileread.h (File_read::claim_for_plugin): Remove.
10934         (File_read::descriptor): Reopen descriptor if necessary.
10935         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
10936         (Plugin_manager::all_symbols_read): Add task parameter. Change
10937         all callers.
10938         (Plugin_manager::get_input_file): New function.
10939         (Plugin_manager::release_input_file): New function.
10940         (Pluginobj::Pluginobj): Add filesize parameter and initialize
10941         corresponding data member.
10942         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
10943         and pass to base constructor. Change all callers.
10944         (get_input_file, release_input_file): New functions.
10945         (make_sized_plugin_object): Add filesize parameter. Change all callers.
10946         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
10947         (Plugin_manager::all_symbols_read): Add task parameter.
10948         (Plugin_manager::get_input_file): New function.
10949         (Plugin_manager::release_input_file): New function.
10950         (Plugin_manager::task_): New data member.
10951         (Pluginobj::Pluginobj): Add filesize parameter.
10952         (Pluginobj::filename): New function.
10953         (Pluginobj::descriptor): New function.
10954         (Pluginobj::filesize): New function.
10955         (Pluginobj::filesize_): New data member.
10956         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
10957         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
10958         File_read::claim_for_plugin; use Object::unlock to unlock the file.
10959
10960         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
10961         with archive libraries.
10962         * testsuite/Makefile.in: Regenerate.
10963         * testsuite/plugin_test.c (struct sym_info): New type.
10964         (get_input_file, release_input_file): New static variables.
10965         (onload): Capture new transfer vector entries.
10966         (claim_file_hook): Stop reading at end of file according to filesize.
10967         Factor out parsing of readelf output into separate function.
10968         (all_symbols_read_hook): Exercise get_input_file and release_input_file
10969         APIs and get the source file name from the symbol table.  Convert
10970         source file name to corresponding object file name.  Print info
10971         message when adding new input files.
10972         (parse_readelf_line): New function.
10973         * testsuite/plugin_test_1.sh: Add checks for new info messages.
10974         * testsuite/plugin_test_2.sh: Likewise.
10975         * testsuite/plugin_test_3.sh: Likewise.
10976         * testsuite/plugin_test_4.sh: New test case.
10977
10978 2009-01-07  Ian Lance Taylor  <iant@google.com>
10979
10980         * version.cc (version_string): Bump to 1.8.
10981
10982 2008-12-23  Cary Coutant  <ccoutant@google.com>
10983
10984         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
10985         * plugin.cc (Plugin_manager::finish): Rename as
10986         layout_deferred_objects.  Move cleanup to separate function.
10987         (Plugin_manager::cleanup): New function.
10988         (Plugin_finish::run): Call layout_deferred_objects and cleanup
10989         separately.
10990         * plugin.h (Plugin_manager::finish): Rename as
10991         layout_deferred_objects.
10992         (Plugin_manager::cleanup): New function.
10993         (Plugin_manager::cleanup_done): New field.
10994
10995 2008-12-23  Cary Coutant  <ccoutant@google.com>
10996
10997         * plugin.cc (is_visible_from_outside): New function.
10998         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
10999         so we don't return "IR only" status for exported symbols or -r links.
11000
11001         * testsuite/Makefile.am (plugin_test_3): New test case.
11002         * testsuite/Makefile.in: Regenerate.
11003         * testsuite/plugin_test_3.sh: New file.
11004
11005 2008-12-22  Cary Coutant  <ccoutant@google.com>
11006
11007         * object.cc (Sized_relobj::layout_section): New function.
11008         (Sized_relobj::do_layout): Defer layout of input sections until after
11009         plugin has provided replacement files.
11010         (Sized_relobj::do_layout_deferred_sections): New function.
11011         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11012         (Relobj::layout_deferred_sections): New function.
11013         (Relobj::do_layout_deferred_sections): New function.
11014         (Sized_relobj::do_layout_deferred_sections): New function.
11015         (Sized_relobj::layout_section): New function.
11016         (Sized_relobj::Deferred_layout): New structure.
11017         (Sized_relobj::deferred_layout_): New field.
11018         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11019         Change all callers.  Layout deferred sections.
11020         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11021         references.
11022         (Plugin_hook::run): Move code from do_plugin_hook inline.
11023         (Plugin_hook::do_plugin_hook): Remove.
11024         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11025         (Plugin_manager::finish): Renamed, was cleanup.
11026         (Plugin_manager::should_defer_layout): New function.
11027         (Plugin_manager::add_deferred_layout_object): New function.
11028         (Plugin_manager::Deferred_layout_list): New type.
11029         (Plugin_manager::deferred_layout_objects_): New field.
11030         (Plugin_hook::do_plugin_hook): Remove.
11031
11032 2008-12-17  Ian Lance Taylor  <iant@google.com>
11033
11034         * options.h (class General_options): Add --no case for
11035         --export-dynamic.
11036
11037 2008-12-16  Cary Coutant  <ccoutant@google.com>
11038
11039         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11040         vector.
11041         (Plugin_manager::claim_file): Create plugin object even if
11042         plugin did not call the add_symbols callback.
11043         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11044         asking for more symbols than were added.
11045         * testsuite/Makefile.am (plugin_test_1): Add test case with
11046         no global symbols.
11047         (empty.syms): New target.
11048         * testsuite/Makefile.in: Regenerate.
11049         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11050         message. Don't call add_symbols if no globals.
11051         (all_symbols_read_hook): Don't provide replacement for empty
11052         claimed file.
11053
11054 2008-12-12  Ian Lance Taylor  <iant@google.com>
11055
11056         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11057         r_type == 0 for a local symbol with r_sym == 0.
11058         (scan_relocatable_relocs): Pass r_sym to
11059         local_non_section_strategy.
11060         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11061         r_sym parameter.
11062
11063         * configure.ac: Update test for TLS descriptors: they are
11064         supported as of glibc 2.9.
11065         * configure: Rebuild.
11066
11067 2008-12-11  Ian Lance Taylor  <iant@google.com>
11068
11069         PR 7091
11070         * target-reloc.h (Default_scan_relocatable_relocs): For each
11071         function, map r_type == 0 to RELOC_DISCARD.
11072
11073 2008-12-10  Cary Coutant  <ccoutant@google.com>
11074
11075         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11076         object to override a kept COMDAT group from a plugin object.
11077
11078 2008-12-09  Ian Lance Taylor  <iant@google.com>
11079
11080         PR 7088
11081         * yyscript.y (file_cmd): Handle INPUT.
11082
11083         * testsuite/initpri1.c: Change all declarations to be full
11084         prototypes by adding void, to avoid compiler warnings.
11085
11086 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11087
11088         * options.cc (General_options::parse_plugin_opt): New.
11089         (General_options::add_plugin): The argument now is just the filename.
11090         (General_options::add_plugin_option): New.
11091         * options.h (plugin_opt): New.
11092         (add_plugin): Change argument name.
11093         (add_plugin_option): New.
11094         * plugin.cc (Plugin::load): Don't parse the plugin option.
11095         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11096         (Plugin::add_option): New.
11097         (Plugin::args_): Change type.
11098         (Plugin::filename_): New.
11099         (Plugin_manager::add_plugin_option): New.
11100         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11101         * testsuite/Makefile.in: Regenerate.
11102
11103 2008-12-05  Cary Coutant  <ccoutant@google.com>
11104
11105         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11106         Handle --strip-lto-sections option.
11107         * options.h (strip_lto_sections): New option.
11108
11109 2008-12-01  Cary Coutant  <ccoutant@google.com>
11110
11111         * plugin.cc (ld_plugin_message): Change format parameter to const.
11112         Fix mismatch between new[] and delete.
11113
11114 2008-11-14  Cary Coutant  <ccoutant@google.com>
11115
11116         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11117         instead of -1U.
11118
11119 2008-11-05  Craig Silverstein  <csilvers@google.com>
11120
11121         * options.cc (General_options::parse_dynamic_list): New function.
11122         * options.h (General_options): New flags dynamic_list,
11123         dynamic_list_data, dynamic_list_cpp_new, and
11124         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11125         (General_options::in_dynamic_list): New function.
11126         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11127         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11128         (Lex::can_continue_name): Likewise.
11129         (yylex): Likewise.
11130         (read_script_file): New parameter script_options.
11131         (read_dynamic_list): New function.
11132         (Script_options::define_dynamic_list): New function.
11133         (dynamic_list_keyword_parsecodes): New variable.
11134         (dynamic_list_keywords): New variable.
11135         * script.h (Script_options::define_dynamic_list): New function
11136         prototype.
11137         (read_dynamic_list): New function prototype.
11138         * symtab.cc (strprefix): New macro.
11139         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11140         dynamic_list_data, dynamic_list_cpp_new, and
11141         dynamic_list_cpp_typeinfo.
11142         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11143         (dynamic_list_expr): New rule.
11144         (dynamic_list_nodes): Likewise.
11145         (dynamic_list_node): Likewise.
11146         * testsuite/Makefile.am (dynamic_list): New test.
11147         * testsuite/Makefile.in: Regenerated.
11148         * testsuite/dynamic_list.t: New file.
11149         * testsuite/dynamic_list.sh: New file.
11150
11151 2008-11-05  Craig Silverstein  <csilvers@google.com>
11152
11153         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11154         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11155         (t11_last): Likewise.
11156         * testsuite/ver_test_6.c (main): Likewise.
11157
11158 2008-10-07  Cary Coutant  <ccoutant@google.com>
11159
11160         * options.c (General_options::finalize): Add check for -static and
11161         -shared.
11162         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11163         is not empty.
11164
11165 2008-10-02  Cary Coutant  <ccoutant@google.com>
11166
11167         * plugin.cc (make_sized_plugin_object): Fix conditional
11168         compilation to work when not all targets are enabled.
11169
11170 2008-09-29  Cary Coutant  <ccoutant@google.com>
11171
11172         * archive.cc (Archive::get_file_and_offset): Use filename instead
11173         of name to get library path.
11174         (Archive::include_member): Unlock external member of a thin archive.
11175
11176         * testsuite/Makefile.am (TEST_AR): New variable.
11177         (thin_archive_test_1): New test.
11178         (thin_archive_test_2): New test.
11179         * testsuite/Makefile.in: Regenerate.
11180         * testsuite/thin_archive_main.cc: New file.
11181         * testsuite/thin_archive_test_1.cc: New file.
11182         * testsuite/thin_archive_test_2.cc: New file.
11183         * testsuite/thin_archive_test_3.cc: New file.
11184         * testsuite/thin_archive_test_4.cc: New file.
11185
11186 2008-09-29  Cary Coutant  <ccoutant@google.com>
11187
11188         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11189         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11190         instead of -1U.
11191         (Sized_relobj::do_finalize_local_symbols): Likewise.
11192         (Sized_relobj::map_to_kept_section): Likewise.
11193         * object.h (Sized_relobj::invalid_address): New constant.
11194         (Sized_relobj::do_output_section_offset): Check for invalid_address
11195         and return -1ULL.
11196         * output.cc (Output_reloc::local_section_offset): Use constant
11197         invalid_address instead of -1U.
11198         (Output_reloc::get_address): Likewise.
11199         (Output_section::output_address): Change -1U to -1ULL.
11200         * output.h (Output_reloc::invalid_address): New constant.
11201         * reloc.cc (Sized_relobj::write_sections): Use constant
11202         invalid_address instead of -1U.
11203         (Sized_relobj::relocate_sections): Likewise.
11204         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11205         values for merge sections.
11206         * target-reloc.h (relocate_for_relocatable): Use constant
11207         invalid_address instead of -1U.
11208
11209 2008-09-19  Cary Coutant  <ccoutant@google.com>
11210
11211         Add plugin functionality for link-time optimization (LTO).
11212         * configure.ac (plugins): Add --enable-plugins option.
11213         * configure: Regenerate.
11214         * config.in: Regenerate.
11215         * Makefile.am (LIBDL): New variable.
11216         (CCFILES): Add plugin.cc.
11217         (HFILES): Add plugin.h.
11218         (ldadd_var): Add LIBDL.
11219         * Makefile.in: Regenerate.
11220
11221         * archive.cc: Include "plugin.h".
11222         (Archive::setup): Don't preread archive symbols when using a plugin.
11223         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11224         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11225         files.
11226         (Archive::include_member): Add symbols from plugin objects.
11227         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11228         * descriptors.cc (Descriptors::open): Check for file descriptors
11229         abandoned by plugins.
11230         (Descriptors::claim_for_plugin): New function.
11231         * descriptors.h (Descriptors::claim_for_plugin): New function.
11232         (Open_descriptor::is_claimed): New field.
11233         (claim_descriptor_for_plugin): New function.
11234         * fileread.cc (File_read::claim_for_plugin): New function.
11235         * fileread.h (File_read::claim_for_plugin): New function.
11236         (File_read::descriptor): New function.
11237         * gold.cc: Include "plugin.h".
11238         (queue_initial_tasks): Add task to call plugin hooks for generating
11239         new object files.
11240         * main.cc: Include "plugin.h".
11241         (main): Load plugin libraries.
11242         * object.h (Pluginobj): Declare.
11243         (Object::pluginobj): New function.
11244         (Object::do_pluginobj): New function.
11245         (Object::set_target): New function.
11246         * options.cc: Include "plugin.h".
11247         (General_options::parse_plugin): New function.
11248         (General_options::General_options): Initialize plugins_ field.
11249         (General_options::add_plugin): New function.
11250         * options.h (Plugin_manager): Declare.
11251         (General_options): Add --plugin option.
11252         (General_options::has_plugins): New function.
11253         (General_options::plugins): New function.
11254         (General_options::add_plugin): New function.
11255         (General_options::plugins_): New field.
11256         * plugin.cc: New file.
11257         * plugin.h: New file.
11258         * readsyms.cc: Include "plugin.h".
11259         (Read_symbols::do_read_symbols): Check for archive before checking
11260         for ELF file.  Call plugin hooks to claim files.
11261         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11262         from a real object file; force override when processing replacement
11263         files.
11264         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11265         (Symbol::init_base_object): Likewise.
11266         (Symbol::init_base_output_data): Likewise.
11267         (Symbol::init_base_output_segment): Likewise.
11268         (Symbol::init_base_constant): Likewise.
11269         (Symbol::init_base_undefined): Likewise.
11270         (Symbol::output_section): Assert that object is not a plugin.
11271         (Symbol_table::add_from_pluginobj): New function.
11272         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11273         undefined.
11274         (Symbol_table::sized_write_globals): Likewise.
11275         (Symbol_table::add_from_pluginobj): Instantiate template.
11276         * symtab.h (Sized_pluginobj): Declare.
11277         (Symbol::in_real_elf): New function.
11278         (Symbol::set_in_real_elf): New function.
11279         (Symbol::in_real_elf_): New field.
11280         (Symbol_table::add_from_pluginobj): New function.
11281
11282         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11283         (LIBDL): New variable.
11284         (LDADD): Add LIBDL.
11285         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11286         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11287         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11288         (MOSTLYCLEANFILES): Likewise.
11289         * testsuite/Makefile.in: Regenerate.
11290         * testsuite/plugin_test.c: New file.
11291         * testsuite/plugin_test_1.sh: New file.
11292         * testsuite/plugin_test_2.sh: New file.
11293
11294 2008-09-16  Ian Lance Taylor  <iant@google.com>
11295
11296         * target-reloc.h (relocate_section): Check whether a symbol is
11297         defined by the ABI before reporting an undefined symbol error.
11298         * target.h (Target::is_defined_by_abi): Make parameter const.
11299         (Target::do_is_defined_by_abi): Likewise.
11300         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11301         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11302         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11303         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11304         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11305         * testsuite/Makefile.in: Rebuild.
11306
11307         * fileread.cc (make_view): Add casts to avoid warning.
11308
11309 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11310
11311         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11312         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11313
11314 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11315
11316         * options.h (General_options::output_is_executable): New.
11317         (General_options::output_is_pie): New.
11318         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11319         for shared libraries.
11320         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11321
11322 2008-09-11  Chris Demetriou  <cgd@google.com>
11323
11324         * options.h (origin): New -z option.
11325         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11326         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11327         in DT_FLAGS_1.
11328
11329 2008-09-05  Cary Coutant  <ccoutant@google.com>
11330
11331         * fileread.cc (File_read::make_view): Add check for attempt to map
11332         beyond end of file.
11333
11334 2008-09-05  Cary Coutant  <ccoutant@google.com>
11335
11336         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11337         explicit instantiations.
11338
11339 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11340
11341         PR gold/6858
11342         * options.cc (General_options::finalize): Allow undefined symbols
11343         in shlibs if linking -shared.
11344
11345         PR gold/6859
11346         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11347         symbols as not needing a dynsym entry.
11348
11349 2008-08-20  Craig Silverstein  <csilvers@google.com>
11350
11351         * fileread.cc (File_read::open): Do not lock the file unless it
11352         was successfully opened.
11353
11354 2008-08-14  Cary Coutant  <ccoutant@google.com>
11355
11356         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11357         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11358         * testsuite/tls_test.cc (struct int128): 128-bit struct
11359         for testing TLS relocs with non-zero addend.
11360         (v12): New TLS variable.
11361         (t12): New test.
11362         (t_last): Add check for v12.
11363         * testsuite/tls_test.h (t12): New function.
11364         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11365
11366 2008-08-13  Ian Lance Taylor  <iant@google.com>
11367
11368         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11369         set tls_segment_ or relro_segment_.
11370         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11371         when appropriate.
11372         * output.h (Output_section::clear_is_relro): New function.
11373         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11374         sections specially even when output_data_ is empty.
11375         (Output_segment::maximum_alignment): When first section is relro,
11376         only force alignment for PT_LOAD segments.
11377         * script.cc (script_data_segment_align): New function.
11378         (script_data_segment_relro_end): New function.
11379         * script-c.h (script_data_segment_align): Declare.
11380         (script_data_segment_relro_end): Declare.
11381         * script-sections.h (class Script_sections): Declare
11382         data_segment_align and data_segment_relro_end.  Add fields
11383         segment_align_index_ and saw_relro_end_.
11384         * script-sections.cc (class Sections_element): Add set_is_relro
11385         virtual function.  Add new bool* parameter to place_orphan_here.
11386         Add get_output_section virtual function.
11387         (class Output_section_definition): Add set_is_relro.  Add new
11388         bool* parameter to place_orphan_here.  Add get_output_section.
11389         Add is_relro_ field.
11390         (Output_section_definition::Output_section_definition): Initialize
11391         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11392         and is_relro_ fields.
11393         (Output_section_definition::place_orphan_here): Add is_relro
11394         parameter.
11395         (Output_section_definition::set_section_addresses): Set relro for
11396         output section.
11397         (Output_section_definition::alternate_constraint): Likewise.
11398         (class Orphan_output_section): Add new bool* parameter to
11399         place_orphan_here.  Add get_output_section.
11400         (Orphan_output_section::place_orphan_here): Add is_relro
11401         parameter.
11402         (Script_sections::Script_sections): Initialize
11403         data_segment_align_index_ and saw_relro_end_.
11404         (Script_sections::data_segment_align): New function.
11405         (Script_sections::data_segment_relro_end): New function.
11406         (Script_sections::place_orphan): Set or clear is_relro.
11407         (Script_sections::set_section_addresses): Force alignment of first
11408         TLS section.
11409         * yyscript.y (exp): Call script_data_segment_align and
11410         script_data_segment_relro_end.
11411         * testsuite/relro_script_test.t: New file.
11412         * testsuite/relro_test.cc (using_script): Declare.
11413         (t1, t2): Test using_script.
11414         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11415         (relro_script_test_SOURCES): Define.
11416         (relro_script_test_DEPENDENCIES): Define.
11417         (relro_script_test_LDFLAGS): Define.
11418         (relro_script_test_LDADD): Define.
11419         (relro_script_test.so): New target.
11420         * testsuite/Makefile.in: Rebuild.
11421
11422 2008-08-06  Cary Coutant <ccoutant@google.com>
11423
11424         * archive.cc (Archive::total_archives, Archive::total_members)
11425         (Archive::total_members_loaded): New variables.
11426         (Archive::setup): Add parameter.  Add option to preread
11427         archive symbols.
11428         (Archive::read_armap): Add counter.
11429         (Archive::get_file_and_offset): New function.
11430         (Archive::get_elf_object_for_member): New function.
11431         (Archive::read_all_symbols): New function.
11432         (Archive::read_symbols): New function.
11433         (Archive::add_symbols): Add counters.
11434         (Archive::include_all_members): Use armap to find members if it's
11435         already built.
11436         (Archive::include_member): Skip reading symbols if already read.
11437         Factored code into Archive::get_file_and_offset and
11438         Archive::get_elf_object_for_member.  Changed call to
11439         Mapfile::report_include_archive_member.
11440         (Archive::print_stats): New function.
11441         * archive.h: Declare Object and Read_symbols_data classes.
11442         (Archive::Archive): Add initializers for new members.
11443         (Archive::setup): Add parameter.
11444         (Archive::print_stats): New function.
11445         (Archive::total_archives, Archive::total_members)
11446         (Archive::total_members_loaded): New variables.
11447         (Archive::get_file_and_offset): New function.
11448         (Archive::get_elf_object_for_member): New function.
11449         (Archive::read_all_symbols): New function.
11450         (Archive::read_symbols): New function.
11451         (Archive::Archive_member): New class.
11452         (Archive::members_): New member.
11453         (Archive::num_members_): New member.
11454         * main.cc: Include archive.h.
11455         (main): Call Archive::print_stats.
11456         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11457         archive parameter; member_name is now the fully-decorated name.
11458         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11459         * options.h: (General_options): Add --preread-archive-symbols option.
11460         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11461         Archive::setup.
11462
11463 2008-08-04  Ian Lance Taylor  <iant@google.com>
11464
11465         * symtab.h (Symbol::use_plt_offset): New function.
11466         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11467         * powerpc.cc (Relocate::relocate): Likewise.
11468         * sparc.cc (Relocate::relocate): Likewise.
11469         * x86_64.cc (Relocate::relocate): Likewise.
11470         * testsuite/weak_plt.sh: New test.
11471         * testsuite/weak_plt_main.cc: New test.
11472         * testsuite/weak_plt_shared.cc: New test.
11473         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11474         (check_PROGRAMS): Add weak_plt.
11475         (check_DATA): Add weak_plt_shared.so.
11476         (weak_plt_main_pic.o, weak_plt): New targets.
11477         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11478         * testsuite/Makefile.in: Rebuild.
11479
11480         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11481         gcctestdir/ld.
11482         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11483         * testsuite/Makefile.in: Rebuild.
11484
11485 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11486
11487         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11488         * Makefile.in: Regenerate.
11489         * po/POTFILES.in: Regenerate.
11490
11491 2008-07-29  Ian Lance Taylor  <iant@google.com>
11492
11493         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11494         symbols before other symbols.
11495         * testsuite/script_test_2.cc (test_addr): Declare.
11496         (test_addr_alias): Declare.
11497         (main): Check that test_addr and test_addr_alias have the right
11498         values.
11499         * testsuite/script_test_2.t: Define test_addr_alias and
11500         test_addr.
11501
11502 2008-07-24  Ian Lance Taylor  <iant@google.com>
11503
11504         PR 5990
11505         * descriptors.cc: New file.
11506         * descriptors.h: New file.
11507         * gold-threads.h (class Hold_optional_lock): New class.
11508         * fileread.cc: Include "descriptors.h".
11509         (File_read::~File_read): Release descriptor rather than closing
11510         it.
11511         (File_read::open) [file]: Call open_descriptor rather than open.
11512         Set is_descriptor_opened_.
11513         (File_read::open) [memory]: Assert that descriptor is not open.
11514         (File_read::reopen_descriptor): New function.
11515         (File_read::release): Release descriptor.
11516         (File_read::do_read): Make non-const.  Reopen descriptor.
11517         (File_read::read): Make non-const.
11518         (File_read::make_view): Reopen descriptor.
11519         (File_read::do_readv): Likewise.
11520         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11521         Update declarations.
11522         * layout.cc: Include "descriptors.h".
11523         (Layout::create_build_id): Use open_descriptor rather than open.
11524         * output.cc: Include "descriptors.h".
11525         (Output_file::open): Use open_descriptor rather than open.
11526         * archive.cc (Archive::const_iterator): Change Archive to be
11527         non-const.
11528         (Archive::begin, Archive::end): Make non-const.
11529         (Archive::count_members): Likewise.
11530         * archive.h (class Archive): Update declarations.
11531         * object.h (Object::read): Make non-const.
11532         * Makefile.am (CCFILES): Add descriptors.cc.
11533         (HFILES): Add descriptors.h.
11534         * Makefile.in: Rebuild.
11535
11536         PR 6716
11537         * gold.h: Always include <clocale>.  Add Solaris workarounds
11538         following code in binutils/sysdep.h.
11539
11540         PR 6048
11541         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11542         this->eh_frame_hdr_ is NULL before using it.
11543
11544         * dynobj.cc (Versions::Versions): Update comment.
11545
11546         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11547         the base version name.
11548
11549         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11550         array size plus one.
11551         (Stringpool_template::set_string_offsets): Subtract one from key
11552         before using it as an array index.
11553         (Stringpool_template::get_offset_with_length): Likewise.
11554         (Stringpool_template::write_to_buffer): Likewise.
11555         * stringpool.h (Stringpool_template::get_offset_from_key):
11556         Likewise.
11557
11558 2008-07-23  Ian Lance Taylor  <iant@google.com>
11559
11560         PR 6658
11561         * object.h (Merged_symbol_value::value): Do our best to handle a
11562         negative addend.
11563
11564         PR 6647
11565         * script.cc (Version_script_info::get_versions): Don't add empty
11566         version tag to return value.
11567         (Version_script_info::get_symbol_version_helper): Change return
11568         type to bool.  Add pversion parameter.  Change all callers.
11569         (script_register_vers_node): Don't require a non-NULL tag.
11570         * script.h (class Version_script_info): Update declarations.
11571         (Version_script_info::get_symbol_version): Change return type to
11572         bool.  Add version parameter.  Change all callers.
11573         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11574         handling.  Handle an empty version from a version script.
11575         (Symbol_table::define_special_symbol): Likewise.
11576         * testsuite/ver_test_10.script: New file.
11577         * testsuite/ver_test_10.sh: New file.
11578         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11579         (check_DATA): Add ver_test_10.syms.
11580         (ver_test_10.syms, ver_test_10.so): New target.
11581         * testsuite/Makefile.in: Rebuild.
11582
11583 2008-07-23  Simon Baldwin  <simonb@google.com>
11584
11585         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11586         to zero for undefined symbols from dynamic libraries.
11587
11588 2008-07-23  Ian Lance Taylor  <iant@google.com>
11589
11590         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11591         Change all callers.
11592         * symtab.h (class Symbol_table): Update declaration.
11593         * testsuite/ver_test_9.cc: New file.
11594         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11595         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11596         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11597         (ver_test_9.so, ver_test_9.o): New targets.
11598         * testsuite/Makefile.in: Rebuild.
11599
11600 2008-07-22  Ian Lance Taylor  <iant@google.com>
11601
11602         * options.h (class General_options): Define --check-sections.
11603         * layout.cc (Layout::set_segment_offsets): Handle
11604         --check-sections.
11605
11606         * options.h (class General_options): Define -n/--nmagic and
11607         -N/--omagic.
11608         * options.cc (General_options::finalize): For -n/--nmagic or
11609         -N/--omagic, set -static.
11610         * layout.cc (Layout::attach_allocated_section_to_segment): If
11611         -N/--omagic, don't put read-only and read-write sections in
11612         different segments.
11613         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11614         finding a read-only segment.
11615         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11616         don't set the minimum segment alignment to the common page size,
11617         and don't set the file offset to the address modulo the page size.
11618         * script-sections.cc (Script_sections::create_segments): If
11619         -n/--omagic, don't put read-only and read-write sections in
11620         different segments.
11621
11622         * cref.cc: New file.
11623         * cref.h: New file.
11624         * options.h (class General_options): Add --print-symbol-counts.
11625         * main.cc (main): Issue defined symbol report if requested.
11626         * archive.cc (Archive::interpret_header): Make into a const member
11627         function.
11628         (Archive::add_symbols): Call Input_objects::archive_start and
11629         archive_stop.
11630         (Archive::const_iterator): Define new class.
11631         (Archive::begin, Archive::end): New functions.
11632         (Archive::include_all_members): Rewrite to use iterator.
11633         (Archive::count_members): New function.
11634         * archive.h (class Archive): Update declarations.
11635         (Archive::filename): New function.
11636         * object.cc: Include "cref.h".
11637         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11638         (Sized_relobj::do_get_global_symbol_counts): New function.
11639         (Input_objects::add_object): Add object to cross-referencer.
11640         (Input_objects::archive_start): New function.
11641         (Input_objects::archive_stop): New function.
11642         (Input_objects::print_symbol_counts): New function.
11643         * object.h: Declare Cref and Archive.
11644         (Object::get_global_symbol_counts): New function.
11645         (Object::do_get_global_symbol_counts): New pure virtual function.
11646         (class Sized_relobj): Add defined_count_ field.  Update
11647         declarations.
11648         (class Input_objects): Add cref_ field.  Update constructor.
11649         Update declarations.
11650         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11651         defined_count_.
11652         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11653         symbol counts.
11654         (Sized_dynobj::do_get_global_symbol_counts): New function.
11655         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11656         defined_count_.  Update declarations.  Define Symbols typedef.
11657         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11658         parameter.  Change all callers.
11659         (Symbol_table::add_from_dynobj): Add sympointers and defined
11660         parameters.  Change all callers.
11661         * symtab.h (class Symbol_table): Update declarations.
11662         * Makefile.am (CCFILES): Add cref.cc.
11663         (HFILES): Add cref.h.
11664         * Makefile.in: Rebuild.
11665
11666 2008-07-22  Simon Baldwin  <simonb@google.com>
11667
11668         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11669         to zero when writing undefined symbols.
11670
11671 2008-07-22  Ian Lance Taylor  <iant@google.com>
11672
11673         * output.cc (Output_section::add_input_section): Don't try to
11674         merge empty merge sections.
11675
11676 2008-07-21  Craig Silverstein  <csilvers@google.com>
11677
11678         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11679         Include symbol version in error message.
11680
11681 2008-07-20  Chris Demetriou  <cgd@google.com>
11682
11683         * configure.ac (gold_cv_c_random_seed): New configured variable.
11684         (RANDOM_SEED_CFLAGS): New substituted variable.
11685         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11686         * configure: Rebuild.
11687         * Makefile.in: Likewise.
11688         * testsuite/Makefile.in: Likewise.
11689
11690 2008-07-18  Ian Lance Taylor  <iant@google.com>
11691
11692         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11693         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11694         * testsuite/ver_test_main.cc (main): Call t4.
11695         (t4, t4_2a): Define.
11696         * testsuite/ver_test_2.cc (t4_2): Define.
11697         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11698         * testsuite/ver_test_4.cc (t4_2a): Define.
11699         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11700         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11701
11702 2008-07-17  Ian Lance Taylor  <iant@google.com>
11703
11704         * dynobj.cc (Versions::add_def): If we give an error about a
11705         missing version, go ahead and create the version anyhow.
11706
11707 2008-07-10  Ian Lance Taylor  <iant@google.com>
11708
11709         Handle output sections with more than 0x7fffffff bytes.
11710         * object.h (class Relobj): Change map_to_output_ to
11711         output_sections_, and just keep a section pointer.  Change all
11712         uses.  Move comdat group support to Sized_relobj.
11713         (Relobj::is_section_specially_mapped): Remove.
11714         (Relobj::output_section): Remove poff parameter.  Change all
11715         callers.
11716         (Relobj::output_section_offset): New function.
11717         (Relobj::set_section_offset): Rewrite.
11718         (Relobj::map_to_output): Remove.
11719         (Relobj::output_sections): New function.
11720         (Relobj::do_output_section_offset): New pure virtual function.
11721         (Relobj::do_set_section_offset): Likewise.
11722         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11723         group support from Relobj.  Update declarations.
11724         (Sized_relobj::get_output_section_offset): New function.
11725         (Sized_relobj::do_output_section_offset): New function.
11726         (Sized_relobj::do_set_section_offset): New function.
11727         * object.cc (Relobj::output_section_address): Remove.
11728         (Sized_relobj::Sized_relobj): Initialize new fields.
11729         (Sized_relobj::include_section_group): Cast find_kept_object to
11730         Sized_relobj.
11731         (Sized_relobj::include_linkonce_section): Likewise.
11732         (Sized_relobj::do_layout): Use separate arrays for output section
11733         and output offset.
11734         (Sized_relobj::do_count_local_symbols): Change map_to_output to
11735         output_sections.
11736         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
11737         output_sections and section_offsets.
11738         (Sized_relobj::write_local_symbols): Likewise.
11739         (map_to_kept_section): Compute output address directly.
11740         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
11741         output_sections and section_offsets.
11742         (Sized_relobj::write_sections): Likewise.
11743         (Sized_relobj::relocate_sections): Likewise.
11744         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
11745         * output.h (class Output_reloc): Update declarations.  Change
11746         u2_.relobj to Sized_relobj*.
11747         (class Output_data_reloc): Change add functions to use
11748         Sized_relobj*.
11749         * output.cc (Output_reloc::Output_reloc): Change relobj to
11750         Sized_relobj*.
11751         (Output_reloc::local_section_offset): Change return type to
11752         Elf_Addr.  Use get_output_section_offset.
11753         (Output_reloc::get_address): Likewise.
11754         (Output_section::is_input_address_mapped): Don't call
11755         is_section_specially_mapped.
11756         (Output_section::output_offset): Likewise.
11757         (Output_section::output_address): Likewise.
11758         (Output_section::starting_output_address): Likewise.
11759         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
11760         parameter to Sized_relobj*.
11761         (Copy_relocs::need_copy_reloc): Likewise.
11762         (Copy_relocs::save): Likewise.
11763         * copy-relocs.h (class Copy_relocs): Update declarations.
11764         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
11765         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
11766         * target-reloc.h (relocate_for_relocatable): Change
11767         offset_in_output_section type to Elf_Addr.  Change code that uses
11768         it as well.
11769         * layout.cc (Layout::layout): Always set *off.
11770         * mapfile.cc (Mapfile::print_input_section): Use
11771         output_section_offset.
11772         * i386.cc (Target_i386::copy_reloc): Change object parameter to
11773         Sized_relobj*.
11774         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
11775         * sparc.cc (Target_sparc::copy_reloc): Likewise.
11776         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
11777
11778 2008-07-03  Ian Lance Taylor  <iant@google.com>
11779
11780         * layout.cc (Layout::include_section): Do not discard unrecognized
11781         SHT_STRTAB sections.
11782
11783 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
11784
11785         * script.cc (Lex::can_continue_name): Make '?' allowable in
11786         version-script names.
11787         * testsuite/version_script.map: Change glob pattern to use '?'
11788
11789 2008-06-30  Manish Singh  <yosh@gimp.org>
11790
11791         PR 6585
11792         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
11793         Correct typo.
11794
11795 2008-06-30  Ian Lance Taylor  <iant@google.com>
11796
11797         PR 6660
11798         PR 6682
11799         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
11800         versions]: Don't try to read the value in the contents, since we
11801         don't use it.  Use the template endianness when writing.
11802
11803 2008-06-25  Cary Coutant  <ccoutant@google.com>
11804
11805         * fileread.cc (File_read::make_view): Assert on zero-length view.
11806         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
11807         symbol table when there are no symbols to read.
11808
11809 2008-06-23  Craig Silverstein  <csilvers@google.com>
11810
11811         * version.cc (version_string): Bump to 1.7
11812
11813 2008-06-18  Craig Silverstein  <csilvers@google.com>
11814
11815         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
11816         constant 0xFFFF to type Valtype.
11817         (Powerpc_relocate_functions::rel16_ha): Likewise.
11818
11819 2008-06-17  Ian Lance Taylor  <iant@google.com>
11820
11821         * output.h (Output_section::Input_section): Initialize p2align_ to
11822         zero for Output_section_data constructors.
11823         (Output_section::Input_section::addralign): If not an input
11824         section, return the alignment of the Output_section_data.
11825         * testsuite/copy_test.cc: New file.
11826         * testsuite/copy_test_1.cc: New file.
11827         * testsuite/copy_test_2.cc: New file.
11828         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
11829         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
11830         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
11831         (copy_test_1_pic.o, copy_test_1.so): New targets.
11832         (copy_test_2_pic.o, copy_test_2.so): New targets.
11833         * testsuite/Makefile.in: Rebuild.
11834
11835         * script-sections.cc (Script_sections::place_orphan): Initialize
11836         local variable exact.
11837
11838 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
11839
11840         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
11841
11842 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
11843             David S. Miller  <davem@davemloft.net>
11844
11845         * powerpc.cc: New file.
11846         * Makefile.am (TARGETSOURCES): Add powerpc.cc
11847         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
11848         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
11849         * Makefile.in: Rebuild.
11850
11851 2008-06-09  Ian Lance Taylor  <iant@google.com>
11852
11853         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
11854         <exception>.
11855         (throwing, orig_terminate): New static variables.
11856         (terminate_handler): New static function.
11857         (t2): Set terminate handler.
11858
11859 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
11860
11861         PR 6584
11862         * binary.cc (Binary_to_elf::sized_convert): Fix .data
11863         alignment.
11864
11865 2008-05-30  Cary Coutant  <ccoutant@google.com>
11866
11867         * archive.cc (Archive::include_all_members) Correct to step
11868         over symbol table and extended name table in thin archives.
11869
11870 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
11871
11872         PR 6407
11873         * target-reloc.h (relocate_for_relocatable): Fix new_offset
11874         calculation.
11875
11876 2008-05-28  Caleb Howe  <cshowe@google.com>
11877
11878         * reduced_debug_output.cc: New file.
11879         * reduced_debug_output.h: New file.
11880         * options.h (class General_options): Add --strip-debug-non-line.
11881         * options.cc (General_options::finalize): Add strip_debug_non_line
11882         to the strip heirarchy.
11883         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
11884         fields.
11885         * layout.cc: Include "reduced_debug_output.h".
11886         (Layout::Layout): Initialize new fields.
11887         (line_only_debug_sections): New static array.
11888         (is_lines_only_debug_sections): New static inline function.
11889         (Layout::include_section): Handle --strip-debug-non-line.
11890         (Layout::make_output_section): If --strip-debug-non-line, build
11891         new output sections for .debug_abbrev and .debug_info.
11892         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
11893         gold.  Warn about possible overflow.
11894         (read_signed_LEB_128): Likewise.
11895         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
11896         (read_signed_LEB_128): Declare.
11897         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
11898         (HFILES): Add reduced_debug_output.h.
11899         * Makefile.in: Rebuild.
11900
11901 2008-05-21  Ian Lance Taylor  <iant@google.com>
11902
11903         * mapfile.cc: New file.
11904         * mapfile.h: New file.
11905         * options.h (class General_options): Add -M/--print-map and -Map.
11906         * options.cc (General_options::finalize): Make -M equivalent to
11907         -Map -.
11908         * main.cc: Include <cstdio> and "mapfile.h".
11909         (main): Open mapfile if requested.
11910         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
11911         constructor.  Change caller.
11912         (queue_initial_tasks): Add mapfile parameter.  Change caller.
11913         (queue_middle_tasks): Likewise.
11914         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
11915         declarations.
11916         * archive.cc: Include "mapfile.h".
11917         (Archive::add_symbols): Add mapfile parameter.  Change all
11918         callers.  Pass mapfile, symbol, and reason to include_member.
11919         (Archive::include_all_members): Add mapfile parameter.  Change all
11920         callers.
11921         (Archive::include_member): Add mapfile, sym, and why parameters.
11922         Change all callers.  Report inclusion to map file.
11923         * archive.h: Include "fileread.h".
11924         (class Archive): Update declarations.
11925         (Archive::file): New const method.
11926         (class Add_archive_symbols): Add mapfile_ field.  Update
11927         constructor.  Change all callers.
11928         * readsyms.h (class Read_symbols): Likewise.
11929         (class Finish_group): Likewise.
11930         (class Read_script): Likewise.
11931         * common.cc: Include "mapfile.h".
11932         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
11933         all callers.
11934         (Symbol_table::do_allocate_commons): Likewise.
11935         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
11936         symbol allocation to mapfile.
11937         * common.h (class Allocate_commons_task): Add mapfile_ field.
11938         Update constructor.  Change all callers.
11939         * symtab.h (class Symbol_table): Update declarations.
11940         * layout.cc: Include "mapfile.h".
11941         (Layout_task_runner::run): Print information to mapfile.
11942         (Layout::create_gold_note): Change Output_data_fixed_space to
11943         Output_data_zero_fill.
11944         (Layout::create_build_id): Likewise.
11945         (Layout::print_to_mapfile): New function.
11946         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
11947         constructor.  Change caller.
11948         (class Layout): Declare print_to_mapfile.
11949         * output.cc (Output_section::Input_section::print_to_mapfile): New
11950         function.
11951         (Output_section::add_input_section): If producing a map, always
11952         add to input_sections_ list.
11953         (Output_section::do_print_to_mapfile): New function.
11954         (Output_segment::print_sections_to_mapfile): New function.
11955         (Output_segment::print_section_list_to_mapfile): New function.
11956         * output.h: Include "mapfile.h".
11957         (Output_data::print_to_mapfile): New function.
11958         (Output_data::do_print_to_mapfile): New virtual function.
11959         (Output_segment_headers::do_print_to_mapfile): New function.
11960         (Output_file_header::do_print_to_mapfile): New function.
11961         (Output_data_const::do_print_to_mapfile): New function.
11962         (class Output_data_const_buffer): Add map_name_ field.  Update
11963         constructor.  Change all callers.  Add do_print_to_mapfile
11964         function.
11965         (class Output_data_fixed_space): Likewise.
11966         (class Output_data_space): Likewise.
11967         (class Output_data_zero_fill): New class.
11968         (Output_data_strtab::do_print_to_mapfile): New function.
11969         (Output_data_reloc_base::do_print_to_mapfile): New function.
11970         (Output_relocatable_relocs::do_print_to_mapfile): New function.
11971         (Output_data_group::do_print_to_mapfile): New function.
11972         (Output_data_got::do_print_to_mapfile): New function.
11973         (Output_data_dynamic::do_print_to_mapfile): New function.
11974         (Output_symtab_xindex::do_print_to_mapfile): New function.
11975         (class Output_section): Declare do_print_to_mapflie.  Declare
11976         print_to_mapfile in Input_section.
11977         (class Output_segment): Declare new functions.
11978         * object.h (Sized_relobj::symbol_count): New function.
11979         * script-sections.cc
11980         (Output_section_element_dot_assignment::set_section_addresses):
11981         Change Output_data_fixed_space to Output_data_zero_fill.
11982         (Output_data_expression::do_print_to_mapfile): New function.
11983         * script.cc (read_input_script): Add mapfile parameter.  Change
11984         all callers.
11985         * script.h (read_input_script): Update declaration.
11986         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
11987         (Eh_frame::do_print_to_mapfile): New function.
11988         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
11989         (Output_merge_string::do_print_to_mapfile): New function.
11990         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
11991         function.
11992         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
11993         function.
11994         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
11995         function.
11996         * Makefile.am (CCFILES): Add mapfile.cc.
11997         (HFILES): Add mapfile.h.
11998         * Makefile.in: Rebuild.
11999
12000 2008-05-19  Ian Lance Taylor  <iant@google.com>
12001
12002         * options.h (class General_options): Add -z relro.
12003         * layout.cc (Layout::Layout): Initialize relro_segment_.
12004         (Layout::add_output_section_data): Return the output section.
12005         (Layout::make_output_section): Rcognize relro sections and mark
12006         them appropriately.
12007         (Layout::attach_allocated_section_to_segment): Put relro sections
12008         in a PT_GNU_RELRO segment.
12009         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12010         section as relro.
12011         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12012         PT_TLS segments.
12013         (Layout::linkonce_mapping): Map d.rel.ro.local to
12014         .data.rel.ro.local.
12015         (Layout::output_section_name): Us .data.rel.ro.local for any
12016         section which begins with that.
12017         * layout.h (class Layout): Update add_output_section_data
12018         declaration.  Add relro_segment_ field.
12019         * output.cc (Output_section::Output_section): Initialize is_relro_
12020         and is_relro_local_ fields.
12021         (Output_segment::add_output_section): Group relro sections.
12022         (Output_segment::is_first_section_relro): New function.
12023         (Output_segment::maximum_alignment): If there is a relro section,
12024         align the segment to the common page size.
12025         (Output_segment::set_section_addresses): Track whether we are
12026         looking at relro sections.  If the last section is a relro
12027         section, align to the common page size.
12028         (Output_segment::set_section_list_addresses): Add in_relro
12029         parameter.  Change all callers.  Align to the page size when
12030         moving from relro to non-relro section.
12031         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12032         segment.
12033         * output.h (class Output_section): Add is_relro_ and
12034         is_relro_local_ fields.
12035         (Output_section::is_relro): New function.
12036         (Output_section::set_is_relro): New function.
12037         (Output_section::is_relro_local): New function.
12038         (Output_section::set_is_relro_local): New function.
12039         (class Output_segment): Update declarations.
12040         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12041         * sparc.cc (Target_sparc::got_section): Likewise.
12042         * x86_64.cc (Target_x86_64::got_section): Likewise.
12043         * testsuite/relro_test_main.cc: New file.
12044         * testsuite/relro_test.cc: New file.
12045         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12046         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12047         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12048         (relro_test.so, relro_test_pic.o): New targets.
12049         * testsuite/Makefile.in: Rebuild.
12050
12051 2008-05-16  Ian Lance Taylor  <iant@google.com>
12052
12053         * output.cc (Output_segment::add_output_section): Remove front
12054         parameter.
12055         * output.h (class Output_segment): Remove
12056         add_initial_output_section and overloaded add_output_section.
12057         Update declaration of remaining add_output_section.
12058         * layout.cc (Layout::create_interp): Call add_output_section
12059         rather than add_initial_output_section.
12060         (Layout::finish_dynamic_section): Likewise.
12061
12062         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12063         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12064         know the dynamic type.
12065         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12066         field.  Initialize it in constructor.
12067         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12068         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12069         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12070         reloc.
12071
12072         * output.cc (Output_reloc::get_address): Change return type to
12073         Elf_Addr.
12074         * output.h (class Output_reloc): Update get_address declaration.
12075         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12076         for section addresses.
12077
12078 2008-05-09  Ian Lance Taylor  <iant@google.com>
12079
12080         PR 6493
12081         * gold.cc (gold_nomem): Use return value of write.
12082
12083 2008-05-08  Ian Lance Taylor  <iant@google.com>
12084
12085         * symtab.c (Symbol::init_base_output_data): Add version
12086         parameter.  Change all callers.
12087         (Symbol::init_base_output_segment): Likewise.
12088         (Symbol::init_base_constant): Likewise.
12089         (Symbol::init_base_undefined): Likewise.
12090         (Sized_symbol::init_output_data): Likewise.
12091         (Sized_symbol::init_output_segment): Likewise.
12092         (Sized_symbol::init_constant): Likewise.
12093         (Sized_symbol::init_undefined): Likewise.
12094         (Symbol_table::do_define_in_output_data): If the new symbol has a
12095         version, mark it as the default.
12096         (Symbol_table::do_define_in_output_segment): Likewise.
12097         (Symbol_table::do_define_as_constant): Likewise.
12098         * symtab.h (class Symbol): Update declarations.
12099         (class Sized_symbol): Likewise.
12100         * resolve.cc (Symbol::override_version): New function.
12101         (Symbol::override_base): Call override_version.
12102         (Symbol::override_base_with_special): Likewise.
12103         * testsuite/ver_script_8.script: New file.
12104         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12105         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12106         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12107         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12108
12109 2008-05-06  Ian Lance Taylor  <iant@google.com>
12110
12111         PR 6049
12112         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12113         functions.
12114         (class General_options): Remove existing --undefined, and add
12115         --no-undefined instead.  Add new --undefined as synonym for -u.
12116         * archive.cc (Archive::add_symbols): Check whether symbol was
12117         named with -u.
12118         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12119         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12120         all uses.  Add IS_UNDEFINED.  Update declarations to split
12121         different versions of init_base.  Declare init_base_undefined.
12122         (Symbol::is_defined): Handle IS_UNDEFINED.
12123         (Symbol::is_undefined): Likewise.
12124         (Symbol::is_weak_undefined): Call is_undefined.
12125         (Symbol::is_absolute): Handle IS_CONSTANT.
12126         (class Sized_symbol): Update declarations to split different
12127         versions of init.  Declare init_undefined.
12128         (class Symbol_table): Declare new functions.
12129         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12130         Change all callers.
12131         (Symbol::init_base_output_data): Likewise.
12132         (Symbol::init_base_output_segment): Likewise.
12133         (Symbol::init_base_constant): Likewise.
12134         (Symbol::init_base_undefined): New function.
12135         (Sized_symbol::init_object): Rename from init.  Change all
12136         callers.
12137         (Sized_symbol::init_output_data): Likewise.
12138         (Sized_symbol::init_output_segment): Likewise.
12139         (Sized_symbol::init_constant): Likewise.
12140         (Sized_symbol::init_undefined): New function.
12141         (Symbol_table::add_undefined_symbols_from_command_line): New
12142         function.
12143         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12144         function.
12145         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12146         (Symbol::output_section): Likewise.
12147         (Symbol::set_output_section): Likewise.
12148         (Symbol_table::sized_finalize_symbol): Likewise.
12149         (Symbol_table::sized_write_globals): Likewise.
12150         * resolve.cc (Symbol_table::should_override): Likewise.
12151         (Symbol::override_base_with_special): Likewise.
12152
12153         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12154         symbol, change it to have default visibility.
12155         * testsuite/protected_1.cc: New file.
12156         * testsuite/protected_2.cc: New file.
12157         * testsuite/protected_3.cc: New file.
12158         * testsuite/protected_main_1.cc: New file.
12159         * testsuite/protected_main_2.cc: New file.
12160         * testsuite/protected_main_3.cc: New file.
12161         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12162         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12163         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12164         (protected_1.so): New target.
12165         (protected_1_pic.o, protected_2_pic.o): New targets.
12166         (protected_3_pic.o): New target.
12167         (check_PROGRAMS): Add protected_2.
12168         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12169         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12170         * testsuite/Makefile.in: Rebuild.
12171
12172         * options.h (DEFINE_var): Add set_user_set_##varname__.
12173         (DEFINE_bool_alias): New macro.
12174         (class General_options): Define -Bstatic using DEFINE_bool_alias
12175         rather than DEFINE_special.  Add --undefined as an alias for -z
12176         defs.
12177         * options.cc (General_options::parse_Bstatic): Remove.
12178
12179         * options.h (class General_options): Add --fatal-warnings.
12180         * main.cc (main): Implement --fatal-warnings.
12181         * errors.h (Errors::warning_count): New function.
12182
12183         * options.h (class General_options): Add -Bsymbolic-functions.
12184         * symtab.h (Symbol::is_preemptible): Check for
12185         -Bsymbolic-functions.
12186
12187 2008-05-05  Ian Lance Taylor  <iant@google.com>
12188
12189         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12190         as noVARNAME rather than no-VARNAME.
12191         (class General_options): Add option -z combreloc.
12192         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12193         get_address.
12194         (Output_reloc::sort_before) [SHT_REL]: New function.
12195         (Output_reloc::sort_before) [SHT_RELA]: New function.
12196         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12197         Sort_relocs_comparison.
12198         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12199         parameter.  Change all callers.
12200         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12201         sort_relocs parameter.  Change all callers.
12202         * output.cc (Output_reloc::get_address): New function, broken out
12203         of write_rel.
12204         (Output_reloc::write_rel): Call it.
12205         (Output_reloc::compare): New function.
12206         (Output_data_reloc_base::do_write): Optionally sort relocs.
12207
12208         * configure.ac: If targ_extra_obj is set, link it in.
12209         * configure.tgt: Initialize all variables.
12210         (x86_64*): Set targ_extra_obj and targ_extra_size.
12211         * configure: Rebuild.
12212
12213         * object.cc (Sized_relobj::include_section_group): Adjust section
12214         indexes read from group data.  Build vector to pass to
12215         layout_group.
12216         * layout.cc (Layout::layout_group): Add flags and shndxes
12217         parameters.  Remove contents parameter.  Change caller.  Update
12218         explicit instantiations.
12219         * layout.h (class Layout): Update layout_group declaration.
12220         * output.cc (Output_data_group::Output_data_group): Add flags and
12221         input_shndxes parameters.  Remove contents parameter.  Change
12222         caller.
12223         (Output_data_group::do_write): Change input_sections_ to
12224         input_shndxes_.
12225         * output.h (class Output_data_group): Update constructor
12226         declaration.  Rename input_sections_ to input_shndxes_.
12227         * testsuite/many_sections_test.cc: Add template.
12228
12229 2008-04-30  Cary Coutant  <ccoutant@google.com>
12230
12231         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12232
12233         * layout.cc (Layout::include_section): Refactored check for debug
12234         info section.
12235         (Layout::add_comdat): Add new parameters.  Change type
12236         of signature parameter.  Add object and shndx to signatures table.
12237         (Layout::find_kept_object): New function.
12238         * layout.h: Include <cstring>.
12239         (Layout::is_debug_info_section): New function.
12240         (Layout::add_comdat): Add new parameters.
12241         (Layout::find_kept_object): New function.
12242         (Layout::Kept_section): New struct.
12243         (Layout::Signatures): Change type of map range.
12244         * object.cc (Relobj::output_section_address): New function.
12245         (Sized_relobj::include_section_group): Add new parameters.  Change
12246         calls to Layout::add_comdat.  Change to build table of kept comdat
12247         groups and table mapping discarded sections to kept sections.
12248         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12249         (Sized_relobj::do_layout): Change calls to include_section_group and
12250         include_linkonce_section.
12251         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12252         value to zero when section is discarded.
12253         (Sized_relobj::map_to_kept_section): New function.
12254         * object.h (Relobj::output_section_address): New function.
12255         (Relobj::Comdat_group): New type.
12256         (Relobj::find_comdat_group): New function.
12257         (Relobj::Comdat_group_table): New type.
12258         (Relobj::Kept_comdat_section): New type.
12259         (Relobj::Kept_comdat_section_table): New type.
12260         (Relobj::add_comdat_group): New function.
12261         (Relobj::set_kept_comdat_section): New function.
12262         (Relobj::get_kept_comdat_section): New function.
12263         (Relobj::comdat_groups_): New field.
12264         (Relobj::kept_comdat_sections_): New field.
12265         (Symbol_value::input_value): Update comment.
12266         (Sized_relobj::map_to_kept_section) New function.
12267         (Sized_relobj::include_linkonce_section): Add new parameter.
12268         * target-reloc.h (Comdat_behavior): New type.
12269         (get_comdat_behavior): New function.
12270         (relocate_section): Add code to map a discarded section to the
12271         corresponding kept section when applying a relocation.
12272
12273 2008-04-30  Craig Silverstein  <csilvers@google.com>
12274
12275         * dwarf_reader.cc (next_generation_count): New static var.
12276         (Addr2line_cache_entry): New struct.
12277         (addr2line_cache): New static var.
12278         (Dwarf_line_info::one_addr2line): Added caching.
12279         (Dwarf_line_info::clear_addr2line_cache): New function.
12280         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12281         cache-size parameter.
12282         (Dwarf_line_info::one_addr2line_cache): New function.
12283         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12284         new cache-size argument to one_addr2line(), and clear cache.
12285
12286 2008-04-28  Cary Coutant  <ccoutant@google.com>
12287
12288         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12289         R_386_PC8 relocations.
12290
12291 2008-04-23  Ian Lance Taylor  <iant@google.com>
12292
12293         * object.cc (Sized_relobj::include_section_group): Check for
12294         invalid section group.
12295
12296         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12297         header size.
12298
12299         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12300         than read for file header.
12301         * archive.cc (Archive::include_member): Likewise.
12302
12303 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12304
12305         * aclocal.m4: Regenerate.
12306         * configure: Regenerate.
12307
12308 2008-04-19  Ian Lance Taylor  <iant@google.com>
12309
12310         * version.cc (version_string): Bump to 1.6.
12311
12312         * testsuite/Makefile.am (many_sections_r_test): New target.
12313         (many_sections_r_test_SOURCES): Remove.
12314         (many_sections_r_test_DEPENDENCIES): Remove.
12315         (many_sections_r_test_LDFLAGS): Remove.
12316         (many_sections_r_test_LDADD): Remove.
12317
12318         * object.cc (Sized_relobj::do_add_symbols): Always pass
12319         local_symbol_count_ to add_from_relobj.
12320
12321         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12322         every thousand variables.
12323         * testsuite/Makefile.in: Rebuild.
12324
12325         * object.cc (Xindex::initialize_symtab_xindex): New function.
12326         (Xindex::read_symtab_xindex): New function.
12327         (Xindex::sym_xindex_to_shndx): New function.
12328         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12329         available.
12330         (Sized_relobj::do_initialize_xindex): New function.
12331         (Sized_relobj::do_read_symbols): Adjust section links.
12332         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12333         parameter.  Change all callers.
12334         (Sized_relobj::include_section_group): Adjust section links and
12335         symbol section indexes.
12336         (Sized_relobj::do_layout): Adjust section links.
12337         (Sized_relobj::do_count_local_symbols): Adjust section links and
12338         symbol section indexes.
12339         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12340         ordinary and special symbols.
12341         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12342         dynsym_xindex parameters.  Change all callers.  Adjust section
12343         links.  Use SHN_XINDEX when needed.
12344         (Sized_relobj::get_symbol_location_info): Adjust section links.
12345         Don't get fooled by special symbols.
12346         * object.h (class Xindex): Define.
12347         (class Object): Add xindex_ parameter.  Declare virtual functoin
12348         do_initialize_xindex.
12349         (Object::adjust_sym_shndx): New function.
12350         (Object::set_xindex): New protected function.
12351         (class Symbol_value): Add is_ordinary_shndx_ field.
12352         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12353         (Symbol_value::value): Assert ordinary section.
12354         (Symbol_value::initialize_input_to_output_map): Likewise.
12355         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12356         Change all callers.
12357         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12358         all callers.
12359         (class Sized_relobj): Update declarations.
12360         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12361         parameter.  Change all callers.
12362         (Sized_relobj::adjust_shndx): New function.
12363         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12364         field.
12365         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12366         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12367         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12368         (Sized_dynobj::read_dynsym_section): Adjust section links.
12369         (Sized_dynobj::read_dynamic): Likewise.
12370         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12371         section links.
12372         (Sized_dynobj::do_initialize_xindex): New function.
12373         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12374         do_initialize_xindex.
12375         (Sized_dynobj::adjust_shndx): New function.
12376         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12377         dynsym_xindex_ fields.
12378         (Layout::finalize): Add a call to set_section_indexes before
12379         creating the symtab sections.
12380         (Layout::set_section_indexes): Don't do anything if the section
12381         already has a section index.
12382         (Layout::create_symtab_sections): Add shnum parameter.  Change
12383         caller.  Create .symtab_shndx section if needed.
12384         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12385         caller.
12386         (Layout::allocated_output_section_count): New function.
12387         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12388         needed.
12389         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12390         fields.  Update declarations.
12391         (Layout::symtab_xindex): New function.
12392         (Layout::dynsym_xindex): New function.
12393         (class Write_symbols_task): Add layout_ field.
12394         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12395         Change caller.
12396         * output.cc (Output_section_headers::Output_section_headers): Add
12397         shstrtab_section parameter.  Change all callers.
12398         (Output_section_headers::do_sized_write): Store overflow values
12399         for section count and section string table section index in
12400         section header zero.
12401         (Output_file_header::do_sized_write): Check for overflow of
12402         section count and section string table section index.
12403         (Output_symtab_xindex::do_write): New function.
12404         (Output_symtab_xindex::endian_do_write): New function.
12405         * output.h (class Output_section_headers): Add shstrtab_section_.
12406         Update declarations.
12407         (class Output_symtab_xindex): Define.
12408         (Output_section::has_out_shndx): New function.
12409         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12410         field.
12411         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12412         Change all callers.
12413         (Sized_symbol::init): Likewise.
12414         (Symbol::output_section): Check for ordinary symbol.
12415         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12416         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12417         callers.
12418         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12419         Change all callers.  Simplify handling of symbols from sections
12420         not included in the link.
12421         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12422         distinction.
12423         (Weak_alias_sorter::operator()): Assert that symbols are
12424         ordinary.
12425         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12426         distinction.
12427         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12428         parameters.  Change all callers.
12429         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12430         symbol distinction.  Use SHN_XINDEX when needed.
12431         (Symbol_table::write_section_symbol): Add symtab_xindex
12432         parameter.  Change all callers.
12433         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12434         SHN_XINDEX when needed.
12435         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12436         declarations.
12437         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12438         (Symbol::is_defined): Check is_ordinary.
12439         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12440         (Symbol::is_absolute, Symbol::is_common): Likewise.
12441         (class Sized_symbol): Update declarations.
12442         (class Symbol_table): Update declarations.
12443         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12444         parameters.  Change all callers.
12445         (Sized_symbol::override): Likewise.
12446         (Symbol_table::override): Likewise.
12447         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12448         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12449         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12450         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12451         to be in an ordinary section.
12452         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12453         object and is_ordinary parameters.  Change all callers.
12454         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12455         Change all callers.  Don't add undefined or non-ordinary symbols
12456         to reloc_map_.
12457         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12458         Change all callers.
12459         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12460         declarations.
12461         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12462         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12463         (Sized_relobj::relocate_sections): Likewise.
12464         * target-reloc.h (scan_relocs): Adjust section symbol index.
12465         (scan_relocatable_relocs): Likewise.
12466         * i386.cc (Scan::local): Check for ordinary symbols.
12467         * sparc.cc (Scan::local): Likewise.
12468         * x86_64.cc (Scan::local): Likewise.
12469         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12470         to symbol_section_and_value.
12471         * testsuite/many_sections_test.cc: New file.
12472         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12473         (check_PROGRAMS): Add many_sections_test.
12474         (many_sections_test_SOURCES): Define.
12475         (many_sections_test_DEPENDENCIES): Define.
12476         (many_sections_test_LDFLAGS): Define.
12477         (BUILT_SOURCES): Add many_sections_define.h.
12478         (many_sections_define.h): New target.
12479         (BUILT_SOURCES): Add many_sections_check.h.
12480         (many_sections_check.h): New target.
12481         (check_PROGRAMS): Add many_sections_r_test.
12482         (many_sections_r_test_SOURCES): Define.
12483         (many_sections_r_test_DEPENDENCIES): Define.
12484         (many_sections_r_test_LDFLAGS): Define.
12485         (many_sections_r_test_LDADD): Define.
12486         (many_sections_r_test.o): New target.
12487         * testsuite/Makefile.in: Rebuild.
12488
12489 2008-04-17  Cary Coutant  <ccoutant@google.com>
12490
12491         * errors.cc (Errors::info): New function.
12492         (gold_info): New function.
12493         * errors.h (Errors::info): New function.
12494         * gold.h (gold_info): New function.
12495         * object.cc (Input_objects::add_object): Print trace output.
12496         * options.cc (options::parse_set): New function.
12497         (General_options::parse_wrap): Deleted.
12498         (General_options::General_options): Deleted initializer.
12499         * options.h (options::String_set): New typedef.
12500         (options::parse_set): New function.
12501         (DEFINE_set): New macro.
12502         (General_options::wrap): Changed to use DEFINE_set. Changed
12503         callers of any_wrap_symbols and is_wrap_symbol.
12504         (General_options::trace, General_options::trace_symbol):
12505         New options.
12506         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12507         (General_options::wrap_symbols_): Deleted.
12508         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12509
12510 2008-04-17  David S. Miller  <davem@davemloft.net>
12511
12512         * options.cc (General_options::parse_V): New function.
12513         * options.h: Add entries for -V and -Qy.
12514
12515 2008-04-17  Ian Lance Taylor  <iant@google.com>
12516
12517         * common.cc (Symbol_table::allocate_commons): Remove options
12518         parameter.  Change caller.
12519         (Symbol_table::do_allocate_commons): Remove options parameter.
12520         Change caller.  Just call do_allocate_commons_list twice.
12521         (Symbol_table::do_allocate_commons_list): New function, broken out
12522         of do_allocate_commons.
12523         * common.h (class Allocate_commons_task): Remove options_ field.
12524         Update constructor.
12525         * symtab.cc (Symbol_table::Symbol_table): Initialize
12526         tls_commons_.
12527         (Symbol_table::add_from_object): Put TLS common symbols on
12528         tls_commons_ list.
12529         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12530         which are IN_OUTPUT_DATA.
12531         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12532         allocate_commons and do_allocate_commons declarations.  Declare
12533         do_allocate_commons_list.
12534         * gold.cc (queue_middle_tasks): Update creation of
12535         Allocate_commons_task to not pass options.
12536         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12537         (TLS_TEST_C_FLAGS): New variable.
12538         (tls_test_c_pic.o): New target.
12539         (tls_test_shared.so): Link in tls_test_c_pic.o.
12540         (tls_test_c_pic_ie.o): New target.
12541         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12542         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12543         (tls_test_c.o): New target.
12544         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12545         (tls_pic_test_LDADD): Likewise.
12546         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12547         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12548         (tls_test_c_gnu2.o): New target.
12549         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12550         tls_test_c_gnu2.o.
12551         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12552         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12553         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12554         * testsuite/tls_test.cc: Include "config.h".
12555         (t_last): Call t11_last.
12556         * testsuite/tls_test.h (t11, t11_last): Declare.
12557         * testsuite/tls_test_c.c: New file.
12558         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12559         * configure.ac: Check for OpenMP support.
12560         * configure, config.in, Makefile.in: Rebuild.
12561         * testsuite/Makefile.in: Rebuild.
12562
12563 2008-04-16  Cary Coutant  <ccoutant@google.com>
12564
12565         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12566         (Target_i386::tls_base_symbol_defined_): New field.
12567         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12568         (Target_i386::Scan::global): Likewise.
12569         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12570         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12571         (Target_x86_64::tls_base_symbol_defined_): New field.
12572         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12573         (Target_x86_64::Scan::global): Likewise.
12574
12575 2008-04-16  Cary Coutant  <ccoutant@google.com>
12576
12577         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12578         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12579         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12580         building shared libraries.
12581         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12582         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12583         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12584         * testsuite/Makefile.in: Rebuild.
12585         * testsuite/weak_undef.h: New file.
12586         * testsuite/weak_undef_file1.cc: Add extra test cases.
12587         * testsuite/weak_undef_file2.cc: Likewise.
12588         * testsuite/weak_undef_test.cc: Likewise.
12589
12590 2008-04-16  David S. Miller  <davem@davemloft.net>
12591
12592         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12593         Add issued_non_pic_error_ field.  Declare check_non_pic.
12594         (Target_sparc::Scan::check_non_pic): New function.
12595         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12596         (Target_sparc::Scan::global): Likewise.
12597
12598         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12599         * configure: Rebuild.
12600
12601         * options.h (DEFINE_enable): New macro.
12602         (new_dtags): New enable option.
12603         (initfirst, interpose, loadfltr, nodefaultlib,
12604         nodelete, nodlopen, nodump): New -z options.
12605         * layout.cc (Layout:finish_dynamic_section): If new
12606         dtags enabled, emit DT_RUNPATH.  Also, emit a
12607         DT_FLAGS_1 containing any specified -z flags.
12608
12609 2008-04-16  Ian Lance Taylor  <iant@google.com>
12610
12611         * copy-relocs.cc: New file.
12612         * copy-relocs.h: New file.
12613         * reloc.cc: Remove Copy_relocs code.
12614         * reloc.h: Likewise.
12615         * reloc-types.h (struct Reloc_types) [both versions]: Add
12616         get_reloc_addend_noerror.
12617         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12618         variants of add_global which take an addend which must be zero.
12619         * i386.cc: Include "copy-relocs.h".
12620         (class Target_i386): Change type of copy_relocs_ to variable,
12621         update initializer.
12622         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12623         Change all callers.
12624         (Target_i386::do_finalize_sections): Change handling of
12625         copy_relocs_.
12626         * sparc.cc: Include "copy-relocs.h".
12627         (class Target_sparc): Change type of copy_relocs_ to variable,
12628         update initializer.
12629         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12630         Change all callers.
12631         (Target_sparc::do_finalize_sections): Change handling of
12632         copy_relocs_.
12633         * x86_64.cc: Include "copy-relocs.h".
12634         (class Target_x86_64): Change type of copy_relocs_ to variable,
12635         update initializer.
12636         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12637         class.  Change all callers.
12638         (Target_x86_64::do_finalize_sections): Change handling of
12639         copy_relocs_.
12640         * Makefile.am (CCFILES): Add copy-relocs.cc.
12641         (HFILES): Add copy-relocs.h.
12642
12643         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12644
12645         * testsuite/script_test_4.sh: Permit leading zeroes.
12646
12647 2008-04-15  Ian Lance Taylor  <iant@google.com>
12648
12649         * script-sections.cc (Script_sections::create_segments): Use
12650         header_size_adjustment even when there is enough room for the
12651         headers.
12652         * testsuite/script_test_4.sh: New file.
12653         * testsuite/script_test_4.t: New file.
12654         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12655         (check_DATA): Add script_test_4.stdout.
12656         (MOSTLYCLEANFILES): Likewise.
12657         (script_test_4): New target.
12658         (script_test_4.stdout): New target.
12659         * testsuite/Makefile.in: Rebuild.
12660
12661         * sparc.cc: Add definitions for Output_data_plt_sparc class
12662         constants.
12663
12664 2008-04-14  David S. Miller  <davem@davemloft.net>
12665
12666         * sparc.cc: New file.
12667         * Makefile.am (TARGETSOURCES): Add sparc.cc
12668         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12669         * configure.tgt: Document targ_extra_size and
12670         targ_extra_big_endian.  Add entries for sparc-* and
12671         sparc64-*.
12672         * configure.ac: Handle targ_extra_size and
12673         targ_extra_big_endian.
12674         * Makefile.in: Rebuild.
12675         * configure: Likewise.
12676         * po/POTFILES.in: Likewise.
12677         * po/gold.pot: Likewise.
12678
12679 2008-04-14  Ian Lance Taylor  <iant@google.com>
12680
12681         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12682         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12683         in the name/type/flags to section mapping.  Don't call
12684         allocate_output_section.
12685         (Layout::choose_output_section): Change parameter from adjust_name
12686         to is_input_section.  Don't permit input sections after sections
12687         are attached to segments.  Don't call allocate_output_section.
12688         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12689         not write_enable_output_section.
12690         (Layout::make_output_section): Don't push to
12691         unattached_section_list_ nor call attach_to_segment.  Call
12692         attach_section_to_segment if sections are attached.
12693         (Layout::attach_sections_to_segments): New function.
12694         (Layout::attach_section_to_segment): New function.
12695         (Layout::attach_allocated_section_to_segment): Rename from
12696         attach_to_segment.  Remove flags parameter.
12697         (Layout::allocate_output_section): Remove function.
12698         (Layout::write_enable_output_section): Remove function.
12699         * layout.h (class Layout): Update for above changes.  Add new
12700         field sections_are_attached_.
12701         * output.h (Output_section::update_flags_for_input_section): New
12702         function.
12703         * output.cc (Output_section::add_input_section): Call
12704         update_flags_for_input_section.
12705         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12706
12707 2008-04-11  Cary Coutant  <ccoutant@google.com>
12708
12709         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12710         thought unnecessary.
12711         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12712
12713 2008-04-11  Ian Lance Taylor  <iant@google.com>
12714
12715         * output.h (class Output_section_data): Remove inline definition
12716         of set_addralign.
12717         * output.cc (Output_section_data::set_addralign): New function.
12718
12719 2008-04-11  Cary Coutant  <ccoutant@google.com>
12720
12721         Add support for TLS descriptors for i386 and x86_64.
12722         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12723         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12724         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12725         GOT_TYPE_TLS_DESC.
12726         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12727         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12728         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12729         relocations.
12730         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12731         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12732         Fix problem with initial-exec relocations.
12733         (Target_i386::Relocate::relocate_tls): Likewise.
12734         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
12735         relaxation.
12736         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
12737         support for section-plus-offset dynamic table entries.
12738         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
12739         (Output_data_dynamic::Dynamic_entry): Add support for
12740         section-plus-offset dynamic table entries.
12741         (Output_data_dynamic::Classification): Likewise.
12742         (Output_data_dynamic::classification_): Renamed offset_.
12743         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
12744         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
12745         (Target_x86_64::make_plt_section): New function.
12746         (Target_x86_64::reserve_tlsdesc_entries): New function.
12747         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
12748         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
12749         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
12750         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
12751         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
12752         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
12753         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
12754         add extra PLT entry for TLS descriptors.
12755         (Output_data_plt_x86_64::got_): New field.
12756         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
12757         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
12758         fields.
12759         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
12760         descriptors.
12761         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
12762         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
12763         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
12764         R_386_TLS_DESC_CALL relocations.
12765         (Target_x86_64::Scan::global): Likewise.
12766         (Target_x86_64::do_finalize_sections): Add dynamic table entries
12767         for TLS descriptors.
12768         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
12769         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
12770         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
12771         GD-to-IE relaxation.
12772         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
12773         and TLS_DESCRIPTORS.
12774         * Makefile.in: Rebuild.
12775         * configure: Rebuild.
12776         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
12777         (tls_test_shared2.so): New target.
12778         (tls_shared_gd_to_ie_test_SOURCES): New variable.
12779         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
12780         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
12781         (tls_shared_gd_to_ie_test_LDADD): New variable.
12782         (tls_shared_gnu2_gd_to_ie_test): New target.
12783         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
12784         New targets.
12785         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
12786         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
12787         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
12788         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
12789         (tls_shared_gnu2_test): New target.
12790         (tls_test_gnu2_shared.so): New target.
12791         (tls_shared_gnu2_test_SOURCES): New variable.
12792         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
12793         (tls_shared_gnu2_test_LDFLAGS): New variable.
12794         (tls_shared_gnu2_test_LDADD): New variable.
12795         * testsuite/Makefile.in: Rebuild.
12796         * testsuite/Makefile.
12797
12798 2008-04-11  Ian Lance Taylor  <iant@google.com>
12799
12800         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
12801         justsyms.t.
12802         * testsuite/Makefile.in: Rebuild.
12803
12804         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
12805         long.
12806         * testsuite/script_test_2.cc (main): Adjust test.
12807
12808 2008-04-11  David S. Miller  <davem@davemloft.net>
12809             Ian Lance Taylor  <iant@google.com>
12810
12811         * options.h (General_options): Add entries for '-Y' and
12812         '-relax'.
12813         * options.cc (General_options:finalize): If -Y was used, add those
12814         entries to the library path instead of the default "/lib" and
12815         "/usr/lib".
12816
12817 2008-04-11  David S. Miller  <davem@davemloft.net>
12818
12819         * testsuite/justsyms.t: Start at 0x100.
12820         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
12821         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
12822         long.
12823         * testsuite/script_test_2.cc: Adjust string and section length
12824         checks.
12825
12826 2008-04-09  Ian Lance Taylor  <iant@google.com>
12827
12828         PR gold/5996
12829         * script-sections.cc (Sections_element::allocate_to_segment): Add
12830         orphan parameter.
12831         (Output_section_definition::allocate_to_segment): Likewise.
12832         (Orphan_output_section::allocate_to_segment): Likewise.
12833         (Script_sections::attach_sections_using_phdrs_clause): Don't
12834         propagate non-PT_LOAD segments to orphan sections.
12835         * testsuite/Makefile.am (script_test_3.stdout): Generate using
12836         readelf rather than objdump.
12837         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
12838         .interp section and PT_INTERP segment are the same size.
12839         * testsuite/Makefile.in: Rebuild.
12840
12841         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
12842         aliases for symbols defined in the same object.
12843         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
12844         (weak_alias_test_SOURCES): New variable.
12845         (weak_alias_test_DEPENDENCIES): New variable.
12846         (weak_alias_test_LDFLAGS): New variable.
12847         (weak_alias_test_LDADD): New variable.
12848         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
12849         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
12850         (weak_alias_test_3.o): New target.
12851         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
12852         * testsuite/weak_alias_test_main.cc: New file.
12853         * testsuite/weak_alias_test_1.cc: New file.
12854         * testsuite/weak_alias_test_2.cc: New file.
12855         * testsuite/weak_alias_test_3.cc: New file.
12856
12857 2008-04-08  Ian Lance Taylor  <iant@google.com>
12858
12859         * options.h (class General_options): Add --noinhibit-exec option.
12860         * main.cc (main): Check --noinhibit-exec.
12861
12862         * options.h (class General_options): Define --wrap as a special
12863         option.  Add wrap_symbols_ field.
12864         (General_options::any_wrap_symbols): New function.
12865         (General_options::is_wrap_symbol): New function.
12866         * options.cc (General_options::parse_wrap): New function.
12867         (General_options::General_options): Initialize wrap_symbols_.
12868         * symtab.cc (Symbol_table::wrap_symbol): New function.
12869         (Symbol_table::add_from_object): Handle --wrap.
12870         * symtab.h (class Symbol_table): Declare wrap_symbol.
12871         * target.h (Target::wrap_char): New function.
12872         (Target::Target_info): Add wrap_char field.
12873         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
12874         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12875         * testsuite/testfile.cc (Target_test::test_target_info):
12876         Likewise.
12877
12878         * errors.cc (Errors::undefined_symbol): Mention symbol version if
12879         there is one.
12880
12881         * layout.h (class Layout): Add added_eh_frame_data_ field.
12882         * layout.cc (Layout::Layout): Initialize new field.
12883         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
12884         output section until we find a section we merged successfully.
12885         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
12886         that the size be non-zero.
12887
12888         * merge.cc (Object_merge_map::get_output_offset): Remove inline
12889         qualifier.
12890
12891 2008-04-08  Craig Silverstein  <csilvers@google.com>
12892
12893         * configure.ac: Export new conditional variable HAVE_ZLIB.
12894         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
12895         on HAVE_ZLIB.
12896         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
12897         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12898
12899 2008-04-07  Ian Lance Taylor  <iant@google.com>
12900
12901         * version.cc (version_string): Set to "1.5".
12902
12903         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
12904         Add issued_non_pic_error_ field.  Declare check_non_pic.
12905         (Target_x86_64::Scan::check_non_pic): New function.
12906         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
12907         (Target_x86_64::Scan::global): Likewise.
12908
12909         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
12910         addend parameter.  Change caller.  Handle merge sections.
12911         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
12912         Address to Addend.  Don't add in the result of
12913         local_section_offset, pass down the addend and use the returned
12914         value.
12915         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
12916         Update declarations of local_section_offset and symbol_value.
12917         * testsuite/two_file_test_1.cc (t18): New function.
12918         * testsuite/two_file_test_2.cc (f18): New function.
12919         * testsuite/two_file_test_main.cc (main): Call t18.
12920         * testsuite/two_file_test.h (t18, f18): Declare.
12921
12922         * configure.ac: Don't test for objdump, c++filt, or readelf.
12923         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
12924         conditionals.
12925         (TEST_READELF): New variable.
12926         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
12927         (check_PROGRAMS): Add two_file_strip_test.
12928         (two_file_strip_test): New target.
12929         (check_PROGRAMS): Add two_file_same_shared_strip_test.
12930         (two_file_same_shared_strip_test_SOURCES): New variable.
12931         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
12932         (two_file_same_shared_strip_test_LDFLAGS): New variable.
12933         (two_file_same_shared_strip_test_LDADD): New variable.
12934         (two_file_shared_strip.so): New target.
12935         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
12936         (ver_test_5.syms, ver_test_7.syms): Likewise.
12937         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
12938         (strip_test_3.stdout): Use TEST_OBJDUMP.
12939         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
12940
12941 2008-04-04  Cary Coutant  <ccoutant@google.com>
12942
12943         * symtab.h (Symbol::is_weak_undefined): New function.
12944         (Symbol::is_strong_undefined): New function.
12945         (Symbol::is_absolute): New function.
12946         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
12947         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
12948         absolute symbols.
12949         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
12950         (weak_undef_test): New target.
12951         * testsuite/Makefile.in: Rebuild.
12952         * testsuite/weak_undef_file1.cc: New file.
12953         * testsuite/weak_undef_file2.cc: New file.
12954         * testsuite/weak_undef_test.cc: New file.
12955
12956 2008-04-03  Craig Silverstein  <csilvers@google.com>
12957
12958         * compressed_output.h (class Output_compressed_section): Use
12959         unsigned buffer.
12960         * compressed_output.cc (zlib_compress): Use unsigned buffers,
12961         add zlib header.
12962         (zlib_compressed_suffix): Removed.
12963         (Output_compressed_section::set_final_data_size): Use unsigned
12964         buffers.
12965         * testsuite/Makefile.am (flagstest_compress_debug_sections):
12966         Fix linker invocation.
12967         (flagstest_o_specialfile_and_compress_debug_sections):
12968         Likewise.
12969         * testsuite/Makefile.in: Regenerated.
12970
12971 2008-04-02  David S. Miller  <davem@davemloft.net>
12972
12973         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
12974         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
12975
12976 2008-04-02  Craig Silverstein  <csilvers@google.com>
12977
12978         * TODO: New file.
12979
12980 2008-04-02  Ian Lance Taylor  <iant@google.com>
12981
12982         * fileread.cc (File_read::find_view): Add byteshift and vshifted
12983         parameters.  Update for new key type to views_.  Change all
12984         callers.
12985         (File_read::read): Adjust for byteshift in returned view.
12986         (File_read::add_view): New function, broken out of
12987         find_and_make_view.
12988         (File_read::make_view): New function, broken out of
12989         find_and_make_view.
12990         (File_read::find_or_make_view): Add offset and aligned
12991         parameters.  Rewrite accordingly.  Change all callers.
12992         (File_read::get_view): Add offset and aligned parameters.  Adjust
12993         for byteshift in return value.
12994         (File_read::get_lasting_view): Likewise.
12995         * fileread.h (class File_read): Update declarations.
12996         (class File_read::View): Add byteshift_ field.  Add byteshift to
12997         constructor.  Add byteshift method.
12998         * archive.h (Archive::clear_uncached_views): New function.
12999         (Archive::get_view): Add aligned parameter.  Change all callers.
13000         * object.h (Object::get_view): Add aligned parameter.  Change all
13001         callers.
13002         (Object::get_lasting_view): Likewise.
13003
13004         * fileread.cc (File_read::release): Don't call clear_views if
13005         there are multiple objects.
13006         * fileread.h (File_read::clear_uncached_views): New function.
13007         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13008         on the archive.
13009
13010 2008-03-31  Cary Coutant  <ccoutant@google.com>
13011
13012         Add thin archive support.
13013         * archive.cc (Archive::armagt): New const.
13014         (Archive::setup): Remove task parameter and calls to unlock.
13015         (Archive::unlock_nested_archives): New function.
13016         (Archive::read_header): Add nested_off parameter. Change
13017         all callers.
13018         (Archive::interpret_header): Likewise.
13019         (Archive::include_all_members): Change to handle thin
13020         archives.
13021         (Archive::include_member): Likewise.
13022         * archive.h (Archive::Archive): Add new parameters and
13023         initializers.
13024         (Archive::armagt): New const.
13025         (Archive::setup): Remove task parameter.
13026         (Archive::unlock_nested_archives): New function.
13027         (Archive::read_header): Add nested_off parameter.
13028         (Archive::interpret_header): Likewise.
13029         (Archive::Nested_archive_table): New typedef.
13030         (Archive::is_thin_archive_): New field.
13031         (Archive::nested_archives_): New field.
13032         (Archive::options_): New field.
13033         (Archive::dirpath_): New field.
13034         (Archive::task_): New field.
13035         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13036         for thin archives.  Pass additional parameters to
13037         Archive::Archive.  Unlock the archive file after calling
13038         Archive::setup.
13039
13040 2008-03-29  Ian Lance Taylor  <iant@google.com>
13041
13042         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13043         version symbol to be local.
13044         * testsuite/ver_test_4.sh: New file.
13045         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13046         (check_DATA): Add ver_test_4.syms.
13047         (ver_test_4.syms): New target.
13048         * testsuite/Makefile.in: Rebuild.
13049
13050         * output.cc
13051         (Output_section::Input_section_sort_entry::has_priority): New
13052         function.
13053         (Output_section::Input_section_sort_entry::match_file_name): New
13054         function.
13055         (Output_section::Input_section_sort_entry::match_section_name):
13056         Remove.
13057         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13058         Remove.
13059         (Output_section::Input_section_sort_entry::match_section_file):
13060         Remove.
13061         (Output_section::Input_section_sort_compare::operator()): Rewrite
13062         using new Input_section_sort_entry functions.  Sort crtbegin and
13063         crtend first.  Sort sections with no priority before sections with
13064         a priority.
13065         * testsuite/initpri1.c (d3): Check j != 4.
13066         (cd5): New constructor/destructor function.
13067         (main): Check j != 2.
13068
13069         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13070         new symbol when resolving, don't call set_is_default.
13071         * testsuite/ver_test_7.cc: New file.
13072         * testsuite/ver_test_7.sh: New file.
13073         * testsuite/Makefile.am (ver_test_7.so): New target.
13074         (ver_test_7.o): New target.
13075         (check_SCRIPTS): Add ver_test_7.sh.
13076         (check_DATA): Add ver_test_7.syms.
13077         (ver_test_7.syms): New target.
13078
13079 2008-03-28  Ian Lance Taylor  <iant@google.com>
13080
13081         * layout.cc (Layout::layout): If we see an input section with a
13082         name that needs sorting, set the must_sort flag for the output
13083         section.
13084         (Layout::make_output_section): If the name of the output section
13085         indicates that it might require sorting, set the may_sort flag.
13086         * output.h (Output_section::may_sort_attached_input_sections): New
13087         function.
13088         (Output_section::set_may_sort_attached_input_sections): New
13089         function.
13090         (Output_section::must_sort_attached_input_sections): New
13091         function.
13092         (Output_section::set_must_sort_attached_input_sections): New
13093         function.
13094         (class Output_section): Declare Input_section_sort_entry.  Define
13095         Input_section_sort_compare.  Declare
13096         sort_attached_input_sections.  Add new fields:
13097         may_sort_attached_input_sections_,
13098         must_sort_attached_input_sections_,
13099         attached_input_sections_are_sorted_.
13100         * output.cc (Output_section::Output_section): Initialize new
13101         fields.
13102         (Output_section::add_input_section): Add an entry to
13103         input_sections_ if may_sort or must_sort are true.
13104         (Output_section::set_final_data_size): Call
13105         sort_attached_input_sections if necessary.
13106         (Output_section::Input_section_sort_entry): Define new class.
13107         (Output_section::Input_section_sort_compare::operator()): New
13108         function.
13109         (Output_section::sort_attached_input_sections): New function.
13110         * configure.ac: Check whether the compiler supports constructor
13111         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13112         * testsuite/initpri1.c: New file.
13113         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13114         CONSTRUCTOR_PRIORITY.
13115         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13116         (initpri1_LDFLAGS): New variable.
13117         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13118
13119 2008-03-27  Ian Lance Taylor  <iant@google.com>
13120
13121         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13122         * testsuite/common_test_1.c: New file.
13123         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13124         (common_test_1_SOURCES): New variable.
13125         (common_test_1_DEPENDENCIES): New variable.
13126         (common_test_1_LDFLAGS): New variable.
13127
13128         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13129         and commons_ correctly when NAME/VERSION does not override
13130         NAME/NULL.
13131         * testsuite/ver_test_6.c: New file.
13132         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13133         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13134         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13135
13136 2008-03-26  Ian Lance Taylor  <iant@google.com>
13137
13138         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13139         of an undefined symbol from a version script.
13140         * testsuite/Makefile.am (ver_test_5.so): New target.
13141         (ver_test_5.o): New target.
13142         (check_SCRIPTS): Add ver_test_5.sh.
13143         (check_DATA): Add ver_test_5.syms.
13144         (ver_test_5.syms): New target.
13145         * testsuite/ver_test_5.cc: New file.
13146         * testsuite/ver_test_5.script: New file.
13147         * testsuite/ver_test_5.sh: New file.
13148         * Makefile.in, testsuite/Makefile.in: Rebuild.
13149
13150         PR gold/5986
13151         Fix problems building gold with gcc 4.3.0.
13152         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13153         (gold_error_at_location, gold_warning_at_location): Use it.
13154         * configure.ac: Check whether we can compile and use a template
13155         function with a printf attribute.
13156         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13157         when jumping over bytes.
13158         * object.cc: Instantiate Object::read_section_data.
13159         * debug.h: Include <cstring>
13160         * dwarf_reader.cc: Include <algorithm>
13161         * main.cc: Include <cstring>.
13162         * options.cc: Include <cstring>.
13163         * output.cc: Include <cstring>.
13164         * script.cc: Include <cstring>.
13165         * script.h: Include <string>.
13166         * symtab.cc: Include <cstring> and <algorithm>.
13167         * target-select.cc: Include <cstring>.
13168         * version.cc: Include <string>.
13169         * testsuite/testmain.cc: Include <cstdlib>.
13170         * configure, config.in: Rebuild.
13171
13172 2008-03-25  Ian Lance Taylor  <iant@google.com>
13173
13174         * options.cc: Include "../bfd/bfdver.h".
13175         (options::help): Print bug reporting address.
13176
13177         * version.cc (print_version): Adjust output for current value of
13178         BFD_VERSION_STRING.
13179
13180         * NEWS: New file.
13181
13182         * options.cc (options::help): Print list of supported targets.
13183         * target-select.h: Include <vector>.
13184         (class Target_selector): Make machine_, size_, and is_big_endian_
13185         fields const.  Add bfd_name_ and instantiated_target_ fields.
13186         (Target_selector::Target_selector): Add bfd_name parameter.
13187         (Target_selector::recognize): Make non-virtual, call
13188         do_recognize.
13189         (Target_selector::recognize_by_name): Make non-virtual, call
13190         do_recognize_by_name.
13191         (Target_selector::supported_names): New function.
13192         (Target_selector::bfd_name): New function.
13193         (Target_selector::do_instantiate_target): New pure virtual
13194         function.
13195         (Target_selector::do_recognize): New virtual function.
13196         (Target_selector::do_recognize_by_name): New virtual function.
13197         (Target_selector::instantiate_target): New private function.
13198         (supported_target_names): Declare.
13199         * target-select.cc (Target_selector::Target_selector): Update for
13200         new parameter and fields.
13201         (select_target_by_name): Check that the name matches before
13202         calling recognize_by_name.
13203         (supported_target_names): New function.
13204         * i386.cc (class Target_selector_i386): Update Target_selector
13205         constructor call.  Remove recognize and recognize_by_name.  Add
13206         do_instantiate_target.
13207         * x86_64.cc (class Target_selector_x86_64): Likewise.
13208         * testsuite/testfile.cc (class Target_selector_test): Update for
13209         changes to Target_selector.
13210
13211         * README: Rewrite, with some notes on unsupported features.
13212
13213 2008-03-24  Cary Coutant  <ccoutant@google.com>
13214
13215         * i386.cc (Target_i386::Got_type): New enum declaration.
13216         (Target_i386::Scan::local): Updated callers of Output_data_got
13217         member functions.
13218         (Target_i386::Scan::global): Likewise.
13219         (Target_i386::Relocate::relocate): Likewise.
13220         (Target_i386::Relocate::relocate_tls): Likewise.
13221         * object.h (Got_offset_list): New class.
13222         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13223         (Sized_relobj::local_got_offset): Likewise.
13224         (Sized_relobj::set_local_got_offset): Likewise.
13225         (Sized_relobj::local_has_tls_got_offset): Removed.
13226         (Sized_relobj::local_tls_got_offset): Removed.
13227         (Sized_relobj::set_local_tls_got_offset): Removed.
13228         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13229         * output.cc (Output_data_got::add_global): Added got_type parameter.
13230         (Output_data_got::add_global_with_rel): Likewise.
13231         (Output_data_got::add_global_with_rela): Likewise.
13232         (Output_data_got::add_global_pair_with_rel): New function.
13233         (Output_data_got::add_global_pair_with_rela): New function.
13234         (Output_data_got::add_local): Added got_type parameter.
13235         (Output_data_got::add_local_with_rel): Likewise.
13236         (Output_data_got::add_local_with_rela): Likewise.
13237         (Output_data_got::add_local_pair_with_rel): New function.
13238         (Output_data_got::add_local_pair_with_rela): New function.
13239         (Output_data_got::add_global_tls): Removed.
13240         (Output_data_got::add_global_tls_with_rel): Removed.
13241         (Output_data_got::add_global_tls_with_rela): Removed.
13242         (Output_data_got::add_local_tls): Removed.
13243         (Output_data_got::add_local_tls_with_rel): Removed.
13244         (Output_data_got::add_local_tls_with_rela): Removed.
13245         * output.h (Output_data_got::add_global): Added got_type parameter.
13246         (Output_data_got::add_global_with_rel): Likewise.
13247         (Output_data_got::add_global_with_rela): Likewise.
13248         (Output_data_got::add_global_pair_with_rel): New function.
13249         (Output_data_got::add_global_pair_with_rela): New function.
13250         (Output_data_got::add_local): Added got_type parameter.
13251         (Output_data_got::add_local_with_rel): Likewise.
13252         (Output_data_got::add_local_with_rela): Likewise.
13253         (Output_data_got::add_local_pair_with_rel): New function.
13254         (Output_data_got::add_local_pair_with_rela): New function.
13255         (Output_data_got::add_global_tls): Removed.
13256         (Output_data_got::add_global_tls_with_rel): Removed.
13257         (Output_data_got::add_global_tls_with_rela): Removed.
13258         (Output_data_got::add_local_tls): Removed.
13259         (Output_data_got::add_local_tls_with_rel): Removed.
13260         (Output_data_got::add_local_tls_with_rela): Removed.
13261         * resolve.cc (Symbol::override_base_with_special): Removed
13262         reference to has_got_offset_ field.
13263         * symtab.cc (Symbol::init_fields): Replaced initialization
13264         of got_offset_ with got_offsets_.  Removed initialization
13265         of has_got_offset_
13266         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13267         (Symbol::got_offset): Likewise.
13268         (Symbol::set_got_offset): Likewise.
13269         (Symbol::has_tls_got_offset): Removed.
13270         (Symbol::tls_got_offset): Removed.
13271         (Symbol::set_tls_got_offset): Removed.
13272         (Symbol::got_offset_): Removed.
13273         (Symbol::tls_mod_got_offset_): Removed.
13274         (Symbol::tls_pair_got_offset_): Removed.
13275         (Symbol::got_offsets_): New field.
13276         (Symbol::has_got_offset): Removed.
13277         (Symbol::has_tls_mod_got_offset): Removed.
13278         (Symbol::has_tls_pair_got_offset): Removed.
13279         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13280         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13281         member functions.
13282         (Target_x86_64::Scan::global): Likewise.
13283         (Target_x86_64::Relocate::relocate): Likewise.
13284         (Target_x86_64::Relocate::relocate_tls): Likewise.
13285
13286 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13287
13288         * yyscript.y: Fix spelling error in comment.
13289
13290 2008-03-24  Ian Lance Taylor  <iant@google.com>
13291
13292         * options.h (class General_options): Define build_id option.
13293         * layout.h (class Layout): Declare write_build_id, create_note,
13294         create_build_id.  Add build_id_note_ member.
13295         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13296         "libiberty.h", "md5.h", "sha1.h".
13297         (Layout::Layout): Initialize eh_frame_data_,
13298         eh_frame_hdr_section_, and build_id_note_.
13299         (Layout::finalize): Call create_build_id.
13300         (Layout::create_note): New function, broken out of
13301         Layout::create_gold_note.
13302         (Layout::create_gold_note): Call create_note.
13303         (Layout::create_build_id): New function.
13304         (Layout::write_build_id): New function.
13305         (Close_task_runner::run): Call write_build_id.
13306
13307         * x86_64.cc: Correct license to GPLv3.
13308
13309 2008-03-23  Ian Lance Taylor  <iant@google.com>
13310
13311         * options.cc: Include "demangle.h".
13312         (parse_optional_string): New function.
13313         (parse_long_option): Handle takes_optional_argument.
13314         (parse_short_option): Update dash_z initializer.  Handle
13315         takes_optional_argument.
13316         (General_options::General_options): Initialize do_demangle_.
13317         (General_options::finalize): Set do_demangle_.  Handle demangling
13318         style.
13319         * options.h (parse_optional_string): Declare.
13320         (struct One_option): Add optional_arg field.  Update constructor.
13321         Update call constructor calls.  Add takes_optional_argument
13322         function.
13323         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13324         (DEFINE_optional_string): Define.
13325         (General_options::demangle): Change from DEFINE_bool to
13326         DEFINE_optional_string.
13327         (General_options::no_demangle): New function.
13328         (General_options::do_demangle): New function.
13329         (General_options::set_do_demangle): New function.
13330         (General_options::execstack_status_): Move definition to end of
13331         class definition.
13332         (General_options::static_): Likewise.
13333         (General_options::do_demangle_): New field.
13334         * object.cc (big_endian>::get_symbol_location_info): Call
13335         Options::do_demangle, not Options::demangle.
13336         * symtab.cc (demangle): Likewise.
13337
13338 2008-03-22  Ian Lance Taylor  <iant@google.com>
13339
13340         * gold.h: Include <cstddef> and <sys/types.h>
13341         * options.h: Include <cstring>.
13342
13343 2008-03-21  Ian Lance Taylor  <iant@google.com>
13344
13345         * Added source code to GNU binutils.