2012-09-06 Cary Coutant <ccoutant@google.com>
[external/binutils.git] / gold / ChangeLog
1 2012-09-06  Cary Coutant  <ccoutant@google.com>
2
3         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
5         (Dwarf_die::skip_attributes): Likewise.
6         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
7         * testsuite/gdb_index_test.cc (inline_func_1): New function.
8         (main): Call it.
9         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
10
11 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
12
13         * testsuite/script_test_3.t: Add .got.plt output section
14         statement.
15         * testsuite/script_test_4.t: Likewise.
16
17 2012-09-05  Alan Modra  <amodra@gmail.com>
18
19         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
20         update all uses and lose "enum" when using type.
21
22 2012-09-05  Alan Modra  <amodra@gmail.com>
23
24         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
25         * configure: Regenerate.
26         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
27         (plugin_final_layout.stdout): Likewise.
28         (memory_test): Set page sizes to 0x1000.
29         * testsuite/Makefile.in: Regenerate.
30         * testsuite/discard_locals_test.sh: Add FIXME comment.
31         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
32         * testsuite/pr14265.t: Add .got output section statement.
33         * testsuite/script_test_2.t: Likewise.
34         * testsuite/script_test_3.t: Likewise.
35         * testsuite/script_test_4.t: Likewise.
36         * testsuite/script_test_5.t: Likewise.
37         * testsuite/script_test_6.t: Likewise.
38         * testsuite/script_test_7.t: Likewise.
39         * testsuite/script_test_9.t: Likewise.
40
41 2012-09-05  Alan Modra  <amodra@gmail.com>
42
43         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
44         (Powerpc_relocate_functions::Status): New typedef.
45         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
46         (Target_powerpc::Scan::local): Handle REL64.
47         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
48         for REL32 and REL64.
49         (Target_powerpc::symval_for_branch): New function, extracted from..
50         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
51         checks.  Report overflow errors.
52
53 2012-09-05  Alan Modra  <amodra@gmail.com>
54
55         * object.h (Sized_relobj_file::emit_relocs): Delete.
56         (Sized_relobj_file::emit_relocs_reltype): Delete.
57         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
58         relocate_relocs for --emit-relocs.
59         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
60         * output.h: Update comment.
61         (Output_segment::first_section): New function.
62         (Output_segment::first_section_load_address): Use first_section.
63         * output.cc (Output_segment::first_section): New function extracted..
64         (Output_segment::first_section_load_address): ..from here.  Delete.
65         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
66         * target.h (Sized_target::relocate_for_relocatable): Likewise.
67         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
68         adjust call to target.h function.
69         * i386.cc (Target_i386): Likewise.
70         * sparc.cc (Target_sparc): Likewise.
71         * x86_64.cc (Target_x86_64): Likewise.
72         * powerpc.cc (Target_powerpc): Likewise.
73         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
74         first tls section has section symbol for optimised local dynamic
75         output relocs.
76         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
77         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
78         optimised tls code.
79         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
80         Rename to relocate_relocs.  Update error message.
81
82 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
83
84         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
85         --just-symbols.
86
87 2012-08-31  Alan Modra  <amodra@gmail.com>
88
89         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
90         (Powerpc_relobj::toc_base_offset): New stub function.
91         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
92         got_mod_index_offset to tlsld_got_offset.  Update all refs.
93         (Target_powerpc::Relocate::enum skip_tls): New.
94         (Target_powerpc::call_tls_get_addr_): New var.
95         (Target_powerpc::is_branch_reloc): Move to file scope.
96         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
97         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
98         New functions.
99         (Target_powerpc::enum Got_type): Delete old values, add new ones.
100         (powerpc_info): Correct common_pagesize for ppc64.
101         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
102         (Powerpc_relocate_functions): Add overflow check enums and functions.
103         Add non-shift version of rela, rela_ua.  Delete all rel public
104         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
105         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
106         addr16_ha3, addr14 functions.
107         (Output_data_got_powerpc::add_constant_pair): New function.
108         (Output_data_got_powerpc::got_base_offset): Likewise.
109         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
110         (instruction constants): Sort, add some more.
111         (Output_data_glink::do_write): Add and use Address typedef.  Use
112         object->toc_base_offset() stub for 64-bit.
113         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
114         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
115         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
116         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
117         Always treat .opd relocs as against locally defined symbol.
118         Correct condition for RELATIVE relocs.
119         (Target_powerpc::do_finalize_sections): Test for NULL sections.
120         (Target_powerpc::Relocate::relocate): Use plt call stub as value
121         for 32-bit syms with a plt entry.  Correct ppc64 toc base
122         calculations.  Handle TLS relocs, and more.  Add overflow
123         checking and adjust for Powerpc_relocate_functions changes.
124         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
125         Reinstate --emit-relocs code with FIXME.
126
127 2012-08-30  Alan Modra  <amodra@gmail.com>
128
129         * layout.cc (Layout::set_segment_offsets): Set p_align to
130         abi_pagesize, not common_pagesize.
131         (Layout::relaxation_loop_body): Similarly use abi_pagesize
132         to determine whether file header can go in segment.
133
134 2012-08-30  Alan Modra  <amodra@gmail.com>
135
136         * output.h (Output_reloc::Output_reloc <output section>): Add
137         is_relative param.  Adjust calls.
138         (Output_reloc::add_output_section_relative): New functions.
139         * output.cc (Output_reloc::Output_reloc <output section>): Handle
140         is_relative.
141         (Output_reloc::symbol_value): Handle SECTION_CODE.
142
143 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
144
145         * gold.cc (queue_middle_tasks): Call layout again when unique
146         segments for sections is desired.
147         * layout.cc (Layout::Layout): Initialize new members.
148         (Layout::get_output_section_flags): New function.
149         (Layout::choose_output_section): Call get_output_section_flags.
150         (Layout::layout): Make output section for mapping to a unique segment.
151         (Layout::insert_section_segment_map): New function.
152         (Layout::attach_allocated_section_to_segment): Make unique segment for
153         output sections marked so.
154         (Layout::segment_precedes): Check for unique segments when sorting.
155         * layout.h (Layout::Unique_segment_info): New struct.
156         (Layout::Section_segment_map): New typedef.
157         (Layout::insert_section_segment_map): New function.
158         (Layout::get_output_section_flags): New function.
159         (Layout::is_unique_segment_for_sections_specified): New function.
160         (Layout::set_unique_segment_for_sections_specified): New function.
161         (Layout::unique_segment_for_sections_specified_): New member.
162         (Layout::section_segment_map_): New member.
163         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
164         Rename is_gc_pass_one to is_pass_one.
165         Rename is_gc_pass_two to is_pass_two.
166         Rename is_gc_or_icf to is_two_pass.
167         Check for which pass based on whether symbols data is present.
168         Make it two pass when unique segments for sections is desired.
169         * output.cc (Output_section::Output_section): Initialize new
170         members.
171         * output.h (Output_section::is_unique_segment): New function.
172         (Output_section::set_is_unique_segment): New function.
173         (Output_section::is_unique_segment_): New member.
174         (Output_section::extra_segment_flags): New function.
175         (Output_section::set_extra_segment_flags): New function.
176         (Output_section::extra_segment_flags_): New member.
177         (Output_section::segment_alignment): New function.
178         (Output_section::set_segment_alignment): New function.
179         (Output_section::segment_alignment_): New member.
180         (Output_segment::Output_segment): Initialize is_unique_segment_.
181         (Output_segment::is_unique_segment): New function.
182         (Output_segment::set_is_unique_segment): New function.
183         (Output_segment::is_unique_segment_): New member.
184         * plugin.cc (allow_unique_segment_for_sections): New function.
185         (unique_segment_for_sections): New function.
186         (Plugin::load): Add new functions to transfer vector.
187         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
188         * Makefile.in: Regenerate.
189         * testsuite/plugin_final_layout.sh: Check if unique segment
190         functionality works.
191         * testsuite/plugin_section_order.c (onload): Check if new interfaces
192         are available.
193         (allow_unique_segment_for_sections): New global.
194         (unique_segment_for_sections): New global.
195         (claim_file_hook): Call allow_unique_segment_for_sections.
196         (all_symbols_read_hook): Call unique_segment_for_sections.
197
198 2012-08-22  Cary Coutant  <ccoutant@google.com>
199
200         * layout.cc (Layout::include_section): Don't assert on GROUP
201         sections with --emit-relocs.
202
203 2012-08-21  Cary Coutant  <ccoutant@google.com>
204
205         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
206         if --export-dynamic-symbol names an undef symbol.
207
208 2012-08-18  Alan Modra  <amodra@gmail.com>
209
210         * powerpc.cc: Formatting and white space.
211         (Powerpc_relobj): Rename got2_section_ to special_.
212         Add opd_ent_shndx_ and opd_ent_off_ vectors.
213         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
214         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
215         (Target_powerpc): Add Address typedef and invalid_address.  Use
216         throughout.
217         (Target_powerpc::is_branch_reloc): New function.
218         (Powerpc_relocate_functions): Add Address typedef, use throughout.
219         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
220         for dst_mask, value and addend.
221         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
222         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
223         (Output_data_glink::do_write): Correct toc base.  Don't try to use
224         uint16_t for 24-bit offset.  Use get_output_section_offset and
225         check return.
226         (Target_powerpc::Scan::local): Handle more relocs.
227         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
228         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
229         Plug in toc restoring insn after plt calls.  Translate branches
230         to function descriptor symbols to corresponding entry point.
231         (Target_powerpc::relocate_for_relocatable): Check return from
232         get_output_section_offset.
233         * symtab.h: Comment typo.
234
235 2012-08-14  Ian Lance Taylor  <iant@google.com>
236
237         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
238         unsupported_relocal_local to call unsupported_reloc_global.
239
240 2012-08-14  Nick Clifton  <nickc@redhat.com>
241
242         PR ld/14265
243         * script-sections.cc (Sections_element::output_section_name): Add
244         keep return parameter.
245         (Output_section_element::match_name): Add keep return parameter.
246         Return the value of the keep_ member.
247         * script-sections.h (class Output_section): Update
248         output_section_name prototype.
249         * layout.cc (Layout::keep_input_section): New public member
250         function.
251         (Layout::choose_output_section): Pass keep parameter to
252         output_section_name.
253         * layout.h (class Layout): Add keep_input_section.
254         * object.cc (Sized_relobj_file::do_layout): Check for kept input
255         sections.
256         * testsuite/Makefile.am: Add a test.
257         * testsuite/Makefile.in: Regenerate.
258         * testsuite/pr14265.c: Source file for the test.
259         * testsuite/pr14265.t: Linker script for the test.
260         * testsuite/pr14265.sh: Shell script for the test.
261
262 2012-08-14  Alan Modra  <amodra@gmail.com>
263
264         * target.h (Target::output_section_name): New function.
265         (Target::do_output_section_name): New function.
266         * layout.cc (Layout::choose_output_section): Call the above.
267         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
268
269 2012-08-14  Alan Modra  <amodra@gmail.com>
270
271         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
272         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
273         for replace_constant call.
274         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
275         (Output_data_glink::do_print_to_mapfile): New function.
276         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
277         (Target_powerpc::Relocate::relocate): Likewise.
278
279 2012-08-14  Alan Modra  <amodra@gmail.com>
280
281         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
282         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
283         (Output_data_glink::add_entry,find_entry): Remove shndx param.
284         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
285         all references to shndx_.  Handle special case for R_PPC_PLTREL24
286         here.
287         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
288         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
289         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
290         here.
291         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
292         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
293
294 2012-08-12  Alan Modra  <amodra@gmail.com>
295
296         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
297         (glink insn constants): Use uint32_t.
298         (Output_data_glink::add_entry): Use insert, not [] operator.
299
300 2012-08-11  Alan Modra  <amodra@gmail.com>
301
302         * object.h (Sized_relobj_file::find_shdr): New function.
303         (Sized_relobj_file::find_special_sections): New function.
304         * object.cc (Sized_relobj_file::find_shdr): New function.
305         (Sized_relobj_file::find_eh_frame): Use find_shdr.
306         (Sized_relobj_file::find_special_sections): New function, split out..
307         (Sized_relobj_file::do_read_symbols): ..from here.
308         * output.h (Output_data_got::replace_constant): New function.
309         (Output_data_got::num_entries): New function.
310         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
311         (Output_data_got::got_offset): Protected rather than private.
312         (Output_data_got::replace_got_entry): New function.
313         * output.cc (Output_data_got::replace_got_entry): New function.
314         * powerpc.cc (class Powerpc_relobj): New.
315         (class Powerpc_relocate_functions): Delete all psymval variants or
316         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
317         Implement _ha functions using corresponding _hi function.
318         (Powerpc_relobj::find_special_sections): New function.
319         (Target_powerpc::do_make_elf_object): New function.
320         (class Output_data_got_powerpc): New.
321         (class Output_data_glink): New.
322         (class Powerpc_scan_relocatable_reloc): New.
323         Many more changes througout file.
324
325 2012-08-09  Nick Clifton  <nickc@redhat.com>
326
327         * po/vi.po: Updated Vietnamese translation.
328
329 2012-08-07  Ian Lance Taylor  <iant@google.com>
330
331         * layout.cc (Layout::add_target_dynamic_tags): If
332         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
333         plt_rel.
334
335 2012-07-30  Nick Clifton  <nickc@redhat.com>
336
337         * po/gold.pot: Updated template.
338         * po/es.po: Updated Spanish translation.
339
340 2012-07-18  Cary Coutant  <ccoutant@google.com>
341
342         PR gold/14344
343         * configure.ac: Add check for -gpubnames support.
344         * configure: Regenerate.
345         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
346         support; force -gno-pubnames.
347         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
348         support.
349         (gdb_index_test_4): New test.
350         * testsuite/Makefile.in: Regenerate.
351         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
352         * testsuite/gdb_index_test_2.sh: Likewise.
353         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
354         * testsuite/gdb_index_test_4.sh: New script.
355         * testsuite/gdb_index_test_comm.sh: New script with common code;
356         don't look for space after colon.
357
358 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
359
360         * gold.cc (queue_middle_tasks): Update function order only after
361         deferred objects due to plugins are processed.
362
363 2012-07-11  Ian Lance Taylor  <iant@google.com>
364
365         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
366         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
367         (Target_arm::scan_reloc_for_stub): Likewise.
368         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
369         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
370         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
371         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
372         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
373
374 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
375             Ian Lance Taylor  <iant@google.com>
376
377         PR gold/14309
378         * configure.ac: Test whether std::tr1::hash<off_t> works.
379         * gold.h: Add a specialization for std::tr1::hash<off_t> if
380         needed.
381         * output.h (class Output_fill): Add virtual destructor.
382         * configure, config.in: Rebuild.
383
384 2012-06-22  Roland McGrath  <mcgrathr@google.com>
385
386         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
387
388 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
389
390         * plugin.cc (Plugin::load): Handle position independent executables.
391
392 2012-06-06  Cary Coutant  <ccoutant@google.com>
393
394         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
395         add .debug_macro.
396         (lines_only_debug_sections): Likewise.
397         (gdb_fast_lookup_sections): New static array.
398         (is_gdb_debug_section): Rename formal parameter.
399         (is_lines_only_debug_section): Likewise.
400         (is_gdb_fast_lookup_section): New function.
401         (Layout::include_section): Check for ".zdebug_" prefix; pass
402         section name suffix to is_gdb_debug_section, et al.; check for
403         fast-lookup sections when building .gdb_index.
404         * options.h (--strip-debug-gdb): Update GDB version number.
405
406 2012-06-06  Cary Coutant  <ccoutant@google.com>
407
408         * configure.ac: Add check for fallocate.
409         * configure: Regenerate.
410         * config.in: Regenerate.
411
412         * options.h (class General_options): Add --mmap-output-file and
413         --posix-fallocate options.
414         * output.cc: (posix_fallocate): Remove; replace with...
415         (gold_fallocate): New function.
416         (Output_file::map_no_anonymous): Call gold_fallocate.
417         (Output_file::map): Check --mmap-output-file option.
418
419 2012-06-05  Jing Yu  <jingyu@google.com>
420
421         * gold.h (textdomain): Add do {} to empty while(0).
422         (bindtextdomain): Likewise.
423
424 2012-06-04  Cary Coutant  <ccoutant@google.com>
425
426         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
427         has_dynsym_index.
428
429 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
430
431         * symtab.cc (Symbol_table::define_special_symbol):
432         Initialize *poldsym to prevent uninitialized variable errors.
433
434 2012-05-23  Cary Coutant  <ccoutant@google.com>
435
436         * layout.cc (Layout::section_name_mapping): Add rules to handle
437         exact match on .data.rel.ro.local or .data.rel.ro.
438         (Layout::output_section_name): Check for exact matches.
439
440 2012-05-23  Cary Coutant  <ccoutant@google.com>
441
442         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
443         more carefully.
444
445 2012-05-22  Cary Coutant  <ccoutant@google.com>
446
447         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
448         object before exporting symbol.
449
450 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
451
452         * testsuite/tls_test.cc: Include "config.h" first.
453         * testsuite/tls_test_c.c: Likewise.
454
455 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
456             Nick Clifton  <nickc@redhat.com>
457
458         PR 14072
459         * configure.in: Add check that sysdep.h has been included before
460         any system header files.
461         * configure: Regenerate.
462         * config.in: Regenerate.
463
464 2012-05-14  Cary Coutant  <ccoutant@google.com>
465
466         * layout.cc (Layout::make_output_section): Mark .tdata section
467         as RELRO.
468         * testsuite/relro_test.cc: Add a TLS variable.
469
470 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
471
472         PR gold/14091
473         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
474         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
475         R_X86_64_64.
476
477 2012-05-08  Cary Coutant  <ccoutant@google.com>
478
479         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
480         (lines_only_debug_sections): Likewise.
481
482 2012-05-02  Roland McGrath  <mcgrathr@google.com>
483
484         * nacl.cc: New file.
485         * nacl.h: New file.
486         * Makefile.am (CCFILES, HFILES): Add them.
487         * Makefile.in: Regenerate.
488         * i386.cc (Output_data_plt_i386_nacl): New class.
489         (Output_data_plt_i386_nacl_exec): New class.
490         (Output_data_plt_i386_nacl_dyn): New class.
491         (Target_i386_nacl): New class.
492         (Target_selector_i386_nacl): New class.
493         (target_selector_i386): Use it instead of Target_selector_i386.
494         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
495         (Target_x86_64_nacl): New class.
496         (Target_selector_x86_64_nacl): New class.
497         (target_selector_x86_64, target_selector_x32): Use it instead of
498         Target_selector_x86_64.
499         * arm.cc (Output_data_plt_arm_nacl): New class.
500         (Target_arm_nacl): New class.
501         (Target_selector_arm_nacl): New class.
502         (target_selector_arm, target_selector_armbe): Use it instead of
503         Target_selector_arm.
504
505         * target-select.cc (select_target): Take new Input_file* and off_t
506         arguments, pass them on to recognize method of selector.
507         * object.cc (make_elf_sized_object): Update caller.
508         * parameters.cc (parameters_force_valid_target): Likewise.
509         * incremental.cc (make_sized_incremental_binary): Likewise.
510         * target-select.h: Update decl.
511         (Target_selector::recognize): Take new Input_file* argument,
512         pass it on to do_recognize.
513         (Target_selector::do_recognize): Take new Input_file* argument.
514         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
515         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
516         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
517         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
518
519         * target.h (Target::Target_info): New members isolate_execinstr
520         and rosegment_gap.
521         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
522         * arm.cc (Target_arm::arm_info): Update initializer.
523         * i386.cc (Target_i386::i386_info): Likewise.
524         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
525         * sparc.cc (Target_sparc::sparc_info): Likewise.
526         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
527         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
528         * layout.cc (Layout::attach_allocated_section_to_segment):
529         Take new const Target* argument.  If target->isolate_execinstr(), act
530         like --rosegment.
531         (Layout::find_first_load_seg): Take new const Target* argument;
532         if target->isolate_execinstr(), reject PF_X segments.
533         (Layout::relaxation_loop_body): Update caller.
534         (Layout::set_segment_offsets): If target->isolate_execinstr(),
535         reset file offset to zero when we hit LOAD_SEG, and then do a second
536         loop over the segments before LOAD_SEG to reassign offsets after
537         addresses have been determined.  Handle target->rosegment_gap().
538         (Layout::attach_section_to_segment): Take new const Target* argument;
539         pass it to attach_allocated_section_to_segment.
540         (Layout::make_output_section): Update caller.
541         (Layout::attach_sections_to_segments): Take new const Target* argument;
542         pass it to attach_section_to_segment.
543         * gold.cc (queue_middle_tasks): Update caller.
544         * layout.h (Layout): Update method decls with new arguments.
545
546         * arm.cc (Target_arm::Target_arm): Take optional argument for the
547         Target_info pointer to use.
548         (Target_arm::do_make_data_plt): New virtual method.
549         (Target_arm::make_data_plt): New method that calls it.
550         (Target_arm::make_plt_entry): Use it.
551         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
552         for the section alignment.
553         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
554         method.
555         (Output_data_plt_arm::first_plt_entry_offset): Call it.
556         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
557         method.
558         (Output_data_plt_arm::get_plt_entry_size): Call it.
559         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
560         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
561         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
562         method.
563         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
564         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
565         method instead of sizeof(plt_entry).
566         (Output_data_plt_arm::add_entry): Likewise.
567         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
568         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
569         than static method.
570         (Target_arm::plt_entry_size): Likewise.
571         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
572         Move to ...
573         (Output_data_plt_arm_standard): ... here, new class.
574         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
575         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
576         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
577
578         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
579         Take additional argument for the PLT entry size.
580         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
581         Use get_plt_entry_size method rather than plt_entry_size variable.
582         (Output_data_plt_x86_64::reserve_slot): Likewise.
583         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
584         (Output_data_plt_x86_64::add_entry): Likewise.
585         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
586         (Output_data_plt_x86_64::address_for_global): Likewise.
587         (Output_data_plt_x86_64::address_for_local): Likewise.
588         (Output_data_plt_x86_64::set_final_data_size): Likewise.
589         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
590         Make method non-static.
591         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
592         method.
593         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
594         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
595         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
596         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
597         virtual method.
598         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
599         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
600         virtual method.
601         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
602         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
603         virtual method.
604         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
605         (Output_data_plt_x86_64::plt_entry_size)
606         (Output_data_plt_x86_64::first_plt_entry)
607         (Output_data_plt_x86_64::plt_entry)
608         (Output_data_plt_x86_64::tlsdesc_plt_entry)
609         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
610         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
611         (Output_data_plt_x86_64_standard): ... here, new class.
612         (Target_x86_64::Target_x86_64): Take optional argument for the
613         Target_info pointer to use.
614         (Target_x86_64::do_make_data_plt): New virtual method.
615         (Target_x86_64::make_data_plt): New method to call it.
616         (Target_x86_64::init_got_plt_for_update): Use that.
617         Call this->plt_->add_eh_frame method here.
618         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
619         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
620         rather than static method.
621         (Target_x86_64::plt_entry_size): Likewise.
622         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
623         rather than plt_entry_size variable.  Move guts of PLT filling to...
624         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
625         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
626         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
627
628         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
629         additional argument for the section alignment.
630         Don't do add_eh_frame_for_plt here.
631         (Output_data_plt_i386::first_plt_entry_offset): Make the method
632         non-static.  Use get_plt_entry_size method rather than plt_entry_size
633         variable.
634         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
635         method.
636         (Output_data_plt_i386::get_plt_entry_size): Call it.
637         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
638         (Output_data_plt_i386::add_eh_frame): New method to call it.
639         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
640         method.
641         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
642         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
643         method.
644         (Output_data_plt_i386::fill_plt_entry): New method to call it.
645         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
646         method instead of plt_entry_size.
647         (Output_data_plt_i386::plt_entry_size)
648         (Output_data_plt_i386::plt_eh_frame_fde_size)
649         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
650         (Output_data_plt_i386_standard): ... here, new class.
651         (Output_data_plt_i386_exec): New class.
652         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
653         (Output_data_plt_i386_exec::first_plt_entry): ... here.
654         (Output_data_plt_i386::exec_plt_entry): Move to ...
655         (Output_data_plt_i386_exec::plt_entry): ... here.
656         (Output_data_plt_i386_dyn): New class.
657         (Output_data_plt_i386::first_plt_entry): Move to ...
658         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
659         (Output_data_plt_i386::dyn_plt_entry): Move to ...
660         (Output_data_plt_i386_dyn::plt_entry): ... here.
661         (Target_i386::Target_i386): Take optional argument for the Target_info
662         pointer to use.
663         (Target_i386::do_make_data_plt): New virtual method.
664         (Target_i386::make_data_plt): New method to call it.
665         (Target_i386::make_plt_section): Use that.
666         Call this->plt_->add_eh_frame method here.
667         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
668         rather than plt_entry_size variable.
669         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
670         (Output_data_plt_i386::address_for_local): Likewise.
671         (Output_data_plt_i386::do_write): Likewise.
672         Move guts of PLT filling to...
673         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
674         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
675         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
676         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
677
678 2012-05-01  Cary Coutant  <ccoutant@google.com>
679
680         * dwarf_reader.cc (Dwarf_die::read_attributes)
681         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
682         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
683         * reduced_debug_output.cc
684         (Output_reduced_debug_info_section::get_die_end): Remove
685         DW_FORM_GNU_ref_index.  Add default case.
686
687 2012-04-26  Mark Wielaard  <mjw@redhat.com>
688
689         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
690         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
691         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
692         DW_AT_high_pc as offset from DW_AT_low_pc.
693
694         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
695         * testsuite/Makefile.in: Regenerate.
696         * testsuite/gdb_index_test_3.c: New test source file.
697         * testsuite/gdb_index_test_3.sh: New test source file.
698
699 2012-04-25  Ian Lance Taylor  <iant@google.com>
700
701         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
702         pointer.
703         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
704         as a class, not a struct.
705         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
706         (Target_arm::apply_cortex_a8_workaround): Likewise.
707         * gc.h: Declare Reloc_types as a struct, not a class.
708         * object.h: Declare Symbols_data as a struct.
709         * reloc.h: Declare Read_relocs_data as a struct.
710         * target.h: Declare Relocate_info as a struct.
711
712 2012-04-24  David S. Miller  <davem@davemloft.net>
713
714         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
715         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
716         and R_SPARC_WPLT30.
717
718 2012-04-24  Cary Coutant  <ccoutant@google.com>
719
720         * incremental-dump.cc (find_input_containing_global): Replace
721         magic number with symbolic constant.
722         (dump_incremental_inputs): Update version number.
723         * incremental.cc (Output_section_incremental_inputs): Update version
724         number; import symbolic constants from Incremental_inputs_reader.
725         (Incremental_inputs::create_data_sections): Align relocations
726         section correctly for 64-bit targets.
727         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
728         constants; add padding.
729         (Output_section_incremental_inputs::write_header): Add assert for
730         header_size.
731         (Output_section_incremental_inputs::write_input_files): Add assert
732         for input_entry_size.
733         (Output_section_incremental_inputs::write_info_blocks): Add padding;
734         add assert for object_info_size, input_section_entry_size,
735         global_sym_entry_size.
736         * incremental.h (Incremental_inputs_reader): Add symbolic constants
737         for data structure sizes; use them.
738         (Incremental_input_entry_reader): Import symbolic constants from
739         Incremental_inputs_reader; use them.
740
741 2012-04-23  David S. Miller  <davem@davemloft.net>
742
743         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
744         and elf_flags_set_.
745         (Target_sparc::Target_sparc): Initialize new fields.
746         (Target_sparc::do_make_elf_object): New function.
747         (Target_sparc::do_adjust_elf_header): New function.
748
749 2012-04-23  Cary Coutant  <ccoutant@google.com>
750
751         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
752         CU range table of gdb index.
753
754 2012-04-20  David S. Miller  <davem@davemloft.net>
755
756         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
757         instead of false.
758
759 2012-04-16  David S. Miller  <davem@davemloft.net>
760
761         * sparc.cc (Target_sparc::got_address): New function.
762         (Sparc_relocate_functions::gdop_hix22): New function.
763         (Sparc_relocate_functions::gdop_lox10): New function.
764         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
765         relocs.
766         (Target_sparc::Scan::local): Likewise if the global symbol is not
767         preemptible and is not IFUNC.
768         (Target_sparc::Relocate::relocate): Perform GOTDATA code
769         transformations for local and non-preemptible non-IFUNC global
770         symbols.
771
772         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
773         writing out 64-bit part of ranges.
774
775         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
776         -fpic and -fpie respectively.
777         * Makefile.in: Regenerate.
778
779         * sparc.cc (class Target_sparc): Add rela_ifunc_.
780         (Target_sparc::Target_sparc): Initialize new field.
781         (Target_sparc::do_plt_section_for_global): New function.
782         (Target_sparc::do_plt_section_for_local): New function.
783         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
784         (Target_sparc::make_plt_section): New function, broken out of
785         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
786         (Target_sparc::make_plt_entry): Call make_plt_section.
787         (Target_sparc::make_local_ifunc_plt_entry): New function.
788         (Target_sparc::rela_ifunc_section): New function.
789         (Target_sparc::plt_section): Remove const.
790         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
791         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
792         and ifunc_count_ fields.
793         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
794         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
795         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
796         (Output_data_plt_sparc::rela_ifunc): New function.
797         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
798         (Output_data_plt_sparc::has_ifunc_section): New function.
799         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
800         (Output_data_plt_sparc::address_for_global): New function.
801         (Output_data_plt_sparc::address_for_local): New function.
802         (Output_data_plt_sparc::plt_index_to_offset): New function.
803         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
804         and entry_count.
805         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
806         entry_count.
807         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
808         R_SPARC_JMP_IREL to switch.
809         (Target_sparc::Scan::check_non_pic): Likewise.
810         (Target_sparc::Scan::local): Handle IFUNC symbols.
811         (Target_sparc::Scan::local): Likewise.
812         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
813         and plt_address_for_local.
814         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
815         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
816
817         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
818         (class Output_data_reloc): Adjust calls to Output_reloc_type.
819         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
820         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
821         global relocs too.
822         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
823         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
824         calls.
825         * sparc.cc (Target_sparc::Scan::global): Likewise.
826         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
827
828 2012-04-16  Cary Coutant  <ccoutant@google.com>
829
830         * archive.cc (Library_base::should_include_member): Check for
831         --export-dynamic-symbol.
832         * options.h (class General_options): Add --export-dynamic-symbol.
833         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
834         --export-dynamic-symbol.
835         (Symbol_table::gc_mark_undef_symbols): Likewise.
836         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
837
838 2012-04-12  David S. Miller  <davem@davemloft.net>
839
840         * sparc.cc (Reloc::wdisp10): New relocation method.
841         (Reloc::h34): Likewise.
842         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
843         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
844         R_SPARC_WDISP10.
845         (Target_sparc::Scan::local): Likewise.
846         (Target_sparc::Scan::global): Likewise.
847         (Target_sparc::Relocate::relocate): Likewise.
848
849 2012-04-09  Cary Coutant  <ccoutant@google.com>
850
851         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
852         low_pc == 0.
853
854 2012-04-06  Ian Lance Taylor  <iant@google.com>
855
856         * timer.cc: #include <unistd.h>.
857
858 2012-04-06  Roland McGrath  <mcgrathr@google.com>
859
860         * configure.in (AC_CHECK_HEADERS): Add locale.h.
861         * config.in: Regenerate.
862         * configure: Regenerate.
863
864 2012-04-05  Nick Clifton  <nickc@redhat.com>
865
866         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
867         (AM_LC_MESSAGES): Add.
868         * aclocal.m4: Regenerate.
869         * config.in: Regenerate.
870         * configure: Regenerate.
871
872 2012-03-21  Cary Coutant  <ccoutant@google.com>
873
874         * Makefile.am: Add gdb-index.cc, gdb-index.h.
875         * Makefile.in: Regenerate.
876         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
877         (Sized_elf_reloc_mapper::symbol_section): New function.
878         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
879         (make_elf_reloc_mapper): New function.
880         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
881         (Dwarf_abbrev_table::do_read_abbrevs): New function.
882         (Dwarf_abbrev_table::do_get_abbrev): New function.
883         (Dwarf_ranges_table::read_ranges_table): New function.
884         (Dwarf_ranges_table::read_range_list): New function.
885         (Dwarf_pubnames_table::read_section): New function.
886         (Dwarf_pubnames_table::read_header): New function.
887         (Dwarf_pubnames_table::next_name): New function.
888         (Dwarf_die::Dwarf_die): New function.
889         (Dwarf_die::read_attributes): New function.
890         (Dwarf_die::skip_attributes): New function.
891         (Dwarf_die::set_name): New function.
892         (Dwarf_die::set_linkage_name): New function.
893         (Dwarf_die::attribute): New function.
894         (Dwarf_die::string_attribute): New function.
895         (Dwarf_die::int_attribute): New function.
896         (Dwarf_die::uint_attribute): New function.
897         (Dwarf_die::ref_attribute): New function.
898         (Dwarf_die::child_offset): New function.
899         (Dwarf_die::sibling_offset): New function.
900         (Dwarf_info_reader::check_buffer): New function.
901         (Dwarf_info_reader::parse): New function.
902         (Dwarf_info_reader::do_parse): New function.
903         (Dwarf_info_reader::do_read_string_table): New function.
904         (Dwarf_info_reader::lookup_reloc): New function.
905         (Dwarf_info_reader::get_string): New function.
906         (Dwarf_info_reader::visit_compilation_unit): New function.
907         (Dwarf_info_reader::visit_type_unit): New function.
908         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
909         Sized_elf_reloc_mapper.
910         (Sized_dwarf_line_info::symbol_section): Remove function.
911         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
912         (Sized_dwarf_line_info::read_line_mappings): Remove object
913         parameter, adjust callers.
914         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
915         * dwarf_reader.h: Include <sys/types.h>.
916         (class Track_relocs): Remove forward declaration.
917         (class Elf_reloc_mapper): New class.
918         (class Sized_elf_reloc_mapper): New class.
919         (class Dwarf_abbrev_table): New class.
920         (class Dwarf_range_list): New class.
921         (class Dwarf_ranges_table): New class.
922         (class Dwarf_pubnames_table): New class.
923         (class Dwarf_die): New class.
924         (class Dwarf_info_reader): New class.
925         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
926         (Sized_dwarf_line_info::symbol_section): Remove member function.
927         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
928         base class.
929         * gdb-index.cc: New source file.
930         * gdb-index.h: New source file.
931         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
932         and .debug_types sections, call Layout::add_to_gdb_index.
933         (Sized_relobj_incr::do_section_name): Implement.
934         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
935         return type; Implement.
936         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
937         return type.
938         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
939         parameter list and return type.
940         (Sized_incr_dynobj::do_section_contents): Likewise.
941         * layout.cc: Include gdb-index.h.
942         (Layout::Layout): Initialize gdb_index_data_.
943         (Layout::init_fixed_output_section): Check for .gdb_index section.
944         (Layout::add_to_gdb_index): New function. Instantiate.
945         * layout.h: Add forward declaration for class Gdb_index.
946         (Layout::add_to_gdb_index): New member function.
947         (Layout::gdb_index_data_): New data member.
948         * main.cc: Include gdb-index.h.
949         (main): Print statistics for gdb index.
950         * object.cc (Object::section_contents): Move code into
951         do_section_contents.
952         (need_decompressed_section): Check for sections needed when building
953         gdb index.
954         (build_compressed_section_map): Likewise.
955         (Sized_relobj_file::do_read_symbols): Need local symbols when building
956         gdb index.
957         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
958         sections; call Layout::add_to_gdb_index.
959         (Sized_relobj_file::do_decompressed_section_contents): Call
960         do_section_contents directly.
961         * object.h (Object::do_section_contents): Adjust parameter list and
962         return type.
963         (Object::do_decompressed_section_contents): Call do_section_contents
964         directly.
965         (Sized_relobj_file::do_section_contents): Adjust parameter list and
966         return type.
967         * options.h (class General_options): Add --gdb-index option.
968         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
969         list and return type.
970         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
971         * reloc.h (Track_relocs::checkpoint): New function.
972         (Track_relocs::reset): New function.
973
974         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
975         New test cases.
976         * testsuite/Makefile.in: Regenerate.
977         * testsuite/gdb_index_test.cc: New test source file.
978         * testsuite/gdb_index_test_1.sh: New test source file.
979         * testsuite/gdb_index_test_2.sh: New test source file.
980
981 2012-03-19  Doug Kwan  <dougkwan@google.com>
982
983         * arm.cc (Target_arm::do_define_standard_symbols): New method.
984         (Target_arm::do_finalize_sections): Remove code which defines
985         __exidx_start and __exidx_end.  Make symbol table parameter
986         anonymous as it is not used.
987         * gold.cc (queue_middle_tasks): Call target hook to define any
988         target-specific symbols.
989         * target.h (Target::define_standard_symbols): New method.
990         (Target::do_define_standard_symbols): Same.
991         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
992         * testsuite/Makefile.in: Regenerate.
993         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
994         and __exidx_end.
995         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
996         relocations are generated for __exidx_start and __exidx_end.
997
998 2012-03-16  Doug Kwan  <dougkwan@google.com>
999
1000         * testsuite/Makefile.am: Disable test initpri3b.
1001         * testsuite/Makefile.in: Regenerate.
1002
1003 2012-03-15  Doug Kwan  <dougkwan@google.com>
1004
1005         * arm.cc (Target_arm::got_section): Make .got section read-only
1006         if -z now is given.
1007
1008 2012-03-15  Ian Lance Taylor  <iant@google.com>
1009
1010         PR gold/13850
1011         * layout.cc (Layout::make_output_section): Correctly mark
1012         SHT_INIT_ARRAY, et. al., as relro.
1013
1014 2012-03-14  Doug Kwan  <dougkwan@google.com>
1015
1016         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1017         dynamic relocations for protected symbols in shared objects.
1018
1019 2012-03-13  Ian Lance Taylor  <iant@google.com>
1020
1021         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1022         keep the larger alignment.
1023
1024 2012-03-12  Cary Coutant  <ccoutant@google.com>
1025
1026         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1027         handling of DW_LNE_define_file.
1028
1029 2012-03-12  Cary Coutant  <ccoutant@google.com>
1030
1031         * reduced_debug_output.cc
1032         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1033         codes to switch.
1034
1035 2012-02-29  Cary Coutant  <ccoutant@google.com>
1036
1037         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1038
1039 2012-02-29  Cary Coutant  <ccoutant@google.com>
1040
1041         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1042         Call Object::decompressed_section_contents.
1043         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1044         New dtor.
1045         (Sized_dwarf_line_info::buffer_start_): New data member.
1046         * merge.cc (Output_merge_data::do_add_input_section): Call
1047         Object::decompressed_section_contents.
1048         (Output_merge_string::do_add_input_section): Likewise.
1049         * object.cc (need_decompressed_section): New function.
1050         (build_compressed_section_map): Decompress sections needed later.
1051         (Sized_relobj_file::do_decompressed_section_contents): New function.
1052         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1053         * object.h (Object::decompressed_section_contents): New function.
1054         (Object::discard_decompressed_sections): New function.
1055         (Object::do_decompressed_section_contents): New function.
1056         (Object::do_discard_decompressed_sections): New function.
1057         (Compressed_section_info): New type.
1058         (Compressed_section_map): Include decompressed section contents.
1059         (Sized_relobj_file::do_decompressed_section_contents): New function.
1060         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1061
1062 2012-02-16  Cary Coutant  <ccoutant@google.com>
1063
1064         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1065         * testsuite/Makefile.in: Regenerate.
1066
1067 2012-02-14  Cary Coutant  <ccoutant@google.com>
1068
1069         * options.cc (General_options::finalize): Disallow -pie and -static.
1070
1071 2012-02-03  Doug Kwan  <dougkwan@google.com>
1072
1073         * arm.cc (Arm_relocate_functions::abs8,
1074         Arm_relocate_functions::abs16): Use
1075         Bits::has_signed_unsigned_overflow32.
1076         (Arm_relocate_functions::thm_abs8): Correct range of
1077         overflow check.
1078         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1079         in assertions.
1080
1081 2012-02-02  Doug Kwan  <dougkwan@google.com>
1082
1083         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1084         position independent outputs, not just shared objects.
1085
1086 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1087
1088         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1089         * configure: Regenerated.
1090
1091 2012-01-27  Ian Lance Taylor  <iant@google.com>
1092
1093         * reloc.h (Bits): New class with static functions, copied from
1094         namespace utils in arm.cc.
1095         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1096         instead.
1097
1098 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1099
1100         * incremental.cc (write_info_blocks): Correct relocation offset.
1101
1102 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1103
1104         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1105         (Relocate::tls_gd_to_le): Likewise.
1106
1107 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1108
1109         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1110
1111 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1112
1113         * configure.ac: Check if -mcmodel=medium works.
1114         * configure: Regenerated.
1115
1116 2012-01-24  Cary Coutant  <ccoutant@google.com>
1117
1118         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1119         definition and ...
1120         (read_unsigned_LEB_128_x): ... this new function.
1121         (read_signed_LEB_128): Replaced with inline definition and ...
1122         (read_signed_LEB_128_x): ... this new function.
1123         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1124         (read_unsigned_LEB_128): Add inline definition.
1125         (read_signed_LEB_128_x): New function.
1126         (read_signed_LEB_128): Add inline definition.
1127         * testsuite/Makefile.am (leb128_unittest): New unit test.
1128         * testsuite/Makefile.in: Regenerate.
1129         * testsuite/leb128_unittest.cc: New unit test.
1130
1131 2012-01-23  Ian Lance Taylor  <iant@google.com>
1132
1133         PR gold/13617
1134         * i386.cc (Target_i386::do_code_fill): When using a jmp
1135         instruction, pad with nop instructions.
1136         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1137
1138 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1139
1140         * x86_64.cc (gc_process_relocs): Add typename on types used in
1141         template.
1142         (scan_relocs): Likewise.
1143         (relocate_section): Likewise.
1144         (apply_relocation): Likewise.
1145
1146 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1147
1148         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1149         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1150         under x32.
1151
1152 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1153
1154         * x86_64.cc: Initial support for x32.
1155
1156 2012-01-03  Cary Coutant  <ccoutant@google.com>
1157
1158         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1159         Use abstract base class for GOT.
1160         * gold/output.h (class Output_data_got_base): New abstract base class.
1161         (class Output_data_got): Derive from new base class, adjust ctors.
1162         (Output_data_got::reserve_slot): Make virtual; rename to
1163         do_reserve_slot; Adjust callers.
1164         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1165         pointer to abstract base class.
1166         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1167
1168 2011-12-18  Ian Lance Taylor  <iant@google.com>
1169
1170         * object.h (Relobj::local_symbol_value): New function.
1171         (Relobj::local_plt_offset): New function.
1172         (Relobj::local_has_got_offset): New function.
1173         (Relobj::local_got_offset): New function.
1174         (Relobj::set_local_got_offset): New function.
1175         (Relobj::do_local_symbol_value): New pure virtual function.
1176         (Relobj::do_local_plt_offset): Likewise.
1177         (Relobj::do_local_has_got_offset): Likewise.
1178         (Relobj::do_local_got_offset): Likewise.
1179         (Relobj::do_set_local_got_offset): Likewise.
1180         (Sized_relobj::do_local_has_got_offset): Rename from
1181         local_has_got_offset.
1182         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1183         (Sized_relobj::do_set_local_got_offset): Rename from
1184         set_local_got_offset.
1185         (Sized_relobj_file::do_local_plt_offset): Rename from
1186         local_plt_offset.
1187         (Sized_relobj_file::do_local_symbol_value): New function.
1188         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1189         local_plt_offset.
1190         * output.cc (Output_data_got::Got_entry::write): Change object to
1191         Relobj.  Use local_symbol_value.
1192         (Output_data_got::add_global_with_rel): Change rel_dyn to
1193         Output_data_reloc_generic*.  Use add_global_generic.
1194         (Output_data_got::add_global_with_rela): Remove.  Change all
1195         callers to use add_global_with_rel.
1196         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1197         Output_data_reloc_generic*.  Use add_global_generic.
1198         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1199         callers to use add_global_pair_with_rel.
1200         (Output_data_got::add_local): Change object to Relobj*.
1201         (Output_data_got::add_local_plt): Likewise.
1202         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1203         change rel_dyn to Output_data_reloc_generic*.  Use
1204         add_local_generic.
1205         (Output_data_got::add_local_with_rela): Remove.  Change all
1206         callers to use all_local_with_rel.
1207         (Output_data_got::add_local_pair_with_rel): Change object to
1208         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1209         add_output_section_generic.
1210         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1211         callers to use add_local_pair_with_rel.
1212         (Output_data_got::reserve_local): Change object to Relobj*.
1213         * output.h: (class Output_data_reloc_generic): Add pure virtual
1214         declarations for add_global_generic, add_local_generic,
1215         add_output_section_generic.
1216         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1217         functions for Output_data_reloc_generic.  Update declarations for
1218         changes listed in output.cc.
1219         (class Output_data_got): Change template parameter to got_size.
1220         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1221         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1222         function.
1223         (Sized_relobj_incr::do_local_plt_offset): New function.
1224         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1225         add_global_generic.
1226
1227 2011-12-17  Cary Coutant  <ccoutant@google.com>
1228
1229         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1230         * resolve.cc (Symbol_table::resolve): Likewise.
1231         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1232         arrays.
1233         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1234
1235 2011-12-16  Ian Lance Taylor  <iant@google.com>
1236
1237         * output.h (Output_data_reloc_generic::add): Only call
1238         add_dynamic_reloc if this is a dynamic reloc section.
1239
1240 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1241
1242         PR gold/13505
1243         * target-reloc.h (apply_relocation): Replace <64, false> with
1244         <size, big_endian>.
1245
1246 2011-11-25  Nick Clifton  <nickc@redhat.com>
1247
1248         * po/it.po: New Italian translation.
1249
1250 2011-11-17  Sterling Augustine  <saugustine@google.com>
1251
1252         * script.cc (script_include_directive): Implement.
1253         (read_script_file): New local variables name and search_path. Update
1254         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1255         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1256         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1257
1258 2011-11-11  Sterling Augustine  <saugustine@google.com>
1259
1260         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1261         (file_or_sections_cmd): Likewise.
1262
1263 2011-11-11  Doug Kwan  <dougkwan@google.com>
1264
1265         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1266         if --just-symbols is given.
1267
1268 2011-11-10  Doug Kwan  <dougkwan@google.com>
1269
1270         PR gold/13362
1271         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1272         when processing data relocs.
1273         * reloc.h (Relocate_functions::rel_unaligned): New method.
1274         (Relocate_functions::pcrel_unaligned): Ditto.
1275         (Relocate_functions::rel32_unaligned): Ditto.
1276         (Relocate_functions::pcrel32_unaligned): Ditto.
1277
1278 2011-11-09  Doug Kwan  <dougkwan@google.com>
1279
1280         PR gold/13362
1281         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1282         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1283         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1284         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1285         (Relocate_functions::rel_unaligned): New.
1286         (Relocate_functions::rel32_unaligned): New.
1287         * target-reloc.h (relocate_for_relocatable): Add code to handle
1288         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1289         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1290         arm_unaligned_reloc_r): New targets.
1291         * testsuite/Makefile.in: Regenerate.
1292         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1293         linking.
1294
1295 2011-11-02  Ian Lance Taylor  <iant@google.com>
1296
1297         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1298         NATIVE_LINKER.
1299         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1300         * options.cc (General_options::finalize): Use library search path
1301         from configure script if specified.  If not native and no sysroot,
1302         only search TOOLLIBDIR.
1303         * options.h (Search_directory::Search_directory): Change name to
1304         const std::string&.
1305         (General_options::add_to_library_path_with_sysroot): Change arg to
1306         const std::string&.
1307         * configure, Makefile.in, config.in: Rebuild.
1308
1309 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1310
1311         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1312         we are working around the ARM1176 Erratum.
1313         * options.h (General_options::fix_arm1176): Add option.
1314         * testsuite/Makefile.am: Add testcases, and keep current ones
1315         working.
1316         * testsuite/Makefile.in: Regenerate.
1317         * testsuite/arm_fix_1176.s: New file.
1318         * testsuite/arm_fix_1176.sh: Likewise.
1319
1320 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1321
1322         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1323         may_use_blx_.
1324         (Target_arm::may_use_blx): Remove method.
1325         (Target_arm::set_may_use_blx): Likewise.
1326         (Target_arm::may_use_v4t_interworking): New method.
1327         (Target_arm::may_use_v5t_interworking): Likewise.
1328         (Target_arm::may_use_blx_): Remove member variable.
1329         (Arm_relocate_functions::arm_branch_common): Check for v5T
1330         interworking.
1331         (Arm_relocate_functions::thumb_branch_common): Likewise.
1332         (Reloc_stub::stub_type_for_reloc): Likewise.
1333         (Target_arm::do_finalize_sections): Correct interworking checks.
1334         * testsuite/Makefile.am: Add new tests.
1335         * testsuite/Makefile.in: Regenerate.
1336         * testsuite/arm_farcall_arm_arm.s: New test.
1337         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1338         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1339         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1340         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1341         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1342         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1343         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1344
1345 2011-10-31  Cary Coutant  <ccoutant@google.com>
1346
1347         PR gold/13023
1348         * expression.cc (Expression::eval_with_dot): Add
1349         is_section_dot_assignment parameter.
1350         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1351         absolute and assigning to dot within a section.
1352         * script-sections.cc
1353         (Output_section_element_assignment::set_section_addresses): Pass
1354         dot_section to set_if_absolute.
1355         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1356         as is_section_dot_assignment flag to eval_with_dot.
1357         (Output_section_element_dot_assignment::set_section_addresses):
1358         Likewise.
1359         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1360         parameter.  Also set value if relative to dot_section; set the
1361         symbol's output_section.
1362         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1363         parameter.  Adjust all callers.
1364         (Expression::eval_maybe_dot): Likewise.
1365         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1366         Adjust all callers.
1367         * testsuite/script_test_2.t: Test assignment of an absolute value
1368         to dot within an output section element.
1369
1370 2011-10-31  Cary Coutant  <ccoutant@google.com>
1371
1372         * options.h (class General_options): Add --[no-]gnu-unique options.
1373         * symtab.cc (Symbol_table::sized_write_globals): Convert
1374         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1375
1376 2011-10-31  Cary Coutant  <ccoutant@google.com>
1377
1378         PR gold/13359
1379         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1380         unnecessary assertion.
1381         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1382
1383 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1384
1385         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1386         gc_mark_symbol.
1387         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1388         gc_mark_symbol.
1389         Change to just keep the section associated with symbol.
1390         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1391         they are externally visible and --export-dynamic is turned on.
1392         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1393
1394 2011-10-19  Ian Lance Taylor  <iant@google.com>
1395
1396         PR gold/13163
1397         * script-sections.cc
1398         (Output_section_element_dot_assignment::needs_output_section): New
1399         function.
1400
1401 2011-10-19  Ian Lance Taylor  <iant@google.com>
1402
1403         PR gold/13204
1404         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1405         --section-start option was seen.
1406         * options.h (General_options::any_section_start): New function.
1407
1408 2011-10-18  David S. Miller  <davem@davemloft.net>
1409
1410         PR binutils/13301
1411         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1412         member to track relocation locations that have moved during TLS
1413         reloc optimizations.
1414         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1415         (Target_sparc::Relocate::relocate): Adjust view down by 4
1416         bytes if it matches reloc_adjust_addr_.
1417         (Target_sparc::Relocate::relocate_tls): Always move the
1418         __tls_get_addr call delay slot instruction forward 4 bytes when
1419         performing relaxation.
1420
1421 2011-10-18  Cary Coutant  <ccoutant@google.com>
1422
1423         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1424         (Output_file::map_no_anonymous): Check for non-zero
1425         return code from posix_fallocate.
1426
1427 2011-10-17  Cary Coutant  <ccoutant@google.com>
1428
1429         PR gold/13245
1430         * plugin.cc (is_visible_from_outside): Check for symbols
1431         referenced from dynamic objects.
1432         * resolve.cc (Symbol_table::resolve): Don't count references
1433         from dynamic objects as references from real ELF files.
1434         * testsuite/plugin_test_2.sh: Adjust expected result.
1435
1436 2011-10-17  Cary Coutant  <ccoutant@google.com>
1437
1438         * gold.cc: Include timer.h.
1439         (queue_middle_tasks): Stamp time.
1440         (queue_final_tasks): Likewise.
1441         * main.cc (main): Store timer in parameters.  Print timers
1442         for each pass.
1443         * parameters.cc (Parameters::Parameters): Initialize timer_.
1444         (Parameters::set_timer): New function.
1445         (set_parameters_timer): New function.
1446         * parameters.h (Parameters::set_timer): New function.
1447         (Parameters::timer): New function.
1448         (Parameters::timer_): New data member.
1449         (set_parameters_timer): New function.
1450         * timer.cc (Timer::stamp): New function.
1451         (Timer::get_pass_time): New function.
1452         * timer.h (Timer::stamp): New function.
1453         (Timer::get_pass_time): New function.
1454         (Timer::pass_times_): New data member.
1455
1456 2011-10-17  Cary Coutant  <ccoutant@google.com>
1457
1458         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1459         task for members of lib groups.
1460
1461 2011-10-17  Cary Coutant  <ccoutant@google.com>
1462
1463         PR gold/13288
1464         * fileread.cc (File_read::find_view): Add assert.
1465         (File_read::make_view): Move bounds check (replace with assert)...
1466         (File_read::find_or_make_view): ... to here.
1467
1468 2011-10-12  Cary Coutant  <ccoutant@google.com>
1469
1470         * output.cc (Output_file::open_base_file): Handle case where
1471         ::read returns less than requested size.
1472
1473 2011-10-10  Cary Coutant  <ccoutant@google.com>
1474
1475         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
1476         Initialize defined_count_.
1477         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
1478         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
1479         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
1480         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
1481         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
1482         * incremental.h (Sized_relobj_incr::defined_count_): New data
1483         member.
1484         (Sized_incr_dynobj::defined_count_): New data member.
1485         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
1486         Return zeroes instead of internal error.
1487
1488 2011-10-10  Cary Coutant  <ccoutant@google.com>
1489
1490         PR gold/13249
1491         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
1492         (Output_reloc::symbol_value): Return PLT offset if flag is set.
1493         * output.h (class Output_reloc): Add use_plt_offset flag.
1494         (Output_reloc::type_): Adjust size of bit field.
1495         (Output_reloc::use_plt_offset_): New bit field.
1496         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
1497         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
1498         flag.  Adjust all callers.
1499         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
1500         creating RELATIVE relocations.
1501
1502 2011-10-10  Nick Clifton  <nickc@redhat.com>
1503
1504         * po/es.po: Updated Spanish translation.
1505         * po/fi.po: Updated Finnish translation.
1506
1507 2011-10-03   Diego Novillo  <dnovillo@google.com>
1508
1509         * options.cc (parse_uint): Fix dereference of RETVAL.
1510
1511 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
1512
1513         * layout.h (section_order_map_): New member.
1514         (get_section_order_map): New member function.
1515         * output.cc (Output_section::add_input_section): Check for patterns
1516         only when --section-ordering-file is specified.
1517         * gold.cc (queue_middle_tasks): Delay updating order of sections till
1518         output_sections have been formed.
1519         * layout.cc (Layout_Layout): Initialize section_order_map_.
1520         * plugin.cc (update_section_order): Store order in order_map. Do not
1521         update the order.
1522         * testsuite/Makefile.am: Add test case for plugin_final_layout.
1523         * testsuite/Makefile.in: Regenerate.
1524         * testsuite/plugin_section_order.c: New file.
1525         * testsuite/plugin_final_layout.cc: New file.
1526         * testsuite/plugin_final_layout.sh: New file.
1527
1528 2011-09-29  Cary Coutant  <ccoutant@google.com>
1529
1530         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
1531         Check for NULL.
1532         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
1533         symbols during incremental update.
1534         (Symbol_table::add_from_dynobj): Likewise.
1535
1536 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
1537             Ian Lance Taylor  <iant@google.com>
1538
1539         * symtab.cc (Symbol_table::define_special_symbol): Always
1540         canonicalize version string.
1541
1542 2011-09-26  Cary Coutant  <ccoutant@google.com>
1543
1544         * gold.cc (queue_initial_tasks): Move option checks ...
1545         * options.cc (General_options::finalize): ... to here. Disable
1546         some options; make others fatal.
1547
1548 2011-09-26  Cary Coutant  <ccoutant@google.com>
1549
1550         gcc PR lto/47247
1551         * plugin.cc (get_symbols_v2): New function.
1552         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
1553         (is_referenced_from_outside): New function.
1554         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
1555         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
1556         (get_symbols): Pass version parameter.
1557         (get_symbols_v2): New function.
1558         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
1559         parameter.
1560         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
1561         (onload): Add LDPT_GET_SYMBOLS_V2.
1562         (all_symbols_read_hook): Use get_symbols_v2; check for
1563         LDPR_PREVAILING_DEF_IRONLY_EXP.
1564         * testsuite/plugin_test_3.sh: Update expected results.
1565
1566 2011-09-23  Simon Baldwin  <simonb@google.com>
1567
1568         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
1569         configuration options.
1570         * configure: Regenerate.
1571         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
1572         * Makefile.in: Regenerate.
1573         * testsuite/Makefile.in: Regenerate.
1574
1575 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
1576
1577         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
1578
1579 2011-09-19  Cary Coutant  <ccoutant@google.com>
1580
1581         * incremental.cc (can_incremental_update): Fix typo in comment.
1582         * incremental.h (can_incremental_update): Likewise.
1583
1584 2011-09-18  Cary Coutant  <ccoutant@google.com>
1585
1586         * incremental.cc (can_incremental_update): New function.
1587         * incremental.h (can_incremental_update): New function.
1588         * layout.cc (Layout::init_fixed_output_section): Call it.
1589         (Layout::make_output_section): Don't allow patch space in .eh_frame.
1590         * object.cc (Sized_relobj_file::do_layout): Call
1591         can_incremental_update.
1592
1593 2011-09-13  Cary Coutant  <ccoutant@google.com>
1594
1595         * configure.ac: Check for glibc support for gnu_indirect_function
1596         support with static linking, setting automake conditional
1597         IFUNC_STATIC.
1598         * Makefile.in: Regenerate.
1599         * configure: Regenerate.
1600
1601         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
1602         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
1603         for IFUNC_STATIC.
1604         * testsuite/Makefile.in: Regenerate.
1605
1606 2011-09-13  Cary Coutant  <ccoutant@google.com>
1607
1608         * incremental.cc (Sized_relobj_incr::do_layout): Call
1609         report_comdat_group for kept comdat sections.
1610         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
1611         * testsuite/Makefile.in: Regenerate.
1612         * testsuite/incr_comdat_test_1.cc: New source file.
1613         * testsuite/incr_comdat_test_2_v1.cc: New source file.
1614         * testsuite/incr_comdat_test_2_v2.cc: New source file.
1615         * testsuite/incr_comdat_test_2_v3.cc: New source file.
1616
1617 2011-09-13  Ian Lance Taylor  <iant@google.com>
1618
1619         * object.cc (Sized_relobj_file::do_layout): Remove unused local
1620         variable external_symbols_offset.
1621
1622 2011-09-12  Ian Lance Taylor  <iant@google.com>
1623
1624         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
1625         triggered if object has no symbols.
1626
1627 2011-09-09  David S. Miller  <davem@davemloft.net>
1628
1629         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
1630         (Output_fill_debug_line::do_write): Likewise.
1631
1632 2011-08-29  Cary Coutant  <ccoutant@google.com>
1633
1634         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
1635         casts to match formatting specs.
1636         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
1637
1638 2011-08-26  Cary Coutant  <ccoutant@google.com>
1639
1640         * layout.cc (Free_list::allocate): Provide guarantee of minimum
1641         remaining hole size when allocating.
1642         (Layout::make_output_section): Set fill methods for debug sections.
1643         * layout.h (Free_list::Free_list_node): Move from private to
1644         public.
1645         (Free_list::set_min_hole_size): New function.
1646         (Free_list::begin, Free_list::end): New functions.
1647         (Free_list::min_hole_): New data member.
1648         * output.cc: Include dwarf.h.
1649         (Output_fill_debug_info::do_minimum_hole_size): New function.
1650         (Output_fill_debug_info::do_write): New function.
1651         (Output_fill_debug_line::do_minimum_hole_size): New function.
1652         (Output_fill_debug_line::do_write): New function.
1653         (Output_section::Output_section): Initialize new data member.
1654         (Output_section::set_final_data_size): Ensure patch space is larger
1655         than minimum hole size.
1656         (Output_section::do_write): Fill holes in debug sections.
1657         * output.h (Output_fill): New class.
1658         (Output_fill_debug_info): New class.
1659         (Output_fill_debug_line): New class.
1660         (Output_section::set_free_space_fill): New function.
1661         (Output_section::free_space_fill_): New data member.
1662         * testsuite/Makefile.am (incremental_test_3): Add
1663         --incremental-patch option.
1664         (incremental_test_4): Likewise.
1665         (incremental_test_5): Likewise.
1666         (incremental_test_6): Likewise.
1667         (incremental_copy_test): Likewise.
1668         (incremental_common_test_1): Likewise.
1669         * testsuite/Makefile.in: Regenerate.
1670
1671 2011-08-26  Nick Clifton  <nickc@redhat.com>
1672
1673         * po/es.po: Updated Spanish translation.
1674
1675 2011-08-01  Cary Coutant  <ccoutant@google.com>
1676
1677         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
1678         * gold/testsuite/Makefile.in: Regenerate.
1679         * gold/testsuite/justsyms_exec.c: New source file.
1680         * gold/testsuite/justsyms_lib.c: New source file.
1681
1682 2011-08-01  Cary Coutant  <ccoutant@google.com>
1683
1684         * layout.cc (Layout::set_segment_offsets): Don't realign text
1685         segment if -Ttext was specified.
1686         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
1687         file type.
1688         * object.h (Sized_relobj_file::e_type): New function.
1689         (Sized_relobj_file::e_type_): New data member.
1690         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
1691         base address for ET_EXEC files.
1692         * target.cc (Target::do_make_elf_object_implementation): Allow
1693         ET_EXEC files with --just-symbols option.
1694
1695 2011-07-28  Cary Coutant  <ccoutant@google.com>
1696
1697         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
1698         Add thread_number parameter.
1699         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
1700         * workqueue-threads.cc
1701         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
1702         current thread if its thread number is greater than desired thread
1703         count.
1704         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
1705         Add thread_number parameter.
1706         (Workqueue::should_cancel_thread): Likewise.
1707         (Workqueue::find_runnable_or_wait): Pass thread_number to
1708         should_cancel_thread.
1709         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
1710         parameter.
1711
1712 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
1713
1714         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
1715         only after checking if it cannot be forced local.
1716         * symtab.h (is_externally_visible): Check if the symbol is not forced
1717         local.
1718
1719 2011-07-15  Ian Lance Taylor  <iant@google.com>
1720
1721         * options.h (class General_options): Add --print-output-format.
1722         Move -EL next to -EB, for  better --help output.
1723         * target-select.cc: Include <cstdio>, "options.h", and
1724         "parameters.h".
1725         (Target_selector::do_target_bfd_name): New function.
1726         (print_output_format): New function.
1727         * target-select.h (class Target_selector): Update declarations.
1728         (Target_selector::target_bfd_name): New function.
1729         (print_output_format): Declare.
1730         * main.cc: Include "target-select.h".
1731         (main): Handle --print-output-format.
1732         * gold.cc: Include "target-select.h".
1733         (queue_initial_tasks): Handle --print-output-format when there are
1734         no input files.
1735         * parameters.cc (parameters_force_valid_target): Give a better
1736         error message if -EB/-EL does not match target.
1737         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
1738         function.
1739
1740 2011-07-15  Ian Lance Taylor  <iant@google.com>
1741
1742         * i386.cc (class Output_data_plt_i386): Add layout_ field.
1743         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
1744         (Output_data_plt_i386::do_write): Write address of .dynamic
1745         section to first entry in .got.plt section.
1746         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
1747         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1748         Initialize layout_.
1749         (Output_data_plt_x86_64::do_write): Write address of .dynamic
1750         section to first entry in .got.plt section.
1751         * layout.h (Layout::dynamic_section): New function.
1752
1753 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
1754
1755         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
1756         to claim_file call.
1757         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
1758         input_section_position_, and input_section_glob_.
1759         (read_layout_from_file): Call function section_ordering_specified.
1760         * layout.h (is_section_ordering_specified): New function.
1761         (section_ordering_specified): New function.
1762         (section_ordering_specified_): New boolean member.
1763         * main.cc(main): Call load_plugins after layout object is defined.
1764         * output.cc (Output_section::add_input_section): Use
1765         function section_ordering_specified to check if section ordering is
1766         needed.
1767         * output.cc (Output_section::add_relaxed_input_section): Use
1768         function section_ordering_specified to check if section ordering is
1769         needed.
1770         (Output_section::update_section_layout): New function.
1771         (Output_section::sort_attached_input_sections): Check if input section
1772         must be reordered.
1773         * output.h (Output_section::update_section_layout): New function.
1774         * plugin.cc (get_section_count): New function.
1775         (get_section_type): New function.
1776         (get_section_name): New function.
1777         (get_section_contents): New function.
1778         (update_section_order): New function.
1779         (allow_section_ordering): New function.
1780         (Plugin::load): Add the new interfaces to the transfer vector.
1781         (Plugin_manager::load_plugins): New parameter.
1782         (Plugin_manager::all_symbols_read): New parameter.
1783         (Plugin_manager::claim_file): New parameter. Save the elf object for
1784         unclaimed objects.
1785         (Plugin_manager::get_elf_object): New function.
1786         (Plugin_manager::get_view): Change to directly use the bool to check
1787         if get_view is called from claim_file_hook.
1788         * plugin.h (input_objects): New function
1789         (Plugin__manager::load_plugins): New parameter.
1790         (Plugin_manager::claim_file): New parameter.
1791         (Plugin_manager::get_elf_object): New function.
1792         (Plugin_manager::in_claim_file_handler): New function.
1793         (Plugin_manager::in_claim_file_handler_): New member.
1794         (layout): New function.
1795         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
1796         handler with an extra parameter. Make the elf object before calling
1797         claim_file handler.
1798         * testsuite/plugin_test.c (get_section_count): New function pointer.
1799         (get_section_type): New function pointer.
1800         (get_section_name): New function pointer.
1801         (get_section_contents): New function pointer.
1802         (update_section_order): New function pointer.
1803         (allow_section_ordering): New function pointer.
1804         (onload): Check if the new interfaces exist.
1805
1806 2011-07-13  Ian Lance Taylor  <iant@google.com>
1807
1808         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
1809         relro section.
1810         * x86_64.cc (Target_x86_64::got_section): Likewise.
1811         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
1812         (relro_now_test_SOURCES): New variable.
1813         (relro_now_test_DEPENDENCIES): New variable.
1814         (relro_now_test_LDFLAGS): New variable.
1815         (relro_now_test_LDADD): New variable.
1816         (relro_now_test.so): New target.
1817         * testsuite/Makefile.in: Rebuild.
1818
1819 2011-07-12  Ian Lance Taylor  <iant@google.com>
1820
1821         PR gold/12980
1822         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
1823         GLOB_DAT relocation rather than a RELATIVE relocation for a
1824         protected symbol when creating a shared library.
1825         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1826         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
1827         * testsuite/protected_main_1.cc (main): Test that protected
1828         function has same address.
1829
1830 2011-07-11  Ian Lance Taylor  <iant@google.com>
1831
1832         PR gold/12979
1833         * options.h (class General_options): Add -Bgroup.
1834         * options.cc (General_options::finalize): If -Bgroup is set,
1835         default to --unresolved-symbols=report-all.
1836         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
1837         * target-reloc.h (issue_undefined_symbol_error): Handle
1838         --unresolved-symbols=report-all.
1839
1840 2011-07-08  Ian Lance Taylor  <iant@google.com>
1841
1842         PR gold/11985
1843         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
1844         if linker script discards key sections.
1845         (Layout::create_dynamic_symtab): Likewise.
1846         (Layout::assign_local_dynsym_offsets): Likewise.
1847         (Layout::sized_create_version_sections): Likewise.
1848         (Layout::create_interp): Likewise.
1849         (Layout::finish_dynamic_section): Likewise.
1850         (Layout::set_dynamic_symbol_size): Likewise.
1851
1852 2011-07-08  Ian Lance Taylor  <iant@google.com>
1853
1854         PR gold/12386
1855         * options.h (class General_options): Add --unresolved-symbols.
1856         * target-reloc.h (issue_undefined_symbol_error): Check
1857         --unresolved-symbols.  Add comments.
1858
1859 2011-07-08  Ian Lance Taylor  <iant@google.com>
1860
1861         * testsuite/odr_violation2.cc (Ordering::operator()): Make
1862         expression more complex.
1863
1864 2011-07-08  Ian Lance Taylor  <iant@google.com>
1865
1866         PR gold/11317
1867         * target-reloc.h (issue_undefined_symbol_error): New inline
1868         function, broken out of relocate_section.
1869         (relocate_section): Call issue_undefined_symbol_error.
1870         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1871         there is no TLS segment if we are about to issue an undefined
1872         symbol error.
1873         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1874
1875 2011-07-08  Ian Lance Taylor  <iant@google.com>
1876
1877         PR gold/12279
1878         * resolve.cc (Symbol_table::should_override): Add fromtype
1879         parameter.  Change all callers.  Give error when linking together
1880         TLS and non-TLS symbol.
1881         (Symbol_table::should_override_with_special): Add fromtype
1882         parameter.  Change all callers.
1883         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
1884         there is no TLS segment if we have reported some errors.
1885         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
1886
1887 2011-07-08  Ian Lance Taylor  <iant@google.com>
1888
1889         PR gold/12372
1890         * target.h (Target::plt_address_for_global): New function.
1891         (Target::plt_address_for_local): New function.
1892         (Target::plt_section_for_global): Remove.
1893         (Target::plt_section_for_local): Remove.
1894         (Target::do_plt_address_for_global): New virtual function.
1895         (Target::do_plt_address_for_local): New virtual function.
1896         (Target::do_plt_section_for_global): Remove.
1897         (Target::do_plt_section_for_local): Remove.
1898         (Target::register_global_plt_entry): Add Symbol_table and Layout
1899         parameters.
1900         * output.cc (Output_data_got::Got_entry::write): Use
1901         plt_address_for_global and plt_address_for_local.
1902         * layout.cc (Layout::add_target_dynamic_tags): Use size and
1903         address of output section.
1904         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
1905         got_irelative_, and irelative_count_ fields.  Update
1906         declarations.
1907         (Output_data_plt_i386::has_irelative_section): New function.
1908         (Output_data_plt_i386::entry_count): Add irelative_count_.
1909         (Output_data_plt_i386::set_final_data_size): Likewise.
1910         (class Target_i386): Add got_irelative_ and rel_irelative_
1911         fields.  Update declarations.
1912         (Target_i386::Target_i386): Initialize new fields.
1913         (Target_i386::do_plt_address_for_global): New function replacing
1914         do_plt_section_for_global.
1915         (Target_i386::do_plt_address_for_local): New function replacing
1916         do_plt_section_for_local.
1917         (Target_i386::got_section): Create got_irelative_.
1918         (Target_i386::rel_irelative_section): New function.
1919         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
1920         fields.  Don't define __rel_iplt_{start,end}.
1921         (Output_data_plt_i386::add_entry): Add symtab and layout
1922         parameters.  Change all callers.  Use different PLT and GOT for
1923         IFUNC symbols.
1924         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
1925         layout parameters.  Change all callers.  Use different PLT and
1926         GOT.
1927         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
1928         (Output_data_plt_i386::rel_irelative): New function.
1929         (Output_data_plt_i386::address_for_global): New function.
1930         (Output_data_plt_i386::address_for_local): New function.
1931         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
1932         IRELATIVE GOT when changing IFUNC GOT entries.
1933         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
1934         reloc.
1935         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
1936         if we didn't create an IRELATIVE GOT.
1937         (Target_i386::Relocate::relocate): Use plt_address_for_global and
1938         plt_address_for_local.
1939         (Target_i386::do_dynsym_value): Use plt_address_for_global.
1940         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
1941         got_irelative_, and irelative_count_ fields.  Update
1942         declarations.
1943         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
1944         Initialize new fields.  Remove symtab parameter.  Change all
1945         callers.
1946         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
1947         irelative_count_.
1948         (Output_data_plt_x86_64::has_irelative_section): New function.
1949         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
1950         (class Target_x86_64): Add got_irelative_ and rel_irelative_
1951         fields.  Update declarations.
1952         (Target_x86_64::Target_x86_64): Initialize new fields.
1953         (Target_x86_64::do_plt_address_for_global): New function replacing
1954         do_plt_section_for_global.
1955         (Target_x86_64::do_plt_address_for_local): New function replacing
1956         do_plt_section_for_local.
1957         (Target_x86_64::got_section): Create got_irelative_.
1958         (Target_x86_64::rela_irelative_section): New function.
1959         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
1960         all callers.  Don't create __rel_iplt_{start,end}.
1961         (Output_data_plt_x86_64::add_entry): Add symtab and layout
1962         parameters.  Change all callers.  Use different PLT and GOT for
1963         IFUNC symbols.
1964         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
1965         layout parameters.  Change all callers.  Use different PLT and
1966         GOT.
1967         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
1968         parameters.  Change all callers.  Use different PLT and GOT for
1969         IFUNC symbols.
1970         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
1971         (Output_data_plt_x86_64::rela_irelative): New function.
1972         (Output_data_plt_x86_64::address_for_global): New function.
1973         (Output_data_plt_x86_64::address_for_local): New function.
1974         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1975         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
1976         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
1977         (Target_x86_64::register_global_plt_entry): Add symtab and layout
1978         parameters.
1979         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
1980         reloc.
1981         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
1982         symbols if we didn't create an IRELATIVE GOT.
1983         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
1984         plt_address_for_local.
1985         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
1986         * testsuite/ifuncvar1.c: New test file.
1987         * testsuite/ifuncvar2.c: New test file.
1988         * testsuite/ifuncvar3.c: New test file.
1989         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
1990         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
1991         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
1992         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
1993         * testsuite/Makefile.in: Rebuild.
1994
1995 2011-07-07  Cary Coutant  <ccoutant@google.com>
1996
1997         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
1998         (two_file_test_1_ndebug.o): Likewise.
1999         (two_file_test_1b_ndebug.o): Likewise.
2000         (two_file_test_2_ndebug.o): Likewise.
2001         (two_file_test_main_ndebug.o): Likewise.
2002         (incremental_test_2): Link with no-debug versions.
2003
2004 2011-07-06  Cary Coutant  <ccoutant@google.com>
2005
2006         * gold/incremental.cc
2007         (Output_section_incremental_inputs::write_info_blocks): Check for
2008         hidden and internal symbols.
2009
2010 2011-07-06  Cary Coutant  <ccoutant@google.com>
2011
2012         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2013         Check disposition for startup file.
2014         (Incremental_inputs::report_command_line): Ignore
2015         --incremental-startup-unchanged option.
2016         * options.cc (General_options::parse_incremental_startup_unchanged):
2017         New function.
2018         (General_options::General_options): Initialize new data member.
2019         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2020         (General_options): Add --incremental-startup-unchanged option.
2021         (General_options::incremental_startup_disposition): New function.
2022         (General_options::incremental_startup_disposition_): New data member.
2023
2024 2011-07-06  Cary Coutant  <ccoutant@google.com>
2025
2026         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2027         input file index to Script_info ctor.
2028         (Sized_incremental_binary::do_file_has_changed): Find the
2029         command-line argument for files named in scripts.
2030         * incremental.h (Script_info::Script_info): New ctor
2031         with input file index.
2032         (Script_info::input_file_index): New function.
2033         (Script_info::input_file_index_): New data member.
2034         (Incremental_binary::get_library): Add const.
2035         (Incremental_binary::get_script_info): Add const.
2036         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2037         * testsuite/Makefile.am (incremental_test_5): New test case.
2038         (incremental_test_6): New test case.
2039         * testsuite/Makefile.in: Regenerate.
2040
2041 2011-07-06  Cary Coutant  <ccoutant@google.com>
2042
2043         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2044         debug output when command lines differ.
2045
2046 2011-07-06  Cary Coutant  <ccoutant@google.com>
2047
2048         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2049         --incremental-patch option.
2050         * layout.cc (Free_list::allocate): Extend allocation beyond original
2051         end if enabled.
2052         (Layout::make_output_section): Mark sections that should get
2053         patch space.
2054         * options.cc (parse_percent): New function.
2055         * options.h (parse_percent): New function.
2056         (DEFINE_percent): New macro.
2057         (General_options): Add --incremental-patch option.
2058         * output.cc (Output_section::Output_section): Initialize new data
2059         members.
2060         (Output_section::add_input_section): Print section name when out
2061         of patch space.
2062         (Output_section::add_output_section_data): Likewise.
2063         (Output_section::set_final_data_size): Add patch space when
2064         doing --incremental-full.
2065         (Output_section::do_reset_address_and_file_offset): Remove patch
2066         space.
2067         (Output_segment::set_section_list_addresses): Print debug output
2068         only if --incremental-update.
2069         * output.h (Output_section::set_is_patch_space_allowed): New function.
2070         (Output_section::is_patch_space_allowed_): New data member.
2071         (Output_section::patch_space_): New data member.
2072         * parameters.cc (Parameters::incremental_full): New function.
2073         * parameters.h (Parameters::incremental_full): New function
2074         * testsuite/Makefile.am (incremental_test_2): Add test for
2075         --incremental-patch option.
2076         * testsuite/Makefile.in: Regenerate.
2077         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2078         (t18): Remove function body.
2079
2080 2011-07-05  Doug Kwan  <dougkwan@google.com>
2081
2082         PR gold/12771
2083         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2084         Arm_Address type for relocation result.
2085         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2086         overflow check.
2087         (Arm_relocate_functions::abs32): Use unaligned access.
2088         (Arm_relocate_functions::rel32): Ditto.
2089         (Arm_relocate_functions::prel31): Ditto.
2090         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2091         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2092         static data relocations.
2093         * testsuite/Makefile.in: Regnerate.
2094         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2095
2096 2011-07-05  Ian Lance Taylor  <iant@google.com>
2097
2098         PR gold/12392
2099         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2100         symbols if necessary.
2101         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2102
2103 2011-07-05  Ian Lance Taylor  <iant@google.com>
2104
2105         PR gold/12952
2106         * resolve.cc (Symbol::override_base_with_special): Simply override
2107         version with special symbol version, ignoring previous version.
2108
2109 2011-07-05  Ian Lance Taylor  <iant@google.com>
2110
2111         * object.cc (Sized_relobj_file::include_section_group): Add
2112         information to comment about signature location.
2113
2114 2011-07-02  Ian Lance Taylor  <iant@google.com>
2115
2116         PR gold/12957
2117         * options.h (class General_options): Add -f and -F.
2118         * options.cc (General_options::finalize): Fatal error if -f/-F
2119         are used without -shared.
2120         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2121
2122 2011-07-02  Ian Lance Taylor  <iant@google.com>
2123
2124         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2125
2126 2011-07-01  Ian Lance Taylor  <iant@google.com>
2127
2128         PR gold/12525
2129         PR gold/12952
2130         * resolve.cc (Symbol::override_base_with_special): Don't override
2131         the version if the overriding symbol has a different name.
2132         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2133         all callers.  If we give an error about an undefined version,
2134         define the base version if necessary.
2135         * dynobj.h (class Versions): Update declaration.
2136         * testsuite/weak_alias_test_5.cc: New file.
2137         * testsuite/weak_alias_test.script: New file.
2138         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2139         and versioned_alias have the right value, and call t2.
2140         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2141         weak_alias_test_5.so.
2142         (weak_alias_test_LDADD): Likewise.
2143         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2144         * testsuite/Makefile.in: Rebuild.
2145
2146 2011-07-01  Ian Lance Taylor  <iant@google.com>
2147
2148         PR gold/12525
2149         * options.h (class General_options): Support -z notext.
2150         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2151         -Wl,-z,notext.
2152         (two_file_shared_nonpic.so): Likewise.
2153         (two_file_shared_mixed.so): Likewise.
2154         (two_file_shared_mixed_1.so): Likewise.
2155         (weak_undef_lib_nonpic.so): Likewise.
2156         (alt/weak_undef_lib_nonpic.so): Likewise.
2157         (tls_test_shared_nonpic.so): Likewise.
2158         * testsuite/Makefile.in: Rebuild.
2159
2160 2011-07-01  Ian Lance Taylor  <iant@google.com>
2161
2162         PR gold/12525
2163         * configure.ac: Test whether static linking works, setting
2164         the automake conditional HAVE_STATIC.
2165         * testsuite/Makefile.am: Disable tests using -static if
2166         HAVE_STATIC is not true.
2167         * configure, testsuite/Makefile.in: Rebuild.
2168
2169 2011-07-01  Ian Lance Taylor  <iant@google.com>
2170
2171         PR gold/12525
2172         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2173         Assert if we see DW_EH_PE_indirect.
2174         * target.h (Target::ehframe_datarel_base): New function.
2175         (Target::do_ehframe_datarel_base): New target function.
2176         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2177         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2178         function.
2179
2180 2011-07-01  Ian Lance Taylor  <iant@google.com>
2181
2182         PR gold/12571
2183         * options.h (class General_options): Add
2184         --ld-generated-unwind-info.
2185         * ehframe.cc (Fde::write): Add address parameter.  Change all
2186         callers.  If associated with PLT, fill in address and size.
2187         (Cie::set_output_offset): Only add merge mapping if there is an
2188         object.
2189         (Cie::write): Add address parameter.  Change all callers.
2190         (Eh_frame::add_ehframe_for_plt): New function.
2191         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2192         input_offset_ fields into union u_, with new plt field.
2193         (Fde::Fde): Adjust for new union field.
2194         (Fde::Fde) [Output_data version]: New constructor.
2195         (Fde::add_mapping): Only add merge mapping if there is an object.
2196         (class Cie): Update declarations.
2197         (class Eh_frame): Declare add_ehframe_for_plt.
2198         * layout.cc (Layout::layout_eh_frame): Break out code into
2199         make_eh_frame_section, and call it.
2200         (Layout::make_eh_frame_section): New function.
2201         (Layout::add_eh_frame_for_plt): New function.
2202         * layout.h (class Layout): Update declarations.
2203         * merge.cc (Merge_map::add_mapping): Add assertion.
2204         * i386.cc: Include "dwarf.h".
2205         (class Output_data_plt_i386): Make first_plt_entry,
2206         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2207         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2208         and plt_eh_frame_fde.
2209         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2210         boundary.  Call add_eh_frame_for_plt if appropriate.
2211         * x86_64.cc: Include "dwarf.h".
2212         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2213         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2214         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2215         and plt_eh_frame_fde.
2216         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2217         appropriate.
2218
2219 2011-06-29  Ian Lance Taylor  <iant@google.com>
2220
2221         PR gold/12629
2222         * object.cc (Sized_relobj_file::layout_section): Change shdr
2223         parameter to be const.
2224         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2225         out of do_layout.
2226         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2227         appropriate.  Call layout_eh_frame_section.
2228         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2229         sections.
2230         * object.h (class Sized_relobj_file): Update declarations.
2231
2232 2011-06-29  Ian Lance Taylor  <iant@google.com>
2233
2234         PR gold/12652
2235         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2236         modifier.
2237         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2238
2239 2011-06-29  Ian Lance Taylor  <iant@google.com>
2240
2241         PR gold/12675
2242         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2243         SHT_X86_64_UNWIND.
2244         * layout.cc (Layout::layout_eh_frame): Likewise.
2245
2246 2011-06-29  Ian Lance Taylor  <iant@google.com>
2247
2248         PR gold/12695
2249         * layout.cc (Layout::symtab_section_shndx): New function.
2250         * layout.h (class Layout): Declare symtab_section_shndx.
2251         * output.cc (Output_section::write_header): Call it.
2252
2253 2011-06-29  Ian Lance Taylor  <iant@google.com>
2254
2255         PR gold/12818
2256         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2257         symbols which are not used in a relocation.
2258
2259 2011-06-28  Ian Lance Taylor  <iant@google.com>
2260
2261         PR gold/12898
2262         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2263         script create indistinguishable segments.
2264         (Layout::set_segment_offsets): Use stable_sort when sorting
2265         segments.  Pass this to Compare_segments constructor.
2266         * layout.h (class Layout): Make segment_precedes non-static.
2267         (class Compare_segments): Change from struct to class.  Add
2268         layout_ field.  Add constructor.
2269         * script-sections.cc
2270         (Script_sections::attach_sections_using_phdrs_clause): Rename
2271         local orphan to is_orphan.  Don't report failure to put empty
2272         section in segment.  On attachment failure, report name of
2273         section, and attach to first PT_LOAD segment.
2274
2275 2011-06-28  Ian Lance Taylor  <iant@google.com>
2276
2277         PR gold/12934
2278         * target-select.cc (Target_selector::Target_selector): Add
2279         emulation parameter.  Change all callers.
2280         (select_target_by_bfd_name): Rename from select_target_by_name.
2281         Change all callers.
2282         (select_target_by_emulation): New function.
2283         (supported_emulation_names): New function.
2284         * target-select.h (class Target_selector): Add emulation_ field.
2285         Update declarations.
2286         (Target_selector::recognize_by_bfd_name): Rename from
2287         recognize_by_name.  Change all callers.
2288         (Target_selector::supported_bfd_names): Rename from
2289         supported_names.  Change all callers.
2290         (Target_selector::recognize_by_emulation): New function.
2291         (Target_selector::supported_emulations): New function.
2292         (Target_selector::emulation): New function.
2293         (Target_selector::do_recognize_by_bfd_name): Rename from
2294         do_recognize_by_name.  Change all callers.
2295         (Target_selector::do_supported_bfd_names): Rename from
2296         do_supported_names.  Change all callers.
2297         (Target_selector::do_recognize_by_emulation): New function.
2298         (Target_selector::do_supported_emulations): New function.
2299         (select_target_by_bfd_name): Change name in declaration.
2300         (select_target_by_emulation): Declare.
2301         (supported_emulation_names): Declare.
2302         * parameters.cc (parameters_force_valid_target): Try to find
2303         target based on emulation from -m option.
2304         * options.h (class General_options): Change doc string for -m.
2305         * options.cc (help): Print emulations.
2306         (General_options::parse_V): Likewise.
2307         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2308         Add emulation parameter.  Change all callers.
2309
2310 2011-06-28  Ian Lance Taylor  <iant@google.com>
2311
2312         * target.h (class Target): Add osabi_ field.
2313         (Target::osabi): New function.
2314         (Target::set_osabi): New function.
2315         (Target::Target): Initialize osabi_.
2316         (Target::do_adjust_elf_header): Make pure virtual.
2317         (Sized_target::do_adjust_elf_header): Declare.
2318         * target.cc (Sized_target::do_adjust_elf_header): New function.
2319         (class Sized_target): Instantiate all versions.
2320         * freebsd.h (class Target_freebsd): Remove.
2321         (Target_selector_freebsd::do_recognize): Call set_osabi on
2322         Target.
2323         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2324         (Target_selector_freebsd::set_osabi): Remove.
2325         * i386.cc (class Target_i386): Inherit from Sized_target rather
2326         than Target_freebsd.
2327         * x86_64.cc (class Target_x86_64): Likewise.
2328
2329 2011-06-28  Ian Lance Taylor  <iant@google.com>
2330
2331         * target.h (Target::can_check_for_function_pointers): Rewrite.
2332         Make non-virtual.
2333         (Target::can_icf_inline_merge_sections): Likewise.
2334         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2335         (Target::Target_info): Add can_icf_inline_merge_sections field.
2336         (Target::do_can_check_for_function_pointers): New virtual
2337         function.
2338         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2339         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2340         from can_check_for_function_pointers, move in file.
2341         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2342         section_may_have_icf_unsafe_poineters, move in file.
2343         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2344         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2345         Rename from can_check_for_function_pointers, move in file.
2346         (Target_i386::can_icf_inline_merge_sections): Remove.
2347         (Target_i386::i386_info): Initialize
2348         can_icf_inline_merge_sections.
2349         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2350         Initialize can_icf_inline_merge_sections.
2351         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2352         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2353         Rename from can_check_for_function_pointers, move in file.
2354         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2355         (Target_x86_64::x86_64_info): Initialize
2356         can_icf_inline_merge_sections.
2357         * testsuite/testfile.cc (Target_test::test_target_info):
2358         Likewise.
2359         * icf.cc (get_section_contents): Correct formatting.
2360
2361 2011-06-27  Ian Lance Taylor  <iant@google.com>
2362
2363         * symtab.cc (Symbol::versioned_name): New function.
2364         (Symbol_table::add_to_final_symtab): Use versioned_name when
2365         appropriate.
2366         (Symbol_table::sized_write_symbol): Likewise.
2367         * symtab.h (class Symbol): Declare versioned_name.
2368         * stringpool.h (class Stringpool_template): Add variant of add
2369         which takes a std::basic_string.
2370         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2371         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2372         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2373         (ver_test_12.o): New target.
2374         * testsuite/Makefile.in: Rebuild.
2375
2376 2011-06-27  Doug Kwan  <dougkwan@google.com>
2377
2378         * arm.cc (Arm_relocate_functions::thm_jump8,
2379         Arm_relocate_functions::thm_jump11): Use a wider signed
2380         type to compute offset.
2381         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2382         arm_thm_jump8.
2383         * testsuite/Makefile.in: Regenerate.
2384         * testsuite/arm_branch_in_range.sh: Check test results of
2385         arm_thm_jump11 and arm_thm_jump8.
2386         * testsuite/arm_thm_jump11.s: New test source file.
2387         * testsuite/arm_thm_jump11.t: New linker script.
2388         * testsuite/arm_thm_jump8.s: New test source file.
2389         * testsuite/arm_thm_jump8.t: New linker script.
2390
2391 2011-06-24  Ian Lance Taylor  <iant@google.com>
2392
2393         * layout.cc: Include "object.h".
2394         (ctors_sections_in_init_array): New static variable.
2395         (Layout::is_ctors_in_init_array): New function.
2396         (Layout::layout): Add entry to ctors_sections_in_init_array if
2397         appropriate.
2398         * layout.h (class Layout): Declare is_ctors_in_init_array.
2399         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2400         is_ctors_reverse_view is set.
2401         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2402         all callers.  Set is_ctors_reverse_view field of View_size.
2403         (Sized_relobj_file::reverse_words): New function.
2404         * object.h (Sized_relobj_file::View_size): Add
2405         is_ctors_reverse_view field.
2406         (class Sized_relobj_file): Update declarations.
2407         * testsuite/initpri3.c: New test.
2408         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2409         initpri3b.
2410         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2411         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2412         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2413         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2414         * testsuite/Makefile.in: Rebuild.
2415
2416 2011-06-24  Cary Coutant  <ccoutant@google.com>
2417
2418         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2419         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2420         (debug_msg_cdebug.err): New targets.
2421         * testsuite/Makefile.in: Regenerate.
2422         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2423         Fix checks for link with shared library.
2424
2425 2011-06-24  Doug Kwan  <dougkwan@google.com>
2426
2427         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2428         skip empty text sections.
2429         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2430
2431 2011-06-22  Ian Lance Taylor  <iant@google.com>
2432
2433         PR gold/12910
2434         * options.h (class General_options): Add --ctors-in-init-array.
2435         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2436         friends as SHT_PROGBITS for merging sections.
2437         (Layout::layout): Remove special handling of .init_array and
2438         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2439         and .dtors if ctors_in_init_array.
2440         (Layout::make_output_section): Force correct section types for
2441         .init_array and friends.  Don't sort if doing relocatable link,
2442         Don't sort .ctors and .dtors if ctors_in_init_array.
2443         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2444         (Layout::output_section_name): Add relobj parameter.  Change all
2445         callers.  Handle .ctors. and .dtors. in code rather than table.
2446         Handle .ctors and .dtors if ctors_in_init_array.
2447         (Layout::match_file_name): New function, moved from output.cc.
2448         * layout.h (class Layout): Update declarations.
2449         * output.cc: Include "layout.h".
2450         (Input_section_sort_entry::get_priority): New function.
2451         (Input_section_sort_entry::match_file_name): Just call
2452         Layout::match_file_name.
2453         (Output_section::Input_section_sort_init_fini_compare::operator()):
2454         Handle .ctors and .dtors.  Sort by explicit priority rather than
2455         by name.
2456         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2457         * testsuite/initpri2.c: New test.
2458         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2459         (check_PROGRAMS): Add initpri2.
2460         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2461         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2462         * configure, testsuite/Makefile.in: Rebuild.
2463
2464 2011-06-19  Ian Lance Taylor  <iant@google.com>
2465
2466         PR gold/12880
2467         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2468         .interp section to a PT_INTERP segment even if we have seen a
2469         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2470         clause in a linker script.
2471         (Layout::finalize): Don't create a .interp section if we've
2472         already create a PT_INTERP segment.
2473         (Layout::create_interp): Always call choose_output_section (revert
2474         patch of 2011-06-17).  Don't create PT_INTERP segment.
2475         * script-sections.cc
2476         (Script_sections::create_note_and_tls_segments): Add a .interp
2477         section to a PT_INTERP segment even if we have seen a
2478         --dynamic-linker option.
2479
2480 2011-06-18  Ian Lance Taylor  <iant@google.com>
2481
2482         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
2483         merely because a non-PT_LOAD segment has a dynamic reloc.
2484
2485 2011-06-18  Ian Lance Taylor  <iant@google.com>
2486
2487         * layout.cc (Layout::finish_dynamic_section): Don't create
2488         DT_FLAGS entry if not needed.
2489
2490 2011-06-18  Ian Lance Taylor  <iant@google.com>
2491
2492         PR gold/12745
2493         * layout.cc (Layout::layout_eh_frame): Correct handling of
2494         writable .eh_frame section.
2495
2496 2011-06-17  Ian Lance Taylor  <iant@google.com>
2497
2498         PR gold/12893
2499         * resolve.cc (Symbol_table::resolve): Don't give an error if a
2500         symbol is redefined with the exact same object and value.
2501
2502 2011-06-17  Ian Lance Taylor  <iant@google.com>
2503
2504         PR gold/12880
2505         * layout.h (class Layout): Add interp_segment_ field.
2506         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
2507         (Layout::attach_allocated_section_to_segment): If making shared
2508         library, put .interp section in PT_INTERP segment.
2509         (Layout::finalize): Also call create_interp if -dynamic-linker
2510         option was used.
2511         (Layout::create_interp): Assert that there is no PT_INTERP
2512         segment.  If not using a SECTIONS clause, use make_output_section.
2513         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
2514         * script-sections.cc
2515         (Script_sections::create_note_and_tls_segments): If making shared
2516         library, put .interp section in PT_INTERP segment.
2517
2518 2011-06-17  Ian Lance Taylor  <iant@google.com>
2519
2520         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
2521         when making a shared library.
2522
2523 2011-06-17  Ian Lance Taylor  <iant@google.com>
2524
2525         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
2526         parameter.  Change all callers.  Don't issue warning about PC32
2527         against locally defined symbol.
2528
2529 2011-06-16  Ian Lance Taylor  <iant@google.com>
2530
2531         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
2532         occurs in same object.
2533
2534 2011-06-14  Alan Modra  <amodra@gmail.com>
2535
2536         * po/POTFILES.in: Regenerate.
2537
2538 2011-06-09  Ian Lance Taylor  <iant@google.com>
2539
2540         * script-sections.cc
2541         (Orphan_output_section::set_section_addresses): For a relocatable
2542         link set address to 0.
2543
2544 2011-06-09  Cary Coutant  <ccoutant@google.com>
2545
2546         PR gold/12804
2547         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
2548         used with --compress-debug-sections.
2549         * gold/object.cc (Sized_relobj_file::do_layout): Report
2550         uncompressed size of compressed input sections.
2551
2552 2011-06-08  Cary Coutant  <ccoutant@google.com>
2553
2554         PR gold/12804
2555         * testsuite/two_file_test_2_v1.cc: Change initialization of
2556         v2 to keep it in .data.
2557
2558 2011-06-07  Cary Coutant  <ccoutant@google.com>
2559
2560         * common.cc (Symbol_table::do_allocate_commons_list): Call
2561         gold_fallback.
2562         * errors.cc (Errors::fatal): Adjust call to gold_exit.
2563         (Errors::fallback): New function.
2564         (gold_fallback): New function.
2565         * errors.h (Errors::fallback): New function.
2566         * gold.cc (gold_exit): Change status parameter to enum; adjust
2567         all callers.
2568         (queue_initial_tasks): Call gold_fallback.
2569         * gold.h: Include cstdlib.
2570         (Exit_status): New enum type.
2571         (gold_exit): Change status parameter to enum.
2572         (gold_fallback): New function.
2573         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
2574         (Layout::create_symtab_sections): Likewise.
2575         (Layout::create_shdrs): Likewise.
2576         * main.cc (main): Adjust call to gold_exit.
2577         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
2578         (Output_data_got::add_got_entry_pair): Likewise.
2579         (Output_section::add_input_section): Likewise.
2580         (Output_section::add_output_section_data): Likewise.
2581         (Output_segment::set_section_list_addresses): Likewise.
2582         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
2583
2584 2011-06-07  Cary Coutant  <ccoutant@google.com>
2585
2586         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
2587         for incremental links.
2588         * output.cc (Output_segment::set_section_list_addresses): Remove
2589         FIXME and test for TLS or BSS.
2590
2591 2011-06-07  Cary Coutant  <ccoutant@google.com>
2592
2593         * testsuite/Makefile.am: Add incremental_copy_test,
2594         incremental_common_test_1.
2595         * testsuite/Makefile.in: Regenerate.
2596         * testsuite/common_test_1_v1.c: New source file.
2597         * testsuite/common_test_1_v2.c: New source file.
2598         * testsuite/copy_test_v1.cc: New source file.
2599
2600 2011-06-07  Cary Coutant  <ccoutant@google.com>
2601
2602         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
2603         update, allocate common from bss section's free list.
2604         * incremental-dump.cc (dump_incremental_inputs): Print flag for
2605         linker-defined symbols.
2606         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2607         Skip GOT and PLT entries that are no longer referenced.
2608         (Output_section_incremental_inputs::write_info_blocks): Mark
2609         linker-defined symbols.
2610         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
2611         * output.cc (Output_section::allocate): New function.
2612         * output.h (Output_section::allocate): New function.
2613         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
2614         linker-defined symbols.
2615         (Symbol::override_base_with_special): Copy is_predefined_ flag.
2616         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
2617         (Symbol::init_base_output_data): Likewise.
2618         (Symbol::init_base_output_segment): Likewise.
2619         (Symbol::init_base_constant): Likewise.
2620         (Sized_symbol::init_output_data): Likewise.
2621         (Sized_symbol::init_output_segment): Likewise.
2622         (Sized_symbol::init_constant): Likewise.
2623         (Symbol_table::do_define_in_output_data): Likewise.
2624         (Symbol_table::do_define_in_output_segment): Likewise.
2625         (Symbol_table::do_define_as_constant): Likewise.
2626         * symtab.h (Symbol::is_predefined): New function.
2627         (Symbol::init_base_output_data): Add is_predefined parameter.
2628         (Symbol::init_base_output_segment): Likewise.
2629         (Symbol::init_base_constant): Likewise.
2630         (Symbol::is_predefined_): New data member.
2631         (Sized_symbol::init_output_data): Add is_predefined parameter.
2632         (Sized_symbol::init_output_segment): Likewise.
2633         (Sized_symbol::init_constant): Likewise.
2634         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
2635
2636 2011-06-07  Cary Coutant  <ccoutant@google.com>
2637
2638         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
2639         instead of emit_copy_reloc.
2640         (Copy_relocs::emit_copy_reloc): Refactor.
2641         (Copy_relocs::make_copy_reloc): New function.
2642         (Copy_relocs::add_copy_reloc): Remove.
2643         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
2644         section.
2645         (Copy_relocs::make_copy_reloc): New function.
2646         (Copy_relocs::add_copy_reloc): Remove.
2647         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
2648         unchanged input files.
2649         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
2650         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
2651         Reserve BSS space for COPY relocations.
2652         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2653         (Output_section_incremental_inputs::write_info_blocks): Record
2654         whether a symbol is copied from a shared object.
2655         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
2656         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
2657         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
2658         (Incremental_input_entry_reader::get_output_symbol_index): Add
2659         is_copy parameter.
2660         (Incremental_binary::emit_copy_relocs): New function.
2661         (Incremental_binary::do_emit_copy_relocs): New function.
2662         (Sized_incremental_binary::Sized_incremental_binary): Initialize
2663         new data member.
2664         (Sized_incremental_binary::add_copy_reloc): New function.
2665         (Sized_incremental_binary::do_emit_copy_relocs): New function.
2666         (Sized_incremental_binary::Copy_reloc): New struct.
2667         (Sized_incremental_binary::Copy_relocs): New typedef.
2668         (Sized_incremental_binary::copy_relocs_): New data member.
2669         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
2670         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
2671         * target.h (Sized_target::emit_copy_reloc): New function.
2672         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
2673
2674 2011-06-02  Cary Coutant  <ccoutant@google.com>
2675
2676         PR gold/12163
2677         * gold/archive.cc (Archive::Archive): Initialize new data member.
2678         (Archive::include_all_members): Return if archive has already been
2679         included.
2680         * gold/archive.h (Archive::include_all_members_): New data member.
2681
2682 2011-06-02  Nick Clifton  <nickc@redhat.com>
2683
2684         * dynobj.h: Fix spelling mistake in comment.
2685         * output.cc: Likewise.
2686
2687 2011-05-31  Doug Kwan  <dougkwan@google.com>
2688             Asier Llano
2689
2690         PR gold/12826
2691         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
2692         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
2693         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
2694         redundant arm_exidx_test.so.
2695         * testsuite/Makefile.in: Regenerate.
2696         (check_SCRIPTS): Add pr12826.sh
2697         (check_DATA): Add pr12826.stdout
2698         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
2699         * testsuite/pr12826.sh: New file.
2700         * testsuite/pr12826_1.s: Ditto.
2701         * testsuite/pr12826_1.s: Ditto.
2702
2703 2011-05-30  Ian Lance Taylor  <iant@google.com>
2704
2705         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
2706         sections.
2707
2708 2011-05-29  Ian Lance Taylor  <iant@google.com>
2709
2710         PR gold/12804
2711         * testsuite/Makefile.am: Use different file name for two_file_test
2712         temporary file for each incremental test.
2713         * testsuite/Makefile.in: Rebuild.
2714
2715 2011-05-29  Ian Lance Taylor  <iant@google.com>
2716
2717         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
2718         binary input file is empty.
2719
2720 2011-05-27  Ian Lance Taylor  <iant@google.com>
2721
2722         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
2723         (ver_test_9.so): Likewise.
2724         * testsuite/Makefile.in: Rebuild.
2725
2726 2011-05-26 Cary Coutant  <ccoutant@google.com>
2727
2728         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
2729         * incremental.cc (Incremental_inputs::report_input_section): Fix
2730         comment, indentation.
2731         (Incremental_inputs::report_comdat_group): New function.
2732         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2733         of data for incremental input file entry.
2734         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
2735         group count, COMDAT group signatures.
2736         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
2737         an unchanged input file.
2738         * incremental.h (Incremental_object_entry::Incremental_object_entry):
2739         Initialize new data member.
2740         (Incremental_object_entry::add_comdat_group): New function.
2741         (Incremental_object_entry::get_comdat_group_count): New function.
2742         (Incremental_object_entry::get_comdat_signature_key): New function.
2743         (Incremental_object_entry::groups_): New data member.
2744         (Incremental_inputs::report_comdat_group): New function.
2745         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
2746         data for incremental input file entry.
2747         (Incremental_input_entry_reader::get_comdat_group_count): New function.
2748         (Incremental_input_entry_reader::get_input_section): Adjust size of
2749         data for incremental input file entry.
2750         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
2751         (Incremental_input_entry_reader::get_comdat_group_signature): New
2752         function.
2753         * object.cc (Sized_relobj::include_section_group): Report kept
2754         COMDAT groups for incremental links.
2755
2756 2011-05-24  David Meyer  <pdox@google.com>
2757
2758         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
2759         with name parameter.  Add found_name parameter.
2760         * fileread.cc (Input_file::find_file): Adjust code accordingly.
2761         * dirsearch.h (class Dirsearch): Update declaration.
2762
2763 2011-05-24  Ian Lance Taylor  <iant@google.com>
2764
2765         * archive.cc (Library_base::should_include_member): Pull in object
2766         from archive if it defines the entry symbol.
2767         * parameters.cc (Parameters::entry): New function.
2768         * parameters.h (class Parameters): Declare entry.
2769         * output.h (class Output_file_header): Remove entry_ field.
2770         * output.cc (Output_file_header::Output_file_header): Remove entry
2771         parameter.  Change all callers.
2772         (Output_file_header::entry): Use parameters->entry.
2773         * gold.cc (queue_middle_tasks): Likewise.
2774         * plugin.cc (Plugin_hook::run): Likewise.
2775
2776 2011-05-24 Cary Coutant  <ccoutant@google.com>
2777
2778         * gold.cc (queue_initial_tasks): Pass incremental base filename
2779         to Output_file::open_base_file; don't print error message.
2780         * incremental-dump.cc (main): Adjust call to
2781         Output_file::open_for_modification.
2782         * incremental-dump.cc (main): Likewise.
2783         * incremental.cc (Incremental_inputs::report_command_line):
2784         Ignore --incremental-base option when comparing command lines.
2785         Ignore parameter when given as separate argument.
2786         * options.h (class General_options): Add --incremental-base.
2787         * output.cc (Output_file::Output_file):
2788         (Output_file::open_base_file): Add base_name and writable parameters;
2789         read base file into new file; print error message here.
2790         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2791         callers.
2792         * output.h (Output_file::open_for_modification): Rename to...
2793         (Output_file::open_base_file): ...this; add base_name and
2794         writable parameters; adjust all callers.
2795         (Output_file::map_no_anonymous): Add writable parameter; adjust all
2796         callers.
2797         * testsuite/Makefile.am (incremental_test_4): Test
2798         --incremental-base.
2799         * testsuite/Makefile.in: Regenerate.
2800
2801 2011-05-24 Cary Coutant  <ccoutant@google.com>
2802
2803         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
2804         incremental_test_4.
2805         * testsuite/Makefile.in: Regenerate.
2806         * testsuite/two_file_test_1_v1.cc: New test source file.
2807         * testsuite/two_file_test_1b_v1.cc: New test source file.
2808         * testsuite/two_file_test_2_v1.cc: New test source file.
2809
2810 2011-05-24 Cary Coutant  <ccoutant@google.com>
2811
2812         * dynobj.h (Dynobj::do_dynobj): New function.
2813         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
2814         flag and soname for shared objects.
2815         * incremental.cc (Incremental_inputs::report_object): Make
2816         either Incremental_object_entry or Incremental_dynobj_entry; add
2817         soname to string table.
2818         (Incremental_inputs::report_input_section): Add assertion.
2819         (Output_section_incremental_inputs::set_final_data_size): Adjust
2820         type of input file entry for shared libraries; adjust size of
2821         shared library info entry.
2822         (Output_section_incremental_inputs::write_input_files): Write
2823         as_needed flag for shared libraries.
2824         (Output_section_incremental_inputs::write_info_blocks): Adjust type
2825         of input file entry for shared libraries; write soname.
2826         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
2827         soname from incremental info.
2828         * incremental.h (enum Incremental_input_flags): Add
2829         INCREMENTAL_INPUT_AS_NEEDED.
2830         (Incremental_input_entry::Incremental_input_entry): Initialize new
2831         data member.
2832         (Incremental_input_entry::set_as_needed): New function.
2833         (Incremental_input_entry::as_needed): New function.
2834         (Incremental_input_entry::do_dynobj_entry): New function.
2835         (Incremental_input_entry::as_needed_): New data member.
2836         (Incremental_object_entry::Incremental_object_entry): Don't check
2837         for shared library.
2838         (Incremental_object_entry::do_type): Likewise.
2839         (class Incremental_dynobj_entry): New class.
2840         (Incremental_input_entry_reader::as_needed): New function.
2841         (Incremental_input_entry_reader::get_soname): New function.
2842         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
2843         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
2844         size of shared library info entry.
2845         * layout.cc (Layout::finish_dynamic_section): Don't test for
2846         incremental link when adding DT_NEEDED entries.
2847         * object.h (Object::Object): Initialize new data member.
2848         (Object::dynobj): New function.
2849         (Object::set_as_needed): New function.
2850         (Object::as_needed): New function.
2851         (Object::do_dynobj): New function.
2852         (Object::as_needed_): New data member.
2853
2854 2011-05-24 Cary Coutant  <ccoutant@google.com>
2855
2856         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
2857         info; adjust display of GOT entries.
2858         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
2859         vector of input objects; remove file_status_.
2860         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
2861         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
2862         got_plt reader; call target hooks to reserve GOT entries.
2863         (Output_section_incremental_inputs::set_final_data_size): Adjust size
2864         of input file info header and GOT info entry.
2865         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
2866         relocation info.
2867         (Got_plt_view_info::got_descriptor): Remove.
2868         (Got_plt_view_info::sym_index): New data member.
2869         (Got_plt_view_info::input_index): New data member.
2870         (Local_got_offset_visitor::visit): Write input file index.
2871         (Global_got_offset_visitor::visit): Write 0 for input file index.
2872         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
2873         with sym_index and input_index.
2874         (Output_section_incremental_inputs::write_got_plt): Adjust size of
2875         incremental info GOT entry; replace got_descriptor with input_index.
2876         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
2877         map from input file index to object.
2878         (Sized_relobj_incr::do_layout): Replace direct data member reference
2879         with accessor function.
2880         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
2881         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
2882         Adjust size of input file info header.
2883         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
2884         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
2885         (Incremental_input_entry_reader::get_input_section): Adjust size of
2886         input file info header.
2887         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
2888         of incremental info GOT entry.
2889         (Incremental_got_plt_reader::get_got_desc): Remove.
2890         (Incremental_got_plt_reader::get_got_symndx): New function.
2891         (Incremental_got_plt_reader::get_got_input_index): New function.
2892         (Sized_incremental_binary::Sized_incremental_binary): Remove
2893         file_status_; add input_objects_.
2894         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
2895         (Sized_incremental_binary::set_file_is_unchanged): Remove.
2896         (Sized_incremental_binary::file_is_unchanged): Remove.
2897         (Sized_incremental_binary::set_input_object): New function.
2898         (Sized_incremental_binary::input_object): New function.
2899         (Sized_incremental_binary::file_status_): Remove.
2900         (Sized_incremental_binary::input_objects_): New data member.
2901         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
2902         references.
2903         (Sized_relobj_incr::invalid_address): Move to base class.
2904         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
2905         class.
2906         (Sized_relobj_incr::do_output_section_offset): Likewise.
2907         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
2908         (Sized_relobj_incr::section_offsets_): Likewise.
2909         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
2910         function.
2911         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
2912         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
2913         with accessor function.
2914         (Sized_relobj_file::do_layout): Likewise.
2915         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
2916         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
2917         (Sized_relobj_file::compute_final_local_value): Replace refs to
2918         section_offsets_ with accessor function.
2919         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
2920         * object.h (Relobj::Relobj): Initialize new data members.
2921         (Relobj::add_dyn_reloc): New function.
2922         (Relobj::first_dyn_reloc): New function.
2923         (Relobj::dyn_reloc_count): New function.
2924         (Relobj::first_dyn_reloc_): New data member.
2925         (Relobj::dyn_reloc_count_): New data member.
2926         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
2927         references.
2928         (Sized_relobj::Address): New typedef.
2929         (Sized_relobj::invalid_address): Move here from child class.
2930         (Sized_relobj::Sized_relobj): Initialize new data members.
2931         (Sized_relobj::sized_relobj): New function.
2932         (Sized_relobj::is_output_section_offset_invalid): Move here from
2933         child class.
2934         (Sized_relobj::get_output_section_offset): Likewise.
2935         (Sized_relobj::local_has_got_offset): Likewise.
2936         (Sized_relobj::local_got_offset): Likewise.
2937         (Sized_relobj::set_local_got_offset): Likewise.
2938         (Sized_relobj::do_for_all_local_got_entries): Likewise.
2939         (Sized_relobj::clear_got_offsets): New function.
2940         (Sized_relobj::section_offsets): Move here from child class.
2941         (Sized_relobj::do_output_section_offset): Likewise.
2942         (Sized_relobj::do_set_section_offset): Likewise.
2943         (Sized_relobj::Local_got_offsets): Likewise.
2944         (Sized_relobj::local_got_offsets_): Likewise.
2945         (Sized_relobj::section_offsets_): Likewise.
2946         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
2947         references.
2948         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
2949         class.
2950         (Sized_relobj_file::sized_relobj): New function
2951         (Sized_relobj_file::local_has_got_offset): Move to base class.
2952         (Sized_relobj_file::local_got_offset): Likewise.
2953         (Sized_relobj_file::set_local_got_offset): Likewise.
2954         (Sized_relobj_file::get_output_section_offset): Likewise.
2955         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
2956         (Sized_relobj_file::do_output_section_offset): Likewise.
2957         (Sized_relobj_file::do_set_section_offset): Likewise.
2958         (Sized_relobj_file::Local_got_offsets): Likewise.
2959         (Sized_relobj_file::local_got_offsets_): Likewise.
2960         (Sized_relobj_file::section_offsets_): Likewise.
2961         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
2962         (all constructors).
2963         (set_needs_dynsym_index): Convert relobj to derived class pointer.
2964         (Output_reloc::get_symbol_index): Likewise.
2965         (Output_reloc::local_section_offset): Likewise.
2966         (Output_reloc::get_address): Likewise.
2967         (Output_reloc::symbol_value): Likewise.
2968         (Output_data_got::reserve_slot): Move to class definition.
2969         (Output_data_got::reserve_local): New function.
2970         (Output_data_got::reserve_slot_for_global): Remove.
2971         (Output_data_got::reserve_global): New function.
2972         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
2973         (all constructors, two instantiations).
2974         (Output_reloc::get_relobj): New function (two instantiations).
2975         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
2976         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
2977         (Output_data_reloc::add_global): Adjust type of relobj.
2978         (Output_data_reloc::add_global_relative): Likewise.
2979         (Output_data_reloc::add_symbolless_global_addend): Likewise.
2980         (Output_data_reloc::add_local): Likewise.
2981         (Output_data_reloc::add_local_relative): Likewise.
2982         (Output_data_reloc::add_symbolless_local_addend): Likewise.
2983         (Output_data_reloc::add_local_section): Likewise.
2984         (Output_data_reloc::add_output_section): Likewise.
2985         (Output_data_reloc::add_absolute): Likewise.
2986         (Output_data_reloc::add_target_specific): Likewise.
2987         (Output_data_got::reserve_slot): Move definition here.
2988         (Output_data_got::reserve_local): New function.
2989         (Output_data_got::reserve_global): New function.
2990         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
2991         section_offsets_ with accessor function.
2992         (Sized_relobj_file::write_sections): Likewise.
2993         (Sized_relobj_file::do_relocate_sections): Likewise.
2994         * target.h (Sized_target::reserve_local_got_entry): New function.
2995         (Sized_target::reserve_global_got_entry): New function.
2996         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
2997         (Target_x86_64::reserve_global_got_entry): New function.
2998         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
2999
3000 2011-05-23 Cary Coutant  <ccoutant@google.com>
3001
3002         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3003         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3004         bit when checking got_type.
3005         * incremental.cc (Sized_incremental_binary::setup_readers):
3006         Store symbol table and string table locations; initialize bit vector
3007         of file status flags.
3008         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3009         unchanged files.
3010         (Sized_incremental_binary::do_process_got_plt): New function.
3011         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3012         (Output_section_incremental_inputs::set_final_data_size): Record
3013         file index for each input file.
3014         (Output_section_incremental_inputs::write_got_plt): Store file index
3015         instead of input entry offset for each GOT entry.
3016         * incremental.h
3017         (Incremental_input_entry::Incremental_input_entry): Initialize new
3018         data member.
3019         (Incremental_input_entry::set_offset): Store file index.
3020         (Incremental_input_entry::get_file_index): New function.
3021         (Incremental_input_entry::file_index_): New data member.
3022         (Incremental_binary::process_got_plt): New function.
3023         (Incremental_binary::do_process_got_plt): New function.
3024         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3025         data members.
3026         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3027         (Sized_incremental_binary::set_file_is_unchanged): New function.
3028         (Sized_incremental_binary::file_is_unchanged): New function.
3029         (Sized_incremental_binary::do_process_got_plt): New function.
3030         (Sized_incremental_binary::file_status_): New data member.
3031         (Sized_incremental_binary::main_symtab_loc_): New data member.
3032         (Sized_incremental_binary::main_strtab_loc_): New data member.
3033         * output.cc (Output_data_got::Got_entry::write): Add case
3034         RESERVED_CODE.
3035         (Output_data_got::add_global): Call add_got_entry.
3036         (Output_data_got::add_global_plt): Likewise.
3037         (Output_data_got::add_global_with_rel): Likewise.
3038         (Output_data_got::add_global_with_rela): Likewise.
3039         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3040         (Output_data_got::add_global_pair_with_rela): Likewise.
3041         (Output_data_got::add_local): Call add_got_entry.
3042         (Output_data_got::add_local_plt): Likewise.
3043         (Output_data_got::add_local_with_rel): Likewise.
3044         (Output_data_got::add_local_with_rela): Likewise.
3045         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3046         (Output_data_got::add_local_pair_with_rela): Likewise.
3047         (Output_data_got::reserve_slot): New function.
3048         (Output_data_got::reserve_slot_for_global): New function.
3049         (Output_data_got::add_got_entry): New function.
3050         (Output_data_got::add_got_entry_pair): New function.
3051         (Output_section::add_output_section_data): Edit FIXME.
3052         * output.h
3053         (Output_section_data_build::Output_section_data_build): New
3054         constructor with size parameter.
3055         (Output_data_space::Output_data_space): Likewise.
3056         (Output_data_got::Output_data_got): Initialize new data member; new
3057         constructor with size parameter.
3058         (Output_data_got::add_constant): Call add_got_entry.
3059         (Output_data_got::reserve_slot): New function.
3060         (Output_data_got::reserve_slot_for_global): New function.
3061         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3062         (Output_data_got::add_got_entry): New function.
3063         (Output_data_got::add_got_entry_pair): New function.
3064         (Output_data_got::free_list_): New data member.
3065         * target.h (Sized_target::init_got_plt_for_update): New function.
3066         (Sized_target::register_global_plt_entry): New function.
3067         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3068         Initialize new data member; call init; add constructor with PLT count.
3069         (Output_data_plt_x86_64::init): New function.
3070         (Output_data_plt_x86_64::add_relocation): New function.
3071         (Output_data_plt_x86_64::reserve_slot): New function.
3072         (Output_data_plt_x86_64::free_list_): New data member.
3073         (Target_x86_64::init_got_plt_for_update): New function.
3074         (Target_x86_64::register_global_plt_entry): New function.
3075         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3076         incremental updates.
3077         (Output_data_plt_x86_64::add_relocation): New function.
3078         * testsuite/object_unittest.cc (Object_test): Set default options.
3079
3080 2011-05-16  Ian Lance Taylor  <iant@google.com>
3081
3082         * options.h (class General_options): Make -i a synonym for -r.
3083
3084 2011-05-16  Ian Lance Taylor  <iant@google.com>
3085
3086         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3087
3088 2011-05-10 Cary Coutant  <ccoutant@google.com>
3089
3090         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3091         strip_all (-s).
3092
3093 2011-05-06  Ian Lance Taylor  <iant@google.com>
3094
3095         * layout.cc (Layout::layout): If the output section flags change,
3096         update the ordering.
3097
3098 2011-04-25 Cary Coutant  <ccoutant@google.com>
3099
3100         * incremental-dump.cc (dump_incremental_inputs): Print local
3101         symbol info for each input file.
3102         * incremental.cc
3103         (Output_section_incremental_inputs::set_final_data_size): Add local
3104         symbol info to input file entries in incremental info.
3105         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3106         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3107         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3108         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3109         implementation.
3110         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3111         (Sized_incr_relobj::do_relocate): Write the local symbols.
3112         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3113         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3114         Adjust size of input file header.
3115         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3116         (Incremental_inputs_reader::get_local_symbol_count): New function.
3117         (Incremental_inputs_reader::get_input_section): Adjust size of input
3118         file header.
3119         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3120         (Sized_incr_relobj::This): New typedef.
3121         (Sized_incr_relobj::sym_size): New const data member.
3122         (Sized_incr_relobj::Local_symbol): New struct.
3123         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3124         (Sized_incr_relobj::do_local_symbol_offset): New function.
3125         (Sized_incr_relobj::local_symbol_count_): New data member.
3126         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3127         (Sized_incr_relobj::local_symbol_index_): New data member.
3128         (Sized_incr_relobj::local_symbol_offset_): New data member.
3129         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3130         (Sized_incr_relobj::local_symbols_): New data member.
3131         * object.h (Relobj::output_local_symbol_count): New function.
3132         (Relobj::local_symbol_offset): New function.
3133         (Relobj::do_output_local_symbol_count): New function.
3134         (Relobj::do_local_symbol_offset): New function.
3135         (Sized_relobj::do_output_local_symbol_count): New function.
3136         (Sized_relobj::do_local_symbol_offset): New function.
3137
3138 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3139
3140         * descriptors.cc (set_close_on_exec): New function.
3141         (Descriptors::open): Use set_close_on_exec.
3142         * output.cc (S_ISLNK): Define if not defined.
3143
3144 2011-04-22 Cary Coutant  <ccoutant@google.com>
3145
3146         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3147         global symbol map.
3148         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3149         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3150         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3151         relocations.
3152         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3153         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3154         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3155         * incremental.h
3156         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3157         function.
3158         (Incremental_binary::apply_incremental_relocs): New function.
3159         (Incremental_binary::do_apply_incremental_relocs): New function.
3160         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3161         data member.
3162         (Sized_incremental_binary::add_global_symbol): New function.
3163         (Sized_incremental_binary::global_symbol): New function.
3164         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3165         (Sized_incremental_binary::symbol_map_): New data member.
3166         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3167         * target.h (Sized_target::apply_relocation): New function.
3168         * target-reloc.h (apply_relocation): New function.
3169         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3170
3171 2011-04-22  Doug Kwan  <dougkwan@google.com>
3172
3173         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3174         flag of a SHT_ARM_EXIDX section.
3175         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3176         * testsuite/Makefile.in: Regenerate.
3177         * testsuite/arm_exidx_test.s: New file.
3178         * testsuite/arm_exidx_test.sh: Same.
3179
3180 2011-04-20 Cary Coutant  <ccoutant@google.com>
3181
3182         PR gold/12689
3183         * archive.h (Incremental_archive_entry::Archive_member):
3184         Initialize arg_serial_ (second constructor).
3185
3186 2011-04-17  Ian Lance Taylor  <iant@google.com>
3187
3188         * object.cc (Relocate_info::location): Simplify location string.
3189         * errors.cc (Errors::error_at_location): Don't print program
3190         name.
3191         (Errors::warning_at_location): Likewise.
3192         (Errors::undefined_symbol): Likewise.
3193         * testsuite/debug_msg.sh: Update accordingly.
3194
3195 2011-04-14 Cary Coutant  <ccoutant@google.com>
3196
3197         * gold/layout.cc (Layout::symtab_section_offset): New function.
3198         * gold/layout.h (Layout::symtab_section_offset): New function.
3199         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3200
3201 2011-04-12  Ian Lance Taylor  <iant@google.com>
3202
3203         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3204         with MREMAP_MAYMOVE.
3205         * output.h (class Output_file): Add map_is_allocated_ field.
3206         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3207         not available, provide stubs.  If mremap is not available, #define
3208         it to gold_mremap.
3209         (MREMAP_MAYMOVE): Define if not defined.
3210         (Output_file::Output_file): Initialize map_is_allocated_.
3211         (Output_file::resize): Check map_is_allocated_.
3212         (Output_file::map_anonymous): If mmap fails, use malloc.
3213         (Output_file::unmap): Don't do anything for an anonymous map.
3214         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3215         is not available, provide stubs.
3216         (File_read::View::~View): Use free rather than delete[].
3217         (File_read::make_view): Use malloc rather than new[].  If mmap
3218         fails, use malloc.
3219         (File_read::find_or_make_view): Use malloc rather than new[].
3220         * gold.h: Remove HAVE_REMAP code.
3221         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3222         exists.  Rename mremap to gold_mremap.  If mmap is not available
3223         don't do anything.
3224         * configure, config.in: Rebuild.
3225
3226 2011-04-11  Ian Lance Taylor  <iant@google.com>
3227
3228         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3229         initialize local variable v.
3230
3231 2011-04-11  Cary Coutant  <ccoutant@google.com>
3232
3233         * archive.cc (Archive::include_member): Adjust call to
3234         report_object.
3235         (Add_archive_symbols::run): Track argument serial numbers.
3236         (Lib_group::include_member): Likewise.
3237         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3238         * archive.h (Incremental_archive_entry::Archive_member):
3239         Initialize arg_serial_.
3240         (Archive_member::arg_serial_): New data member.
3241         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3242         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3243         incremental link.
3244         (Sized_dynobj::do_for_all_local_got_entries): New function.
3245         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3246         function.
3247         * fileread.cc (get_mtime): New function.
3248         * fileread.h (get_mtime): New function.
3249         * gold.cc (queue_initial_tasks): Check for incremental update.
3250         (process_incremental_input): New function.
3251         (queue_middle_tasks): Don't force valid target for incremental
3252         update.
3253         * incremental-dump.cc (find_input_containing_global): Adjust
3254         size of symbol info entry.
3255         (dump_incremental_inputs): Dump argument serial number and
3256         in_system_directory flag; bias shndx by 1; print symbol names
3257         when dumping per-file symbol lists; use new symbol info readers.
3258         * incremental.cc
3259         (Output_section_incremental_inputs:update_data_size): New function.
3260         (Sized_incremental_binary::setup_readers): Setup input readers
3261         for each input file; build maps for files added from libraries
3262         and scripts.
3263         (Sized_incremental_binary::check_input_args): New function.
3264         (Sized_incremental_binary::do_check_inputs): Build map of argument
3265         serial numbers to input arguments.
3266         (Sized_incremental_binary::do_file_has_changed): Rename
3267         do_file_is_unchanged to this; compare file modification times.
3268         (Sized_incremental_binary::do_init_layout): New function.
3269         (Sized_incremental_binary::do_reserve_layout): New function.
3270         (Sized_incremental_binary::do_get_input_reader): Remove.
3271         (Sized_incremental_binary::get_symtab_view): New function.
3272         (Incremental_checker::can_incrementally_link_output_file): Remove.
3273         (Incremental_inputs::report_command_line): Exclude --debug options.
3274         (Incremental_inputs::report_archive_begin): Add parameter; track
3275         argument serial numbers; don't put input file entry for archive
3276         before archive members.
3277         (Incremental_inputs::report_archive_end): Put input file entry
3278         for archive after archive members.
3279         (Incremental_inputs::report_object): Add parameter; track argument
3280         serial numbers and in_system_directory flag.
3281         (Incremental_inputs::report_script): Add parameter; track argument
3282         serial numbers.
3283         (Output_section_incremental_inputs::set_final_data_size): Adjust
3284         size of symbol info entry; check for forwarding symbols.
3285         (Output_section_incremental_inputs::write_input_files): Write
3286         in_system_directory flag and argument serial number.
3287         (Output_section_incremental_inputs::write_info_blocks): Map section
3288         indices between incremental info and original input file; store
3289         input section index for each symbol.
3290         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3291         change operator() to visit().
3292         (class Global_got_offset_visitor): Likewise.
3293         (class Global_symbol_visitor_got_plt):
3294         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3295         classes.
3296         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3297         (Sized_incr_relobj::do_read_symbols): New function.
3298         (Sized_incr_relobj::do_layout): New function.
3299         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3300         (Sized_incr_relobj::do_add_symbols): New function.
3301         (Sized_incr_relobj::do_should_include_member): New function.
3302         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3303         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3304         (Sized_incr_relobj::do_section_size): New function.
3305         (Sized_incr_relobj::do_section_name): New function.
3306         (Sized_incr_relobj::do_section_contents): New function.
3307         (Sized_incr_relobj::do_section_flags): New function.
3308         (Sized_incr_relobj::do_section_entsize): New function.
3309         (Sized_incr_relobj::do_section_address): New function.
3310         (Sized_incr_relobj::do_section_type): New function.
3311         (Sized_incr_relobj::do_section_link): New function.
3312         (Sized_incr_relobj::do_section_info): New function.
3313         (Sized_incr_relobj::do_section_addralign): New function.
3314         (Sized_incr_relobj::do_initialize_xindex): New function.
3315         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3316         (Sized_incr_relobj::do_read_relocs): New function.
3317         (Sized_incr_relobj::do_gc_process_relocs): New function.
3318         (Sized_incr_relobj::do_scan_relocs): New function.
3319         (Sized_incr_relobj::do_count_local_symbols): New function.
3320         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3321         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3322         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3323         (Sized_incr_relobj::do_relocate): New function.
3324         (Sized_incr_relobj::do_set_section_offset): New function.
3325         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3326         (Sized_incr_dynobj::do_read_symbols): New function.
3327         (Sized_incr_dynobj::do_layout): New function.
3328         (Sized_incr_dynobj::do_add_symbols): New function.
3329         (Sized_incr_dynobj::do_should_include_member): New function.
3330         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3331         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3332         (Sized_incr_dynobj::do_section_size): New function.
3333         (Sized_incr_dynobj::do_section_name): New function.
3334         (Sized_incr_dynobj::do_section_contents): New function.
3335         (Sized_incr_dynobj::do_section_flags): New function.
3336         (Sized_incr_dynobj::do_section_entsize): New function.
3337         (Sized_incr_dynobj::do_section_address): New function.
3338         (Sized_incr_dynobj::do_section_type): New function.
3339         (Sized_incr_dynobj::do_section_link): New function.
3340         (Sized_incr_dynobj::do_section_info): New function.
3341         (Sized_incr_dynobj::do_section_addralign): New function.
3342         (Sized_incr_dynobj::do_initialize_xindex): New function.
3343         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3344         (make_sized_incremental_object): New function.
3345         (Incremental_library::copy_unused_symbols): New function.
3346         (Incremental_library::do_for_all_unused_symbols): New function.
3347         * incremental.h (enum Incremental_input_flags): New type.
3348         (class Incremental_checker): Remove.
3349         (Incremental_input_entry::Incremental_input_entry): Add argument
3350         serial number.
3351         (Incremental_input_entry::arg_serial): New function.
3352         (Incremental_input_entry::set_is_in_system_directory): New function.
3353         (Incremental_input_entry::is_in_system_directory): New function.
3354         (Incremental_input_entry::arg_serial_): New data member.
3355         (Incremental_input_entry::is_in_system_directory_): New data member.
3356         (class Script_info): Move here from script.h.
3357         (Script_info::Script_info): Add filename parameter.
3358         (Script_info::filename): New function.
3359         (Script_info::filename_): New data member.
3360         (Incremental_script_entry::Incremental_script_entry): Add argument
3361         serial number.
3362         (Incremental_object_entry::Incremental_object_entry): Likewise.
3363         (Incremental_object_entry::add_input_section): Build list of input
3364         sections with map to original shndx.
3365         (Incremental_object_entry::get_input_section_index): New function.
3366         (Incremental_object_entry::shndx_): New data member.
3367         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3368         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3369         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3370         serial number.
3371         (Incremental_inputs::report_archive_begin): Likewise.
3372         (Incremental_inputs::report_object): Likewise.
3373         (Incremental_inputs::report_script): Likewise.
3374         (class Incremental_global_symbol_reader): New class.
3375         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3376         and store flags and input file type.
3377         (Incremental_input_entry_reader::arg_serial): New function.
3378         (Incremental_input_entry_reader::type): Extract type from flags.
3379         (Incremental_input_entry_reader::is_in_system_directory): New function.
3380         (Incremental_input_entry_reader::get_input_section_count): Call
3381         accessor function for type.
3382         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3383         function for type; adjust size of global symbol entry.
3384         (Incremental_input_entry_reader::get_global_symbol_count): Call
3385         accessor function for type.
3386         (Incremental_input_entry_reader::get_object_count): Likewise.
3387         (Incremental_input_entry_reader::get_object_offset): Likewise.
3388         (Incremental_input_entry_reader::get_member_count): Likewise.
3389         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3390         (Incremental_input_entry_reader::get_member_offset): Likewise.
3391         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3392         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3393         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3394         (Incremental_input_entry_reader::get_global_symbol_reader): New
3395         function.
3396         (Incremental_input_entry_reader::get_output_symbol_index): New
3397         function.
3398         (Incremental_input_entry_reader::type_): Remove.
3399         (Incremental_input_entry_reader::flags_): New data member.
3400         (Incremental_inputs_reader::input_file_offset): New function.
3401         (Incremental_inputs_reader::input_file_index): New function.
3402         (Incremental_inputs_reader::input_file): Call input_file_offset.
3403         (Incremental_inputs_reader::input_file_at_offset): New function.
3404         (Incremental_relocs_reader::get_r_type): Reformat.
3405         (Incremental_relocs_reader::get_r_shndx): Reformat.
3406         (Incremental_relocs_reader::get_r_offset): Reformat.
3407         (Incremental_relocs_reader::data): New function.
3408         (Incremental_binary::Incremental_binary): Initialize new data members.
3409         (Incremental_binary::check_inputs): Add cmdline parameter.
3410         (Incremental_binary::file_is_unchanged): Remove.
3411         (Input_reader::arg_serial): New function.
3412         (Input_reader::get_unused_symbol_count): New function.
3413         (Input_reader::get_unused_symbol): New function.
3414         (Input_reader::do_arg_serial): New function.
3415         (Input_reader::do_get_unused_symbol_count): New function.
3416         (Input_reader::do_get_unused_symbol): New function.
3417         (Incremental_binary::input_file_count): New function.
3418         (Incremental_binary::get_input_reader): Change signature to use
3419         index instead of filename.
3420         (Incremental_binary::file_has_changed): New function.
3421         (Incremental_binary::get_input_argument): New function.
3422         (Incremental_binary::get_library): New function.
3423         (Incremental_binary::get_script_info): New function.
3424         (Incremental_binary::init_layout): New function.
3425         (Incremental_binary::reserve_layout): New function.
3426         (Incremental_binary::output_file): New function.
3427         (Incremental_binary::do_check_inputs): New function.
3428         (Incremental_binary::do_file_is_unchanged): Remove.
3429         (Incremental_binary::do_file_has_changed): New function.
3430         (Incremental_binary::do_init_layout): New function.
3431         (Incremental_binary::do_reserve_layout): New function.
3432         (Incremental_binary::do_input_file_count): New function.
3433         (Incremental_binary::do_get_input_reader): Change signature.
3434         (Incremental_binary::input_args_map_): New data member.
3435         (Incremental_binary::library_map_): New data member.
3436         (Incremental_binary::script_map_): New data member.
3437         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3438         new data members.
3439         (Sized_incremental_binary::output_section): New function.
3440         (Sized_incremental_binary::inputs_reader): Add const.
3441         (Sized_incremental_binary::symtab_reader): Add const.
3442         (Sized_incremental_binary::relocs_reader): Add const.
3443         (Sized_incremental_binary::got_plt_reader): Add const.
3444         (Sized_incremental_binary::get_symtab_view): New function.
3445         (Sized_incremental_binary::Inputs_reader): New typedef.
3446         (Sized_incremental_binary::Input_entry_reader): New typedef.
3447         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3448         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3449         (Sized_incremental_binary::do_file_has_changed): New function.
3450         (Sized_incremental_binary::do_init_layout): New function.
3451         (Sized_incremental_binary::do_reserve_layout): New function.
3452         (Sized_input_reader::Inputs_reader): Remove.
3453         (Sized_input_reader::Input_entry_reader): Remove.
3454         (Sized_input_reader::do_arg_serial): New function.
3455         (Sized_input_reader::do_get_unused_symbol_count): New function.
3456         (Sized_input_reader::do_get_unused_symbol): New function.
3457         (Sized_incremental_binary::do_input_file_count): New function.
3458         (Sized_incremental_binary::do_get_input_reader): Change signature;
3459         use index instead of filename.
3460         (Sized_incremental_binary::section_map_): New data member.
3461         (Sized_incremental_binary::input_entry_readers_): New data member.
3462         (class Sized_incr_relobj): New class.
3463         (class Sized_incr_dynobj): New class.
3464         (make_sized_incremental_object): New function.
3465         (class Incremental_library): New class.
3466         * layout.cc (Free_list::num_lists): New static data member.
3467         (Free_list::num_nodes): New static data member.
3468         (Free_list::num_removes): New static data member.
3469         (Free_list::num_remove_visits): New static data member.
3470         (Free_list::num_allocates): New static data member.
3471         (Free_list::num_allocate_visits): New static data member.
3472         (Free_list::init): New function.
3473         (Free_list::remove): New function.
3474         (Free_list::allocate): New function.
3475         (Free_list::dump): New function.
3476         (Free_list::print_stats): New function.
3477         (Layout_task_runner::run): Resize output file for incremental updates.
3478         (Layout::Layout): Initialize new data members.
3479         (Layout::set_incremental_base): New function.
3480         (Layout::init_fixed_output_section): New function.
3481         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
3482         incremental updates.
3483         (Layout::create_gold_note): Do not create gold note section for
3484         incremental updates.
3485         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
3486         for incremental updates.
3487         (Layout::set_section_offsets): For incremental updates, allocate space
3488         from free list.
3489         (Layout::create_symtab_sections): Layout with offsets relative to
3490         start of section; for incremental updates, allocate space from free
3491         list.
3492         (Layout::create_shdrs): For incremental updates, allocate space from
3493         free list.
3494         (Layout::finish_dynamic_section): For incremental updates, do not
3495         check --as-needed (fixed in subsequent patch).
3496         * layout.h (class Free_list): New class.
3497         (Layout::set_incremental_base): New function.
3498         (Layout::incremental_base): New function.
3499         (Layout::init_fixed_output_section): New function.
3500         (Layout::allocate): New function.
3501         (Layout::incremental_base_): New data member.
3502         (Layout::free_list_): New data member.
3503         * main.cc (main): Print Free_list statistics.
3504         * object.cc (Relobj::finalize_incremental_relocs): Add
3505         clear_counts parameter; clear counts only when clear_counts is set.
3506         (Sized_relobj::Sized_relobj): Initialize new base class.
3507         (Sized_relobj::do_layout): Don't report special sections.
3508         (Sized_relobj::do_for_all_local_got_entries): New function.
3509         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
3510         symtab_off to all symbol table offsets.
3511         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
3512         * object.h (class Got_offset_list): Move to top of file.
3513         (Object::Object): Allow case where input_file == NULL.
3514         (Object::~Object): Likewise.
3515         (Object::input_file): Assert that input_file != NULL.
3516         (Object::lock): Allow case where input_file == NULL.
3517         (Object::unlock): Likewise.
3518         (Object::is_locked): Likewise.
3519         (Object::token): Likewise.
3520         (Object::release): Likewise.
3521         (Object::is_incremental): New function.
3522         (Object::get_mtime): New function.
3523         (Object::for_all_local_got_entries): New function.
3524         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
3525         (Object::set_is_in_system_directory): New function.
3526         (Object::is_in_system_directory): New function.
3527         (Object::do_is_incremental): New function.
3528         (Object::do_get_mtime): New function.
3529         (Object::do_for_all_local_got_entries): New function.
3530         (Object::is_in_system_directory_): New data member.
3531         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
3532         (class Sized_relobj_base): New class.
3533         (class Sized_relobj): Derive from Sized_relobj_base.
3534         (class Sized_relobj::Symbols): Redeclare from base class.
3535         (class Sized_relobj::local_got_offset_list): Remove.
3536         (class Sized_relobj::Output_sections): Redeclare from base class.
3537         (class Sized_relobj::do_for_all_local_got_entries): New function.
3538         (class Sized_relobj::write_local_symbols): Add offset parameter.
3539         (class Sized_relobj::local_symbol_offset_): Update comment.
3540         (class Sized_relobj::local_dynsym_offset_): Update comment.
3541         * options.cc (Input_arguments::add_file): Remove const.
3542         * options.h (Input_file_argument::Input_file_argument):
3543         Initialize arg_serial_ (all constructors).
3544         (Input_file_argument::set_arg_serial): New function.
3545         (Input_file_argument::arg_serial): New function.
3546         (Input_file_argument::arg_serial_): New data member.
3547         (Input_arguments::Input_arguments): Initialize file_count_.
3548         (Input_arguments::add_file): Remove const.
3549         (Input_arguments::number_of_input_files): New function.
3550         (Input_arguments::file_count_): New data member.
3551         (Command_line::number_of_input_files): Call
3552         Input_arguments::number_of_input_files.
3553         * output.cc (Output_segment_headers::Output_segment_headers):
3554         Set current size.
3555         (Output_section::Input_section::current_data_size): New function.
3556         (Output_section::Output_section): Initialize new data members.
3557         (Output_section::add_input_section): Don't do merge sections for
3558         an incremental link; allocate space from free list for an
3559         incremental update.
3560         (Output_section::add_output_section_data): Allocate space from
3561         free list for an incremental update.
3562         (Output_section::update_data_size): New function.
3563         (Output_section::set_fixed_layout): New function.
3564         (Output_section::reserve): New function.
3565         (Output_segment::set_section_addresses): Remove const.
3566         (Output_segment::set_section_list_addresses): Remove const; allocate
3567         space from free list for an incremental update.
3568         (Output_segment::set_offset): Adjust size of RELRO segment for an
3569         incremental update.
3570         * output.h (Output_data::current_data_size): Move here from
3571         child classes.
3572         (Output_data::pre_finalize_data_size): New function.
3573         (Output_data::update_data_size): New function.
3574         (Output_section_headers::update_data_size): new function.
3575         (Output_section_data_build::current_data_size): Move to Output_data.
3576         (Output_data_strtab::update_data_size): New function.
3577         (Output_section::current_data_size): Move to Output_data.
3578         (Output_section::set_fixed_layout): New function.
3579         (Output_section::has_fixed_layout): New function.
3580         (Output_section::reserve): New function.
3581         (Output_section::update_data_size): New function.
3582         (Output_section::has_fixed_layout_): New data member.
3583         (Output_section::free_list_): New data member.
3584         (Output_segment::set_section_addresses): Remove const.
3585         (Output_segment::set_section_list_addresses): Remove const.
3586         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
3587         New function.
3588         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
3589         New function.
3590         * readsyms.cc (Read_symbols::do_read_symbols): Add library
3591         parameter when calling Add_symbols constructor; store argument
3592         serial number for members of a lib group.
3593         (Add_symbols::locks): Allow case where token == NULL.
3594         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
3595         (Read_member::~Read_member): New function.
3596         (Read_member::is_runnable): New function.
3597         (Read_member::locks): New function.
3598         (Read_member::run): New function.
3599         (Check_script::~Check_script): New function.
3600         (Check_script::is_runnable): New function.
3601         (Check_script::locks): New function.
3602         (Check_script::run): New function.
3603         (Check_library::~Check_library): New function.
3604         (Check_library::is_runnable): New function.
3605         (Check_library::locks): New function.
3606         (Check_library::run): New function.
3607         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
3608         (Add_symbols::library_): New data member.
3609         (class Read_member): New class.
3610         (class Check_script): New class.
3611         (class Check_library): New class.
3612         * reloc.cc (Read_relocs::is_runnable): Allow case where
3613         token == NULL.
3614         (Read_relocs::locks): Likewise.
3615         (Scan_relocs::locks): Likewise.
3616         (Relocate_task::locks): Likewise.
3617         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
3618         to clear counters.
3619         (Sized_relobj::incremental_relocs_scan): Fix comment.
3620         (Sized_relobj::do_relocate): Pass output file offset to
3621         write_local_symbols.
3622         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
3623         from class declaration.
3624         * script.cc (read_input_script): Allocate Script_info; pass
3625         argument serial number to report_script.
3626         * script.h (class Script_info): Move to incremental.h.
3627         * symtab.cc (Symbol_table::add_from_incrobj): New function.
3628         * symtab.h (Symbol_table::add_from_incrobj): New function.
3629         (Symbol_table::set_file_offset): New function.
3630
3631 2011-04-05  Cary Coutant  <ccoutant@google.com>
3632
3633         * incremental-dump.cc (dump_incremental_inputs): Change signature
3634         to take a Sized_incremental_binary; change caller.  Use readers
3635         in Sized_incremental_binary.
3636         * incremental.cc
3637         (Sized_incremental_binary::find_incremental_inputs_sections):
3638         Rename do_find_incremental_inputs_sections to this.
3639         (Sized_incremental_binary::setup_readers): New function.
3640         (Sized_incremental_binary::do_check_inputs): Check
3641         has_incremental_info_ flag; move setup code to setup_readers;
3642         use input readers.
3643         (Sized_incremental_binary::do_file_is_unchanged): New function.
3644         (Sized_incremental_binary::do_get_input_reader): New function.
3645         * incremental.h (class Incremental_binary): Move to end of file.
3646         (Incremental_binary::file_is_unchanged): New function.
3647         (Incremental_binary::do_file_is_unchanged): New function.
3648         (Incremental_binary::Input_reader): New class.
3649         (Incremental_binary::get_input_reader): New function.
3650         (class Sized_incremental_binary): Move to end of file.
3651         (Sized_incremental_binary::Sized_incremental_binary): Setup the
3652         input section reader classes.
3653         (Sized_incremental_binary::has_incremental_info): New function.
3654         (Sized_incremental_binary::inputs_reader): New function.
3655         (Sized_incremental_binary::symtab_reader): New function.
3656         (Sized_incremental_binary::relocs_reader): New function.
3657         (Sized_incremental_binary::got_plt_reader): New function.
3658         (Sized_incremental_binary::do_file_is_unchanged): New function.
3659         (Sized_incremental_binary::Sized_input_reader): New class.
3660         (Sized_incremental_binary::get_input_reader): New function.
3661         (Sized_incremental_binary::find_incremental_inputs_sections):
3662         Rename do_find_incremental_inputs_sections to this.
3663         (Sized_incremental_binary::setup_readers): New function.
3664         (Sized_incremental_binary::has_incremental_info_): New data member.
3665         (Sized_incremental_binary::inputs_reader_): New data member.
3666         (Sized_incremental_binary::symtab_reader_): New data member.
3667         (Sized_incremental_binary::relocs_reader_): New data member.
3668         (Sized_incremental_binary::got_plt_reader_): New data member.
3669         (Sized_incremental_binary::current_input_file_): New data member.
3670
3671 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
3672
3673         PR gold/12640
3674         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
3675         violation.
3676
3677 2011-03-30  Cary Coutant  <ccoutant@google.com>
3678
3679         * archive.cc (Archive::include_member): Adjust call to report_object.
3680         (Add_archive_symbols::run): Add script_info to call to
3681         report_archive_begin.
3682         (Lib_group::include_member): Adjust call to report_object.
3683         (Add_lib_group_symbols::run): Adjust call to report_object.
3684         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
3685         blocks.  Add object count for script input files.
3686         * incremental.cc (Incremental_inputs::report_archive_begin): Add
3687         script_info parameter; change all callers.
3688         (Incremental_inputs::report_object): Add script_info parameter;
3689         change all callers.
3690         (Incremental_inputs::report_script): Store backpointer to
3691         incremental info entry.
3692         (Output_section_incremental_inputs::set_final_data_size): Record
3693         additional information for scripts.
3694         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3695         * incremental.h (Incremental_script_entry::add_object): New function.
3696         (Incremental_script_entry::get_object_count): New function.
3697         (Incremental_script_entry::get_object): New function.
3698         (Incremental_script_entry::objects_): New data member; adjust
3699         constructor.
3700         (Incremental_inputs::report_archive_begin): Add script_info parameter.
3701         (Incremental_inputs::report_object): Add script_info parameter.
3702         (Incremental_inputs_reader::get_object_count): New function.
3703         (Incremental_inputs_reader::get_object_offset): New function.
3704         * options.cc (Input_arguments::add_file): Return reference to
3705         new input argument.
3706         * options.h (Input_argument::set_script_info): New function.
3707         (Input_argument::script_info): New function.
3708         (Input_argument::script_info_): New data member; adjust all
3709         constructors.
3710         (Input_file_group::add_file): Return reference to new input argument.
3711         (Input_file_lib::add_file): Likewise.
3712         (Input_arguments::add_file): Likewise.
3713         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
3714         * script.cc (Parser_closure::Parser_closure): Add script_info
3715         parameter; adjust all callers.
3716         (Parser_closure::script_info): New function.
3717         (Parser_closure::script_info_): New data member.
3718         (read_input_script): Report scripts earlier to incremental info.
3719         (script_add_file): Set script_info in Input_argument.
3720         (script_add_library): Likewise.
3721         * script.h (Script_options::Script_info): Rewrite class.
3722
3723 2011-03-29  Cary Coutant  <ccoutant@google.com>
3724
3725         * archive.cc (Library_base::should_include_member): Move
3726         method here from class Archive.
3727         (Archive::Archive): Initialize base class.
3728         (Archive::should_include_member): Move to base class.
3729         (Archive::do_for_all_unused_symbols): New function.
3730         (Add_archive_symbols::run): Remove redundant access to
3731         incremental_inputs.
3732         (Lib_group::Lib_group): Initialize base class.
3733         (Lib_group::do_filename): New function.
3734         (Lib_group::include_member): Pass pointer to Lib_group to
3735         report_object.
3736         (Lib_group::do_for_all_unused_symbols): New function.
3737         (Add_lib_group_symbols::run): Report archive information for
3738         incremental links.
3739         * archive.h (class Library_base): New base class.
3740         (class Archive): Derive from Library_base.
3741         (Archive::filename): Move to base class.
3742         (Archive::set_incremental_info): Likewise.
3743         (Archive::incremental_info): Likewise.
3744         (Archive::Should_include): Likewise.
3745         (Archive::should_include_member): Likewise.
3746         (Archive::Armap_entry): Remove.
3747         (Archive::Unused_symbol_iterator): Remove.
3748         (Archive::unused_symbols_begin): Remove.
3749         (Archive::unused_symbols_end): Remove.
3750         (Archive::do_filename): New function.
3751         (Archive::do_get_mtime): New function.
3752         (Archive::do_for_all_unused_symbols): New function.
3753         (Archive::task_): Move to base class.
3754         (Archive::incremental_info_): Likewise.
3755         (class Lib_group): Derive from Library_base.
3756         (Lib_group::do_filename): New function.
3757         (Lib_group::do_get_mtime): New function.
3758         (Lib_group::do_for_all_unused_symbols): New function.
3759         (Lib_group::task_): Move to base class.
3760         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
3761         function.
3762         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
3763         function.
3764         * incremental.cc (Incremental_inputs::report_archive_begin):
3765         Use Library_base; call library's get_mtime; add incremental inputs
3766         entry before members.
3767         (class Unused_symbol_visitor): New class.
3768         (Incremental_inputs::report_archive_end): Use Library_base; use
3769         visitor class to record unused symbols; don't add incremental inputs
3770         entry after members.
3771         (Incremental_inputs::report_object): Use Library_base.
3772         * incremental.h
3773         (Incremental_archive_entry::Incremental_archive_entry): Remove
3774         unused Archive parameter.
3775         (Incremental_inputs::report_archive_begin): Use Library_base.
3776         (Incremental_inputs::report_archive_end): Likewise.
3777         (Incremental_inputs::report_object): Likewise.
3778         * object.cc (Sized_relobj::do_for_all_global_symbols): New
3779         function.
3780         * object.h (Object::for_all_global_symbols): New function.
3781         (Object::do_for_all_global_symbols): New function.
3782         (Sized_relobj::do_for_all_global_symbols): New function.
3783         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
3784         function.
3785         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
3786         function.
3787
3788 2011-03-27  Ian Lance Taylor  <iant@google.com>
3789
3790         * archive.cc (Archive::interpret_header): Return -1 if something
3791         goes wrong.  Change callers accordingly.
3792
3793 2011-03-25  Cary Coutant  <ccoutant@google.com>
3794
3795         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
3796         * testsuite/Makefile.in: Regenerate.
3797
3798 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
3799
3800         * plugin.cc (get_view): New.
3801         (Plugin::load): Pass get_view to the plugin.
3802         (Plugin_manager::get_view): New.
3803
3804 2011-03-21  Ian Lance Taylor  <iant@google.com>
3805
3806         * testsuite/final_layout.sh: Rewrite to not use dc.
3807         * testsuite/relro_test.sh: Fail if dc is not present.
3808
3809 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
3810
3811         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
3812         Change == to -eq.
3813         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
3814         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
3815         Change == to -eq.
3816         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
3817         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
3818
3819 2011-03-14  Ian Lance Taylor  <iant@google.com>
3820
3821         * script-sections.cc (Sort_output_sections::script_compare):
3822         Rename from is_before, change return type.
3823         (Sort_output_sections::operator()): Adjust accordingly.
3824
3825 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
3826
3827         PR gold/12572
3828         * testsuite/odr_violation2.cc: Add comment to make all error line
3829         numbers double digits.
3830         * testsuite/debug_msg.sh: Adjust expected errors.
3831
3832 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
3833
3834         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
3835         but mark earlier ones as non-canonical
3836         (offset_to_iterator): Update search target and example
3837         (do_addr2line): Return extra lines in a vector*
3838         (format_file_lineno): Extract from do_addr2line
3839         (one_addr2line): Add vector* out-param
3840         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
3841         when a lineno entry appeared last for its instruction
3842         (Dwarf_line_info): Add vector* out-param
3843         * object.cc (Relocate_info): Pass NULL for the vector* out-param
3844         * symtab.cc (Odr_violation_compare): Include the lineno in the
3845         comparison again.
3846         (linenos_from_loc): New. Combine the canonical line for an
3847         address with its other lines.
3848         (True_if_intersect): New. Helper functor to make
3849         std::set_intersection a query.
3850         (detect_odr_violations): Compare sets of lines instead of just
3851         one line for each function. This became less deterministic, but
3852         has fewer false positives.
3853         * symtab.h: Declarations.
3854         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
3855         mix an optimized and non-optimized object in the same binary
3856         (odr_violation2.so): Same.
3857         * testsuite/Makefile.in: Regenerate from Makefile.am.
3858         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
3859         * testsuite/debug_msg.sh: Update line numbers and add
3860         assertions.
3861         * testsuite/odr_violation1.cc: Use OdrDerived, in a
3862         non-optimized context.
3863         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
3864         isn't inlined, and use OdrDerived in an optimized context.
3865         * testsuite/odr_header1.h: Defines OdrDerived, where
3866         optimization will change the
3867         first-instruction-in-the-destructor's file and line number.
3868         * testsuite/odr_header2.h: Defines OdrBase.
3869
3870 2011-03-09  Ian Lance Taylor  <iant@google.com>
3871
3872         * fileread.cc (File_read::clear_views): Don't delete the whole
3873         file view.
3874
3875 2011-03-08  Ian Lance Taylor  <iant@google.com>
3876
3877         PR gold/12525
3878         * fileread.cc: #include <climits>.
3879         (GOLD_IOV_MAX): Define.
3880         (File_read::read_multiple): Limit number of entries by iov_max.
3881         * fileread.h (class File_read): Always set max_readv_entries to
3882         128.
3883
3884 2011-03-07  Ian Lance Taylor  <iant@google.com>
3885
3886         PR gold/12525
3887         * options.h (class General_options): Add -dy and -dn.
3888
3889 2011-03-02  Cary Coutant  <ccoutant@google.com>
3890
3891         * testsuite/script_test_9.t: Add TLS segment.
3892
3893 2011-03-02  Simon Baldwin  <simonb@google.com>
3894
3895         * configure.ac: Add check for gnu_indirect_function support in
3896         the toolchain building binutils.
3897         * configure: Rebuild.
3898
3899 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
3900
3901         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
3902         plugin only symbols.
3903         (Symbol_table::sized_finalize_symbol) Mark symbol only present
3904         in plugin files as not needed in the symbol table.
3905
3906 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
3907
3908         * output.cc (Output_section::add_input_section): Delay fill
3909         generation for section ordering.
3910
3911 2011-02-09  Ian Lance Taylor  <iant@google.com>
3912
3913         PR gold/12316
3914         * object.h (class Sized_relobj): Remove clear_local_symbols.
3915         * reloc.cc (Sized_relobj::do_relocate): Don't call
3916         clear_local_symbols.
3917
3918 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
3919
3920         * plugin.cc (is_visible_from_outside): Return true for symbols
3921         in the -u option.
3922
3923 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
3924
3925         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
3926         filename.
3927
3928 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
3929
3930         * icf.h (is_section_foldable_candidate): Change type of parameter
3931         to std::string.
3932         * icf.cc (Icf::find_identical_sections): Change type of local variable
3933         section_name to be std::string.
3934         (is_function_ctor_or_dtor): Change type of parameter to std::string.
3935
3936 2011-01-25  Ian Lance Taylor  <iant@google.com>
3937
3938         * script.cc (script_add_extern): Rewrite to use
3939         add_symbol_reference.
3940
3941 2011-01-25  Doug Kwan  <dougkwan@google.com>
3942
3943         * icf.cc (get_section_contents): Always lock section's object.
3944
3945 2011-01-24  Ian Lance Taylor  <iant@google.com>
3946
3947         * options.h (class General_options): Accept
3948         --no-detect-odr-violations.
3949
3950 2011-01-24  Ian Lance Taylor  <iant@google.com>
3951
3952         * version.cc (version_string): Bump to 1.11.
3953
3954 2011-01-24  Ian Lance Taylor  <iant@google.com>
3955
3956         * plugin.cc (class Plugin_rescan): Define new class.
3957         (Plugin_manager::claim_file): Set any_claimed_.
3958         (Plugin_manager::save_archive): New function.
3959         (Plugin_manager::save_input_group): New function.
3960         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
3961         necessary.
3962         (Plugin_manager::new_undefined_symbol): New function.
3963         (Plugin_manager::rescan): New function.
3964         (Plugin_manager::rescannable_defines): New function.
3965         (Plugin_manager::add_input_file): Set any_added_.
3966         * plugin.h (class Plugin_manager): define new fields rescannable_,
3967         undefined_symbols_, any_claimed_, and any_added_.  Declare
3968         Plugin_rescan as friend.  Declare new functions.
3969         (Plugin_manager::Rescannable): Define type.
3970         (Plugin_manager::Rescannable_list): Define type.
3971         (Plugin_manager::Undefined_symbol_list): Define type.
3972         (Plugin_manager::Plugin_manager): Initialize new fields.
3973         * archive.cc (Archive::defines_symbol): New function.
3974         (Add_archive_symbols::run): Pass archive to plugins if any.
3975         * archive.h (class Archive): Declare defines_symbol.
3976         * readsyms.cc (Input_group::~Input_group): New function.
3977         (Finish_group::run): Pass input_group to plugins if any.
3978         * readsyms.h (class Input_group): Declare destructor.
3979         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
3980         any.
3981
3982 2011-01-10  Ian Lance Taylor  <iant@google.com>
3983
3984         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
3985         section as relro.
3986         (Layout::set_segment_offsets): Reset increase_relro before calling
3987         set_section_addresses a second time.
3988
3989 2011-01-04  Cary Coutant  <ccoutant@google.com>
3990
3991         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
3992         sections before NOBITS sections.
3993
3994 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
3995
3996         * version.cc (print_version): Update copyright to 2011.
3997
3998 2010-12-23  Cary Coutant  <ccoutant@google.com>
3999
4000         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4001         of OS to this->add.  Add OD parameter to second form of the function.
4002
4003 2010-12-20  Ian Lance Taylor  <iant@google.com>
4004
4005         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4006         second of two consecutive entries with same offset.
4007
4008 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4009
4010         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4011         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4012         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4013         to avoid unneeded links against $(LDADD).
4014         * testsuite/Makefile.in: Regenerate.
4015
4016 2010-12-15  Ian Lance Taylor  <iant@google.com>
4017
4018         PR gold/12324
4019         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4020         for R_X86_64_32 and R_X86_64_PC32.
4021         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4022         ver_matching_def_pic.o.
4023         (ver_matching_def_pic.o): New target.
4024
4025 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4026
4027         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4028         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4029         Move definition before File_read::View member definitions.
4030         (File_read::View::~View): Initialize and hold lock before
4031         updating current_mapped_bytes.
4032
4033 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4034
4035         * dwarf_reader.cc: Remove outdated comment.
4036         * gold-threads.cc: Fix typo in error message.
4037         * archive.cc: Fix typos in comments.
4038         * archive.h: Likewise.
4039         * arm-reloc-property.cc: Likewise.
4040         * arm-reloc-property.h: Likewise.
4041         * arm-reloc.def: Likewise.
4042         * arm.cc: Likewise.
4043         * attributes.h: Likewise.
4044         * cref.cc: Likewise.
4045         * ehframe.cc: Likewise.
4046         * fileread.h: Likewise.
4047         * gold.h: Likewise.
4048         * i386.cc: Likewise.
4049         * icf.cc: Likewise.
4050         * incremental.h: Likewise.
4051         * int_encoding.cc: Likewise.
4052         * layout.h: Likewise.
4053         * main.cc: Likewise.
4054         * merge.h: Likewise.
4055         * object.cc: Likewise.
4056         * object.h: Likewise.
4057         * options.cc: Likewise.
4058         * readsyms.cc: Likewise.
4059         * reduced_debug_output.cc: Likewise.
4060         * reloc.cc: Likewise.
4061         * script-sections.cc: Likewise.
4062         * sparc.cc: Likewise.
4063         * symtab.h: Likewise.
4064         * target-reloc.h: Likewise.
4065         * target.cc: Likewise.
4066         * target.h: Likewise.
4067         * timer.cc: Likewise.
4068         * timer.h: Likewise.
4069         * x86_64.cc: Likewise.
4070
4071 2010-12-09  Cary Coutant  <ccoutant@google.com>
4072
4073         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4074         stack.
4075         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4076         parameter; change all callers.
4077         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4078         * options.h (warn_execstack): New option.
4079
4080 2010-12-07  Doug Kwan  <dougkwan@google.com>
4081
4082         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4083         like function call relocations.
4084
4085 2010-12-07  Ian Lance Taylor  <iant@google.com>
4086
4087         * archive.cc (Archive::get_elf_object_for_member): Permit
4088         punconfigured to be NULL.
4089         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4090         (Archive::include_member): Pass NULL to get_elf_object_for_member
4091         if we searched for the archive and this is the first included
4092         object.
4093
4094 2010-12-01  Ian Lance Taylor  <iant@google.com>
4095
4096         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4097         track_relocs_type_ field.
4098         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4099         Set track_relocs_type_.
4100         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4101         contents when using RELA relocs.
4102         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4103         reloc_map_.
4104         * reloc.cc (Track_relocs::next_addend): New function.
4105         * reloc.h (class Track_relocs): Declare next_addend.
4106
4107 2010-12-01  Ian Lance Taylor  <iant@google.com>
4108
4109         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4110         virtual destructor.
4111
4112 2010-12-01  Ian Lance Taylor  <iant@google.com>
4113
4114         * README: Update compilers known to work and fail.
4115
4116 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4117
4118         * configure.in: For --enable-gold, handle value `default' instead of
4119         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4120         not the default.
4121         * configure: Regenerate.
4122
4123 2010-11-18  Doug Kwan  <dougkwan@google.com>
4124
4125         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4126         and right_alignment to be zero.  Store result alignment only if it is
4127         greater than existing alignment.
4128
4129 2010-11-16  Cary Coutant  <ccoutant@google.com>
4130
4131         PR gold/12220
4132         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4133         Check for ".zdebug_line".
4134
4135 2010-11-16  Doug Kwan  <dougkwan@google.com>
4136             Cary Coutant  <ccoutant@google.com>
4137
4138         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4139         by reference; adjust all callers.
4140         * output.cc (Output_segment::set_section_addresses): Adjust references
4141         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4142         list is empty.
4143         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4144         end at page boundary.
4145
4146 2010-11-16  Cary Coutant  <ccoutant@google.com>
4147
4148         PR gold/12220
4149         * layout.cc (Layout::choose_output_section): Transform names of
4150         compressed sections even when using a script with a SECTIONS clause.
4151         (Layout::output_section_name): Remove code to transform
4152         compressed debug section names.
4153         * output.cc (Output_section::add_input_section): Use uncompressed
4154         section size when tracking input sections.
4155
4156 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4157
4158         * symtab.h (Symbol::NON_PIC_REF): Remove.
4159         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4160         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4161         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4162         (Symbol::use_plt_offset): Take a flags argument and pass it
4163         directly to needs_dynamic_reloc.  Restrict check for undefined
4164         weak symbols to function calls.
4165         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4166         (Target_arm::Scan::global): Use it.
4167         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4168         (Target_arm::Relocate::relocate): Likewise.
4169         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4170         parameter with an r_type parameter.  Use get_reference_flags
4171         to get the flags.
4172         (Target_arm::Relocate::relocate): Update accordingly.
4173         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4174         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4175         (Target_i386::Scan::global): Likewise.
4176         (Target_i386::Relocate::relocate): Likewise.
4177         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4178         parameter with an r_type parameter.  Use get_reference_flags
4179         to get the flags.
4180         (Target_i386::Relocate::relocate): Update accordingly.
4181         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4182         (Target_powerpc::Scan::global): Use it.
4183         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4184         (Target_powerpc::Relocate::relocate): Likewise.
4185         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4186         (Target_sparc::Scan::global): Use it.
4187         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4188         (Target_sparc::Relocate::relocate): Likewise.
4189         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4190         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4191         (Target_x86_64::Scan::global): Likewise.
4192         (Target_x86_64::Relocate::relocate): Likewise.
4193
4194 2010-11-08  Doug Kwan  <dougkwan@google.com>
4195             Cary Coutant  <ccoutant@google.com>
4196
4197         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4198         (Arm_exidx_merge_section::section_contents_): New data member.
4199         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4200         (Arm_input_section::~Arm_input_section): De-allocate memory.
4201         (Arm_input_section::original_contents_): New data member.
4202         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4203         in parameters instead of calling Object::section_contents without
4204         locking.
4205         (Arm_output_section::group_section): New parameter TASK.  Pass it
4206         to callees that need locking objects.
4207         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4208         to lock EXIDX input sections.  Fix a formatting issue.  Call
4209         Arm_exidx_merged_section::build_contents to create merged section
4210         contents.
4211         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4212         to lock object of stub table owner.
4213         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4214         TEXT_SIZE to initialize data member TEXT_SIZE_.
4215         (Arm_exidx_input_section::addralign): Fix typo in comment.
4216         (Arm_exidx_input_section::text_size): New method.
4217         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4218         that require locking objects.  Lock objects before scanning for stubs
4219         and updating local symbols.
4220         (Arm_input_section<big_endian>::init): Copy contents of original
4221         input section.
4222         (Arm_input_section<big_endian>::do_write): Use saved contents of
4223         original input section instead of calling Object::section_contents
4224         without locking.
4225         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4226         size without calling Object::section_size().
4227         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4228         for size.  Allocate a buffer for merged EXIDX entries.
4229         (Arm_exidx_merged_section::build_contents): New method.
4230         (Arm_exidx_merged_section::do_write): Move merge section contents
4231         building code to Arm_exidx_merged_section::build_contetns.  Write
4232         out contetns in buffer instead of building it on the fly.
4233         (Arm_relobj::make_exidx_input_section): Also pass text section size
4234         to Arm_exidx_input_section constructor.
4235         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4236         (Arm_dynobj::do_read_symbols): Fix memory leak.
4237         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4238         * target.h: (class Task): Add forward declaration.
4239         (Target::relax): Add new parameter TASK and pass it to
4240         Target::do_relax().
4241         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4242
4243 2010-11-05  Cary Coutant  <ccoutant@google.com>
4244
4245         PR gold/10708
4246         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4247         object when reading from the file.
4248         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4249         second layout pass.
4250         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4251         when reading section contents.
4252         (get_section_contents): Likewise.
4253         (icf::find_identical_sections): Likewise.
4254         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4255         object when reading from the file.
4256         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4257         the object when doing deferred section layout.
4258
4259 2010-11-03  Nick Clifton  <nickc@redhat.com>
4260
4261         PR gold/12001
4262         * script.h (class Symbol_assignment: name): New member.  Returns
4263         the name of the symbol.
4264         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4265         Returns true if the given symbol name is on the list of
4266         assignments wating to be processed.
4267         * archive.cc (should_incldue_member): If the symbol is undefined,
4268         check to see if it is on the list of symbols pending assignment.
4269
4270 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4271
4272         * script-sections.cc (Script_sections::find_memory_region): Check
4273         for a NULL output section pointer.
4274
4275 2010-10-29  Doug Kwan  <dougkwan@google.com>
4276
4277         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4278         Output_section::add_relaxed_input_section.
4279         * output.cc (Output_section::add_relaxed_input_section): Add new
4280         arguments LAYOUT and NAME.  Set section order index.
4281         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4282         Copy section order index.
4283         * output.h (Output_section::add_relaxed_input_section): Add new
4284         arguments LAYOUT and NAME.
4285
4286 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4287
4288         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4289         NATIVE_OR_CROSS_LINKER.
4290         * testsuite/Makefile.in: Regenerate.
4291
4292 2010-10-20  Doug Kwan  <dougkwan@google.com>
4293
4294         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4295         without SHF_LINK_ORDER flags.
4296         * layout.cc (Layout::choose_output_section): Do not filter
4297         SHF_LINK_ORDER flag in a relocatable link.
4298
4299 2010-10-17  Cary Coutant  <ccoutant@google.com>
4300
4301         * output.h (Output_segment::set_section_addresses): Change function
4302         signature.  Update all callers.
4303         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4304         sections.
4305         (Output_segment::set_section_addresses): Align after last TLS
4306         section.  Add padding before last relro section instead of after.
4307
4308 2010-10-17  Doug Kwan  <dougkwan@google.com>
4309
4310         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4311         GOT output section to be writable.
4312
4313 2010-10-14  Cary Coutant  <ccoutant@google.com>
4314
4315         * debug.h (DEBUG_INCREMENTAL): New flag.
4316         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4317         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4318         mode.
4319         * incremental.cc (report_command_line): Ignore all forms of
4320         --incremental.
4321         * layout.cc (Layout::Layout): Check parameters for incremental link
4322         mode.
4323         * options.cc (General_options::parse_incremental): New function.
4324         (General_options::parse_no_incremental): New function.
4325         (General_options::parse_incremental_full): New function.
4326         (General_options::parse_incremental_update): New function.
4327         (General_options::incremental_mode_): New data member.
4328         (General_options::finalize): Check incremental_mode_.
4329         * options.h (General_options): Update help text for --incremental.
4330         Add --no-incremental, --incremental-full, --incremental-update.
4331         (General_options::Incremental_mode): New enum type.
4332         (General_options::incremental_mode): New function.
4333         (General_options::incremental_mode_): New data member.
4334         * parameters.cc (Parameters::incremental_mode_): New data member.
4335         (Parameters::set_options): Set incremental_mode_.
4336         (Parameters::set_incremental_full): New function.
4337         (Parameters::incremental): New function.
4338         (Parameters::incremental_update): New function.
4339         (set_parameters_incremental_full): New function.
4340         * parameters.h (Parameters::set_incremental_full): New function.
4341         (Parameters::incremental): New function.
4342         (Parameters::incremental_update): New function.
4343         (Parameters::incremental_mode_): New data member.
4344         (set_parameters_incremental_full): New function.
4345         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4346         incremental link mode.
4347         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4348         (Sized_relobj::do_relocate_sections): Likewise.
4349         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4350         option.
4351         * testsuite/Makefile.in: Regenerate.
4352         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4353
4354 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4355
4356         * script-sections.h (class Script_sections): Make
4357         Sections_elements typedef public.
4358         * script-sections.cc (class Sort_output_sections): Add elements_
4359         field.  Add constructor which sets it; change all callers.
4360         (Sort_output_sections::is_before): New function.
4361         (Sort_output_sections::operator()): Call is_before.
4362         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4363         conditional.
4364         * testsuite/script_test_10.sh: New test. Test script section
4365         order.
4366         * testsuite/script_test_10.t: Likewise.
4367         * testsuite/script_test_10.s: Likewise.
4368         * testsuite/Makefile.am: Wrap the cross linker tests and the
4369         common tests into NATIVE_OR_CROSS_LINKER.
4370         (check_SCRIPTS): Add script_test_10.sh.
4371         (check_DATA): Add script_test_10.stdout.
4372         (script_test_10.o, script_test_10): New targets.
4373         (script_test_10.stdout): New target.
4374         * configure, testsuite/Makefile.in: Regenerate.
4375
4376 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4377
4378         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4379         error for the deprecated relocations.
4380         (Target_arm::Scan::global): Likewise.
4381         (Target_arm::Relocate::relocate): Likewise.
4382
4383 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4384
4385         * fileread.cc (Input_file::find_file): Initialize *found_name
4386         and *namep when using the fallback search for case 4.
4387
4388 2010-10-11  Cary Coutant  <ccoutant@google.com>
4389
4390         * options.h (class General_options): Redefine -z lazy as an alias for
4391         the negation of -z now.
4392
4393 2010-10-11  Ian Lance Taylor  <iant@google.com>
4394
4395         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4396         binding.
4397
4398 2010-10-06  Nick Clifton  <nickc@redhat.com>
4399
4400         * script-sections.cc(class Memory_region): Remove
4401         current_lma_offset_ field.  Rename current_vma_offset_ to
4402         current_offset_.  Add last_section_ field.
4403         (Memory_region::get_current_vma_address): Rename to
4404         get_current_address.
4405         (Memory_region::get_current_lma_address): Delete.
4406         (Memory_region::increment_vma_offset): Rename to
4407         increment_offset.
4408         (Memory_region::increment_lma_offset): Delete.
4409         (Memory_region::attributes_compatible): New method.  Returns
4410         true if the provided section is compatible with the region.
4411         (Memory_region::get_last_section): New method.  Returns the last
4412         section to use the region.
4413         (Memory_region::set_last_section): New method.  Stores the last
4414         section to use the region.
4415         (Script_sections::block_in_region): New method.  Returns true if
4416         a block of memory is contained within a region.
4417         (Script_sections::find_memory_region): New method.  Locates a
4418         memory region to be used to set a VMA or LMA address.
4419         (Output_section_definition::set_section_addresses): Add code to
4420         check for addresses set by memory regions.
4421         (Output_segment::set_section_addresses): Remove memory region
4422         walking code.
4423         (Script_sections::create_segment): Add a warning if a header
4424         segment is created outside of any region.
4425         * script-sections.h (class Script_sections): Add prototypes for
4426         find_memory_region and block_in_region methods.
4427         * testsuite/memory_test.s: Use .long instead of .word.
4428         * testsuite/memory_test.t: Add some more output sections.
4429         * testsuite/memory_test.sh: Update expected output.
4430
4431 2010-10-02  Doug Kwan  <dougkwan@google.com>
4432
4433         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4434         defintion to symtab.h
4435         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4436         declaration to defintion.
4437
4438 2010-10-01  Nick Clifton  <nickc@redhat.com>
4439
4440         * expression.cc (eval): Replace dummy argument with NULL.
4441         (eval_maybe_dot): Check for a NULL result section pointer.
4442         (Symbol_expression::value): Likewise.
4443         (Dot_expression::value): Likewise.
4444         (BINARY_EXPRESSION): Likewise.
4445         (Max_expression::value): Likewise.
4446         (Min_expression::value): Likewise.
4447         (Absolute_expression::value): Likewise.
4448         (Addr_expression::value_from_output_section): Likewise.
4449         (Loaddddr_expression::value_from_output_section): Likewise.
4450         (Segment_start_expression::value): Likewise.
4451         * script-sections.cc
4452         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4453         argument with NULL.
4454         (Sections_elememt_dot_assignment::set_section_addresses):
4455         Likewise.
4456         (Output_data_expression::do_write_to_buffer): Likewise.
4457         (Output_section_definition::finalize_symbols): Likewise.
4458         (Output_section_definition::set_section_addresses): Likewise.
4459
4460 2010-09-30  Doug Kwan  <dougkwan@google.com>
4461
4462         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4463
4464 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4465
4466         * target.h (Target::can_icf_inline_merge_sections): New virtual
4467         function.
4468         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4469         virtual function.
4470         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4471         virtual function.
4472         * icf.cc (get_section_contents): Inline merge sections only when
4473         target allows it.
4474
4475 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4476
4477         * configure: Regenerate.
4478
4479 2010-09-17  Ian Lance Taylor  <iant@google.com>
4480
4481         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
4482         * testsuite/Makefile.am (memory_test.o): New target.
4483         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
4484         memory_test.t.
4485         * testsuite/Makefile.in: Rebuild.
4486
4487 2010-09-17  Doug Kwan  <dougkwan@google.com>
4488
4489         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
4490         defintion if relocation uses GOT entries of the symbol.
4491         * testsuite/icf_safe_test.sh: Fix test.
4492         * testsuite/icf_safe_so_test.sh: Fix test.
4493
4494 2010-09-16  Cary Coutant  <ccoutant@google.com>
4495
4496         * script_sections.cc (class Memory_region): Remove "NULL" from
4497         vector initializations.
4498
4499 2010-09-15  Cary Coutant  <ccoutant@google.com>
4500
4501         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
4502         Resolve forwarding symbols.
4503
4504 2010-09-15  Doug Kwan  <dougkwan@google.com>
4505
4506         * gold/testsuite/script_test_3.t: Add ARM special sections.
4507         * gold/testsuite/script_test_4.t: Same.
4508         * gold/testsuite/script_test_5.t: Same.
4509         * gold/testsuite/script_test_6.t: Same.
4510         * gold/testsuite/script_test_7.t: Same.
4511         * gold/testsuite/script_test_7.t: Same.
4512         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
4513
4514 2010-09-14  Cary Coutant  <ccoutant@google.com>
4515
4516         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
4517         (Target_x86_64::Relocate::relocate_tls): Replace check for
4518         saw_tls_block_reloc_ with test for executable section.
4519
4520 2010-09-12  Cary Coutant  <ccoutant@google.com>
4521
4522         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
4523         position-independent executables to shared libraries need dynamic
4524         relocations.
4525         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
4526         position-independent executables.
4527         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
4528         * testsuite/Makefile.in: Regenerate.
4529
4530 2010-09-10  Nick Clifton  <nickc@redhat.com>
4531
4532         PR gold/11997
4533         * testsuite/memory_test.t: Discard any sections that are not
4534         needed.
4535
4536 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
4537
4538         PR gold/11996
4539         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
4540         "This::" to work around a bug in gcc 4.2.
4541
4542         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
4543
4544 2010-09-09  Rafael Espindola  <espindola@google.com>
4545
4546         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
4547         sections with different PF_X flags in the same segment.
4548         (Layout::find_first_load_seg): Search all segments to find the first
4549         one.
4550         * options.h (rosegment): New.
4551
4552 2010-09-08  Rafael Espindola  <espindola@google.com>
4553
4554         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
4555
4556 2010-09-08  Doug Kwan  <dougkwan@google.com>
4557
4558         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
4559         (Arm_relobj::do_relocate_sections): Add new parameter for output
4560         file to match the parent.
4561         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
4562         of local symbols instead of input values.  Update code to track
4563         changes in gold::relocate_section.
4564         * object.cc (Sized_relobj::compute_final_local_value): New methods.
4565         (Sized_relobj::compute_final_local_value_internal): New methods.
4566         (Sized_relobj::do_finalize_local_symbols): Move code from loop
4567         body into private version of Sized_relobj::compute_final_local_value.
4568         Call the inline method.
4569         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
4570         merged symbol value if there is one.
4571         (Symbol_value::has_output_value): New method defintiion.
4572         (Sized_relobj::Compute_final_local_value_status): New enum type.
4573         (Sized_relobj::compute_final_local_value): New methods.
4574         (Sized_relobj::compute_final_local_value_internal): New methods.
4575         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
4576         and arm_cortex_a8.sh.
4577         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
4578         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
4579         New tests.
4580         * Makefile.in: Regenerate.
4581         * testsuite/arm_bl_out_of_range.s: Update test.
4582         * testsuite/thumb_bl_out_of_range.s: Ditto.
4583         * testsuite/thumb_blx_out_of_range.s: Ditto.
4584         * testsuite/arm_branch_out_of_range.sh: New file.
4585         * testsuite/arm_cortex_a8.sh: Ditto.
4586         * testsuite/arm_cortex_a8_b.s: Ditto.
4587         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
4588         * testsuite/arm_cortex_a8_b_local.s: Ditto.
4589         * testsuite/arm_cortex_a8_bl.s: Ditto.
4590         * testsuite/arm_cortex_a8_blx.s: Ditto.
4591         * testsuite/arm_cortex_a8_local.s: Ditto.
4592         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
4593         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
4594
4595 2010-09-08  Rafael Espindola  <espindola@google.com>
4596
4597         * Makefile.am (memory_test.stdout): Run readelf with -W.
4598         * Makefile.in: Regenerate.
4599         * testsuite/memory_test.sh: Make the regexps accept both 32 and
4600         64 bit output.
4601
4602 2010-09-08  Rafael Espindola  <espindola@google.com>
4603
4604         * script-sections.cc (Script_sections::add_memory_region): Convert
4605         field precision to int.
4606         * script.cc (script_set_section_region, script_set_section_region):
4607         Convert field precision to int.
4608
4609 2010-09-08  Rafael Espindola  <espindola@google.com>
4610
4611         * arm.cc (do_finalize_sections): Create the __exidx_start and
4612         __exdix_end symbols even when the section is missing.
4613
4614 2010-09-08  Nick Clifton  <nickc@redhat.com>
4615
4616         * README: Remove claim that MEMORY is not supported.
4617         * expression.cc (script_exp_function_origin)
4618         (script_exp_function_length): Move from here to ...
4619         * script.cc: ... here.
4620         (script_set_section_region, script_add_memory)
4621         (script_parse_memory_attr, script_include_directive): New
4622         functions.
4623         * script-sections.cc
4624         (class Memory_region): New class.
4625         (class Output_section_definition): Add set_memory_region,
4626         set_section_vma, set_section_lma and get_section_name methods.
4627         (class Script_Sections): Add add_memory_region,
4628         find_memory_region, find_memory_region_origin,
4629         find_memory_region_length and set_memory_region methods.
4630         Have set_section_addresses method walk the list of set memory
4631         regions.
4632         Extend the print methos to display memory regions.
4633         * script-sections.h: Add prototypes for new methods.
4634         Add enum for MEMORY region attributes.
4635         * yyscript.y: Add support for parsing MEMORY regions.
4636         * script-c.h: Add prototypes for new functions.
4637         * testsuite/Makefile.am: Add test of MEMORY region functionality.
4638         * testsuite/Makefile.in: Regenerate.
4639         * testsuite/memory_test.sh: New script.
4640         * testsuite/memory_test.s: New assembler source file.
4641         * testsuite/memory_test.t: New linker script.
4642
4643 2010-08-27  Doug Kwan  <dougkwan@google.com>
4644
4645         * gold/resolve.cc (Symbol_table::should_override): Let a weak
4646         reference override an existing dynamic weak reference.
4647         * testsuite/Makefile.am: Add new test dyn_weak_ref.
4648         * testsuite/Makefile.in: Regenerate.
4649         * testsuite/dyn_weak_ref.sh: New file.
4650         * testsuite/dyn_weak_ref_1.c: Ditto.
4651         * testsuite/dyn_weak_ref_2.c: Ditto.
4652
4653 2010-08-27  Ian Lance Taylor  <iant@google.com>
4654
4655         * incremental.h (class Incremental_input_entry): Add virtual
4656         destructor.
4657
4658 2010-08-27  Ian Lance Taylor  <iant@google.com>
4659
4660         * testsuite/start_lib_test_3.c: Mark t3 as used.
4661
4662 2010-08-27  Nick Clifton  <nickc@redhat.com>
4663
4664         * options.cc (version_script): Fix small typo in previous
4665         whitespace tidyup.
4666
4667 2010-08-25  Nick Clifton  <nickc@redhat.com>
4668
4669         * archive.cc: Formatting fixes: Remove whitespace between
4670         typename and following asterisk.  Remove whitespace between
4671         function name and opening parenthesis.
4672         * archive.h: Likewise.
4673         * arm.cc: Likewise.
4674         * attributes.cc: Likewise.
4675         * attributes.h: Likewise.
4676         * common.cc: Likewise.
4677         * copy-relocs.cc: Likewise.
4678         * dirsearch.h: Likewise.
4679         * dynobj.cc: Likewise.
4680         * ehframe.cc: Likewise.
4681         * ehframe.h: Likewise.
4682         * expression.cc: Likewise.
4683         * fileread.cc: Likewise.
4684         * fileread.h: Likewise.
4685         * gc.h: Likewise.
4686         * gold-threads.cc: Likewise.
4687         * gold.cc: Likewise.
4688         * i386.cc: Likewise.
4689         * icf.h: Likewise.
4690         * incremental-dump.cc: Likewise.
4691         * incremental.cc: Likewise.
4692         * layout.cc: Likewise.
4693         * layout.h: Likewise.
4694         * main.cc: Likewise.
4695         * merge.cc: Likewise.
4696         * merge.h: Likewise.
4697         * object.cc: Likewise.
4698         * object.h: Likewise.
4699         * options.cc: Likewise.
4700         * options.h: Likewise.
4701         * output.cc: Likewise.
4702         * output.h: Likewise.
4703         * plugin.cc: Likewise.
4704         * plugin.h: Likewise.
4705         * powerpc.cc: Likewise.
4706         * reloc.cc: Likewise.
4707         * script-c.h: Likewise.
4708         * script-sections.cc: Likewise.
4709         * script.cc: Likewise.
4710         * stringpool.cc: Likewise.
4711         * symtab.cc: Likewise.
4712         * symtab.h: Likewise.
4713         * target.cc: Likewise.
4714         * timer.cc: Likewise.
4715         * timer.h: Likewise.
4716         * version.cc: Likewise.
4717         * x86_64.cc: Likewise.
4718
4719 2010-08-24  Nick Clifton  <nickc@redhat.com>
4720
4721         PR 11899
4722         * layout.cc (segment_precedes): Sort segments by their physical
4723         addresses, if they have been set.
4724
4725 2010-08-23  Cary Coutant  <ccoutant@google.com>
4726
4727         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
4728         symbols data.
4729         (Lib_group::include_member): Unlock object after deleting its
4730         symbols data.
4731         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
4732         the bug fixed here.
4733
4734 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
4735             Cary Coutant  <ccoutant@google.com>
4736
4737         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
4738         constructor, and set_blocker.
4739         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
4740         readsyms_blocker_.
4741         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
4742         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
4743         * testsuite/Makefile.am (start_lib_test): New test case.
4744         * testsuite/Makefile.in: Regenerate.
4745         * testsuite/start_lib_test_main.c: New file.
4746         * testsuite/start_lib_test_1.c: New file.
4747         * testsuite/start_lib_test_2.c: New file.
4748         * testsuite/start_lib_test_3.c: New file.
4749
4750 2010-08-19  Ian Lance Taylor  <iant@google.com>
4751
4752         * Makefile.in: Rebuild with automake 1.11.1.
4753         * aclocal.m4: Likewise.
4754         * testsuite/Makefile.in: Likewise.
4755
4756 2010-08-19  Ian Lance Taylor  <iant@google.com>
4757
4758         PR 10893
4759         * i386.cc (class Output_data_plt_i386): Update declarations.
4760         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
4761         local_ifuncs_ fields.
4762         (Target_i386::do_plt_section_for_global): New function.
4763         (Target_i386::do_plt_section_for_local): New function.
4764         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
4765         parameter; change all callers.  Initialize global_ifuncs_ and
4766         local_ifuncs_.  If doing a static link define __rel_iplt_start and
4767         __rel_iplt_end.
4768         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
4769         (Output_data_plt_i386::add_local_ifunc_entry): New function.
4770         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
4771         symbols.
4772         (Target_i386::make_plt_section): New function, broken out of
4773         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
4774         (Target_i386::make_plt_entry): Call make_plt_section.
4775         (Target_i386::make_local_ifunc_plt_entry): New function.
4776         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
4777         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
4778         R_386_IRELATIVE to switch.
4779         (Target_i386::Scan::global): Likewise.
4780         (Target_i386::Relocate::relocate): Likewise.
4781         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
4782         switch.
4783         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
4784         (Target_x86_64::do_plt_section_for_global): New function.
4785         (Target_x86_64::do_plt_section_for_local): New function.
4786         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
4787         parameter; change all callers.  If doing a static link define
4788         __rela_iplt_start and __rela_iplt_end.
4789         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
4790         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
4791         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
4792         to point to .plt.
4793         (Target_x86_64::make_local_ifunc_plt_entry): New function.
4794         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
4795         switch.
4796         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
4797         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
4798         R_X86_64_IRELATIVE to switch.
4799         (Target_x86_64::Scan::global): Likewise.
4800         (Target_x86_64::Relocate::relocate): Likewise.
4801         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
4802         switch.
4803         * target.h (class Target): Add plt_section_for_global and
4804         plt_section_for_local functions.  Add do_plt_section_for_global
4805         and do_plt_section_for_local virtual functions.
4806         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
4807         clarifying comments.
4808         (Symbol::use_plt_offset): Handle IFUNC symbol.
4809         * object.cc (Sized_relobj::Sized_relobj): Initialize
4810         local_plt_offsets_.
4811         (Sized_relobj::local_has_plt_offset): New function.
4812         (Sized_relobj::local_plt_offset): New function.
4813         (Sized_relobj::set_local_plt_offset): New function.
4814         (Sized_relobj::do_count): Handle IFUNC symbol.
4815         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
4816         a bit away from input_shndx_ field.  Add set_is_func_symbol and
4817         is_ifunc_symbol functions.
4818         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
4819         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
4820         local_plt_offsets_ field.
4821         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
4822         * output.h (class Output_section_data): Add non-const
4823         output_section function.
4824         (class Output_data_got): Update declarations.
4825         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
4826         Add use_plt_offset parameter to global and local constructors.
4827         Change all callers.  Change local_sym_index_ field to 31 bits.
4828         Change GSYM_CODE and CONSTANT_CODE accordingly.
4829         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
4830         doing a static link don't set sh_link field.
4831         (Output_data_got::Got_entry::write): Use PLT offset if
4832         appropriate.
4833         (Output_data_got::add_global_plt): New function.
4834         (Output_data_got::add_local_plt): New function.
4835         * target-reloc.h (relocate_section): Handle IFUNC symbol.
4836         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
4837         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
4838         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
4839         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
4840         IFUNC conditional.
4841         * testsuite/ifunc-sel.h: New file.
4842         * testsuite/ifuncmain1.c: New file.
4843         * testsuite/ifuncmain1vis.c: New file.
4844         * testsuite/ifuncmod1.c: New file.
4845         * testsuite/ifuncdep2.c: New file.
4846         * testsuite/ifuncmain2.c: New file.
4847         * testsuite/ifuncmain3.c: New file.
4848         * testsuite/ifuncmod3.c: New file.
4849         * testsuite/ifuncmain4.c: New file.
4850         * testsuite/ifuncmain5.c: New file.
4851         * testsuite/ifuncmod5.c: New file.
4852         * testsuite/ifuncmain6pie.c: New file.
4853         * testsuite/ifuncmod6.c: New file.
4854         * testsuite/ifuncmain7.c: New file.
4855         * configure, testsuite/Makefile.in: Rebuild.
4856
4857 2010-08-18  Ian Lance Taylor  <iant@google.com>
4858
4859         * incremental.cc
4860         (Output_section_incremental_inputs::write_input_files): Add cast
4861         to avoid signed/unsigned comparison warning.
4862         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4863
4864 2010-08-12  Cary Coutant  <ccoutant@google.com>
4865
4866         * common.cc (Sort_commons::operator()): Remove unnecessary code.
4867
4868 2010-08-13  Ian Lance Taylor  <iant@google.com>
4869
4870         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
4871
4872 2010-08-12  Cary Coutant  <ccoutant@google.com>
4873             Doug Kwan  <dougkwan@google.com>
4874
4875         * resolve.cc (Symbol_table::should_override): When a weak dynamic
4876         defintion overrides non-weak undef, remember that the original undef
4877         is not weak.
4878         * symtab.cc (Symbol_table::sized_write_global): For undef without
4879         an original weak binding, set binding to global in output.
4880         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
4881         * testsuite/Makefile.in: Regenerate.
4882         * testsuite/strong_ref_weak_def.sh: New file.
4883         * testsuite/strong_ref_weak_def_1.c: Ditto.
4884         * testsuite/strong_ref_weak_def_2.c: Ditto.
4885
4886 2010-08-12  Cary Coutant  <ccoutant@google.com>
4887
4888         * testsuite/incremental_test.sh: Rewrite.
4889         * testsuite/incremental_test_1.c: Rewrite.
4890         * testsuite/incremental_test_2.c: Rewrite.
4891
4892 2010-08-12  Cary Coutant  <ccoutant@google.com>
4893
4894         * arm.cc (Target_arm::got_size): Add const.
4895         (Target_arm::got_entry_count): New function.
4896         (Target_arm::plt_entry_count): New function.
4897         (Target_arm::first_plt_entry_offset): New function.
4898         (Target_arm::plt_entry_size): New function.
4899         (Output_data_plt_arm::entry_count): New function.
4900         (Output_data_plt_arm::first_plt_entry_offset): New function.
4901         (Output_data_plt_arm::get_plt_entry_size): New function.
4902         * i386.cc (Target_i386::got_size): Add const.
4903         (Target_i386::got_entry_count): New function.
4904         (Target_i386::plt_entry_count): New function.
4905         (Target_i386::first_plt_entry_offset): New function.
4906         (Target_i386::plt_entry_size): New function.
4907         (Output_data_plt_i386::entry_count): New function.
4908         (Output_data_plt_i386::first_plt_entry_offset): New function.
4909         (Output_data_plt_i386::get_plt_entry_size): New function.
4910         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
4911         find_incremental_inputs_sections.  Dump incremental_got_plt section.
4912         * incremental.cc: Include target.h.
4913         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
4914         parameter.  Adjust all callers.  Find incremental_got_plt section.
4915         (Incremental_inputs::create_data_sections): Create incremental_got_plt
4916         section.
4917         (Output_section_incremental_inputs::set_final_data_size): Calculate
4918         size of incremental_got_plt section.
4919         (Output_section_incremental_inputs::do_write): Write the
4920         incremental_got_plt section.
4921         (Got_plt_view_info): New struct.
4922         (Local_got_offset_visitor): New class.
4923         (Global_got_offset_visitor): New class.
4924         (Global_symbol_visitor_got_plt): New class.
4925         (Output_section_incremental_inputs::write_got_plt): New function.
4926         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
4927         Add parameter.  Adjust all callers.
4928         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
4929         (Incremental_inputs::got_plt_section): New function.
4930         (Incremental_inputs::got_plt_section_): New data member.
4931         (Incremental_got_plt_reader): New class.
4932         * layout.cc (Layout::create_incremental_info_sections): Add the
4933         incremental_got_plt section.
4934         * object.h (Got_offset_list::get_list): New function.
4935         (Got offset_list::for_all_got_offsets): New function.
4936         (Sized_relobj::local_got_offset_list): New function.
4937         * powerpc.cc (Target_powerpc::got_size): Add const.
4938         (Target_powerpc::got_entry_count): New function.
4939         (Target_powerpc::plt_entry_count): New function.
4940         (Target_powerpc::first_plt_entry_offset): New function.
4941         (Target_powerpc::plt_entry_size): New function.
4942         (Output_data_plt_powerpc::entry_count): New function.
4943         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
4944         (Output_data_plt_powerpc::get_plt_entry_size): New function.
4945         * sparc.cc (Target_sparc::got_size): Add const.
4946         (Target_sparc::got_entry_count): New function.
4947         (Target_sparc::plt_entry_count): New function.
4948         (Target_sparc::first_plt_entry_offset): New function.
4949         (Target_sparc::plt_entry_size): New function.
4950         (Output_data_plt_sparc::entry_count): New function.
4951         (Output_data_plt_sparc::first_plt_entry_offset): New function.
4952         (Output_data_plt_sparc::get_plt_entry_size): New function.
4953         * symtab.h (Symbol::got_offset_list): New function.
4954         (Symbol_table::for_all_symbols): New function.
4955         * target.h (Sized_target::got_entry_count): New function.
4956         (Sized_target::plt_entry_count): New function.
4957         (Sized_target::plt_entry_size): New function.
4958         * x86_64.cc (Target_x86_64::got_size): Add const.
4959         (Target_x86_64::got_entry_count): New function.
4960         (Target_x86_64::plt_entry_count): New function.
4961         (Target_x86_64::first_plt_entry_offset): New function.
4962         (Target_x86_64::plt_entry_size): New function.
4963         (Output_data_plt_x86_64::entry_count): New function.
4964         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
4965         (Output_data_plt_x86_64::get_plt_entry_size): New function.
4966
4967 2010-08-12  Cary Coutant  <ccoutant@google.com>
4968
4969         * archive.cc: Include incremental.h.
4970         (Archive::Archive): Initialize incremental_info_.
4971         (Archive::include_member): Record archive members in incremental info.
4972         (Add_archive_symbols::run): Record begin and end of an archive in
4973         incremental info.
4974         (Lib_group::include_member): Record objects in incremental info.
4975         * archive.h (Incremental_archive_entry): Forward declaration.
4976         (Archive::set_incremental_info): New member function.
4977         (Archive::incremental_info): New member function.
4978         (Archive::Unused_symbol_iterator): New class.
4979         (Archive::unused_symbols_begin): New member function.
4980         (Archive::unused_symbols_end): New member function.
4981         (Archive::incremental_info_): New data member.
4982         * incremental-dump.cc (find_input_containing_global): New function.
4983         (dump_incremental_inputs): Dump new incremental info sections.
4984         * incremental.cc: Include symtab.h.
4985         (Output_section_incremental_inputs): New class.
4986         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
4987         new incremental info sections.
4988         (Sized_incremental_binary::do_check_inputs): Likewise.
4989         (Incremental_inputs::report_archive): Remove.
4990         (Incremental_inputs::report_archive_begin): New function.
4991         (Incremental_inputs::report_archive_end): New function.
4992         (Incremental_inputs::report_object): New function.
4993         (Incremental_inputs::finalize_inputs): Remove.
4994         (Incremental_inputs::report_input_section): New function.
4995         (Incremental_inputs::report_script): Rewrite.
4996         (Incremental_inputs::finalize): Do nothing but finalize string table.
4997         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
4998         (Incremental_inputs::sized_create_inputs_section_data): Remove.
4999         (Incremental_inputs::create_data_sections): New function.
5000         (Incremental_inputs::relocs_entsize): New function.
5001         (Output_section_incremental_inputs::set_final_data_size): New function.
5002         (Output_section_incremental_inputs::do_write): New function.
5003         (Output_section_incremental_inputs::write_header): New function.
5004         (Output_section_incremental_inputs::write_input_files): New function.
5005         (Output_section_incremental_inputs::write_info_blocks): New function.
5006         (Output_section_incremental_inputs::write_symtab): New function.
5007         * incremental.h (Incremental_script_entry): Forward declaration.
5008         (Incremental_object_entry): Forward declaration.
5009         (Incremental_archive_entry): Forward declaration.
5010         (Incremental_inputs): Forward declaration.
5011         (Incremental_inputs_header_data): Remove.
5012         (Incremental_inputs_header): Remove.
5013         (Incremental_inputs_header_write): Remove.
5014         (Incremental_inputs_entry_data): Remove.
5015         (Incremental_inputs_entry): Remove.
5016         (Incremental_inputs_entry_write): Remove.
5017         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5018         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5019         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5020         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5021         Likewise.
5022         (Incremental_input_entry): New class.
5023         (Incremental_script_entry): New class.
5024         (Incremental_object_entry): New class.
5025         (Incremental_archive_entry): New class.
5026         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5027         (Incremental_inputs::report_inputs): Remove.
5028         (Incremental_inputs::report_archive): Remove.
5029         (Incremental_inputs::report_archive_begin): New function.
5030         (Incremental_inputs::report_archive_end): New function.
5031         (Incremental_inputs::report_object): Change prototype.
5032         (Incremental_inputs::report_input_section): New function.
5033         (Incremental_inputs::report_script): Change prototype.
5034         (Incremental_inputs::get_reloc_count): New function.
5035         (Incremental_inputs::set_reloc_count): New function.
5036         (Incremental_inputs::create_data_sections): New function.
5037         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5038         (Incremental_inputs::inputs_section): New function.
5039         (Incremental_inputs::symtab_section): New function.
5040         (Incremental_inputs::relocs_section): New function.
5041         (Incremental_inputs::get_stringpool): Add const.
5042         (Incremental_inputs::command_line): Add const.
5043         (Incremental_inputs::inputs): Remove.
5044         (Incremental_inputs::command_line_key): New function.
5045         (Incremental_inputs::input_file_count): New function.
5046         (Incremental_inputs::input_files): New function.
5047         (Incremental_inputs::relocs_entsize): New function.
5048         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5049         (Incremental_inputs::finalize_inputs): Remove.
5050         (Incremental_inputs::Input_info): Remove.
5051         (Incremental_inputs::lock_): Remove.
5052         (Incremental_inputs::inputs_): Change type.
5053         (Incremental_inputs::inputs_map_): Remove.
5054         (Incremental_inputs::current_object_entry_): New data member.
5055         (Incremental_inputs::inputs_section_): New data member.
5056         (Incremental_inputs::symtab_section_): New data member.
5057         (Incremental_inputs::relocs_section_): New data member.
5058         (Incremental_inputs::reloc_count_): New data member.
5059         (Incremental_inputs_reader): New class.
5060         (Incremental_symtab_reader): New class.
5061         (Incremental_relocs_reader): New class.
5062         * layout.cc (Layout::finalize): Move finalization of incremental info
5063         and creation of incremental info sections to follow finalization of
5064         symbol table.  Set offsets for postprocessing sections.
5065         (Layout::create_incremental_info_sections): Call
5066         Incremental_inputs::create_data_sections.  Add incremental symtab
5067         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5068         sections to layout after input sections.
5069         * layout.h (struct Timespec): Forward declaration.
5070         (Layout::incremental_inputs): Add const.
5071         (Layout::create_incremental_info_sections): Add parameter.
5072         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5073         * object.cc: Include incremental.h.
5074         (Relobj::finalize_incremental_relocs): New function.
5075         (Sized_relobj::do_layout): Record input sections in incremental info.
5076         * object.h (Object::output_section): New function.
5077         (Object::output_section_offset): Moved from Relobj.
5078         (Object::get_incremental_reloc_base): New function.
5079         (Object::get_incremental_reloc_count): New function.
5080         (Object::do_output_section): New function.
5081         (Object::do_output_section_offset): Moved from Relobj.
5082         (Object::do_get_incremental_reloc_base): New function.
5083         (Object::do_get_incremental_reloc_count): New function.
5084         (Object::Object): Initialize new data members.
5085         (Relobj::output_section): Renamed do_output_section and moved to
5086         protected.
5087         (Relobj::output_section_offset): Moved to Object.
5088         (Relobj::do_get_incremental_reloc_base): New function.
5089         (Relobj::do_get_incremental_reloc_count): New function.
5090         (Relobj::allocate_incremental_reloc_counts): New function.
5091         (Relobj::count_incremental_reloc): New function.
5092         (Relobj::finalize_incremental_relocs): New function.
5093         (Relobj::next_incremental_reloc_index): New function.
5094         (Relobj::reloc_counts_): New data member.
5095         (Relobj::reloc_bases_): New data member.
5096         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5097         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5098         (Sized_relobj::incremental_relocs_scan): New function.
5099         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5100         (Sized_relobj::incremental_relocs_write): New function.
5101         (Sized_relobj::incremental_relocs_write_reltype): New function.
5102         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5103         incremental link.
5104         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5105         archives and object files elsewhere.
5106         (Add_symbols::run): Report object files here.
5107         (Finish_group::run): Report end of archive at end of group.
5108         * reloc.cc: Include layout.h, incremental.h.
5109         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5110         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5111         (Sized_relobj::incremental_relocs_scan): New function.
5112         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5113         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5114         (Sized_relobj::incremental_relocs_write): New function.
5115         (Sized_relobj::incremental_relocs_write_reltype): New function.
5116         * script.cc (read_input_script): Rewrite test for incremental link.
5117         Change call to Incremental_inputs::report_script.
5118         * symtab.h (Symbol_table::first_global_index): New function.
5119         (Symbol_table::output_count): New function.
5120
5121 2010-08-12  Doug Kwan  <dougkwan@google.com>
5122
5123         * arm.cc (Target_arm::merge_object_attributes): Check command line
5124         options --no-wchar-size-warning and --no-enum-size-warning.
5125         * options.h (General_options): Add ld-compatible options
5126         --no-enum-size-warning and --no-wchar-size-warning.
5127
5128 2010-08-04  Ian Lance Taylor  <iant@google.com>
5129
5130         * x86_64.cc (Target_x86_64::Scan::local): Use
5131         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5132         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5133         (Target_x86_64::Scan::global): Likewise.
5134         (Target_x86_64::Relocate::relocate): Likewise.
5135         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5136         Likewise.
5137
5138 2010-08-03  Cary Coutant  <ccoutant@google.com>
5139
5140         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5141         to reserve space in merged_strings vector. Keep total input size
5142         for stats.
5143         (Output_merge_string::do_print_merge_stats): Print total input size.
5144         * merge.h (Output_merge_string): Add input_size_ field.
5145         * stringpool.cc (Stringpool_template::string_length): Move
5146         implementations out of Stringpool_template class and place in
5147         stringpool.h.
5148         * stringpool.h (string_length): Move out of Stringpool_template.
5149
5150 2010-08-03  Ian Lance Taylor  <iant@google.com>
5151
5152         PR 11712
5153         * layout.cc (relaxation_loop_body): If address of load segment is
5154         set, adjust address to include headers if possible.
5155
5156 2010-08-03  Ian Lance Taylor  <iant@google.com>
5157
5158         * version.cc (version_string): Bump to 1.10.
5159
5160 2010-08-03  Ian Lance Taylor  <iant@google.com>
5161
5162         PR 11805
5163         * layout.h (enum Output_section_order): Define.
5164         (class Layout): Update declarations.
5165         * layout.cc (Layout::get_output_section): Add order parameter.
5166         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5167         is_first_non_relro parameters.  Change all callers.
5168         (Layout::choose_output_section): Likewise.
5169         (Layout::add_output_section_data): Likewise.
5170         (Layout::make_output_section): Likewise.  Set order.
5171         (Layout::default_section_order): New function.
5172         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5173         * output.cc (Output_section::Output_section): Initialize order_.
5174         Don't initialize deleted fields.
5175         (Output_segment::Output_segment): Don't initialize deleted
5176         fields.
5177         (Output_segment::add_output_section_to_load): New function
5178         replacing add_output_section.  Change all callers to call this or
5179         add_output_section_to_nonload.
5180         (Output_segment::add_output_section_to_nonload): New function.
5181         (Output_segment::remove_output_section): Rewrite.
5182         (Output_segment::add_initial_output_data): Likewise.
5183         (Output_segment::has_any_data_sections): Likewise.
5184         (Output_segment::is_first_section_relro): Likewise.
5185         (Output_segment::maximum_alignment): Likewise.
5186         (Output_segment::has_dynamic_reloc): New function replacing
5187         dynamic_reloc_count.  Change all callers.
5188         (Output_segment::has_dynamic_reloc_list): New function replacing
5189         dynamic_reloc_count_list.  Change all callers.
5190         (Output_segment::set_section_addresses): Rewrite.
5191         (Output_segment::set_offset): Rewrite.
5192         (Output_segment::find_first_and_last_list): Remove.
5193         (Output_segment::set_tls_offsets): Rewrite.
5194         (Output_segment::first_section_load_address): Likewise.
5195         (Output_segment::output_section_count): Likewise.
5196         (Output_segment::section_with_lowest_load_address): Likewise.
5197         (Output_segment::write_section_headers): Likewise.
5198         (Output_segment::print_sections_to_map): Likewise.
5199         * output.h (class Output_data): Remove dynamic_reloc_count_
5200         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5201         (Output_data::add_dynamic_reloc): Rewrite.
5202         (Output_data::has_dynamic_reloc): New function.
5203         (Output_data::dynamic_reloc_count): Remove.
5204         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5205         is_last_relro_, is_first_non_relro_, is_interp_,
5206         is_dynamic_linker_section_ fields.  Add order and set_order
5207         functions.  Remove is_relro_local, set_is_relro_local,
5208         is_last_relro, set_is_last_relro, is_first_non_relro,
5209         set_is_first_non_relro functions, is_interp, set_is_interp,
5210         is_dynamic_linker_section, and set_is_dynamic_linker_section
5211         functions.
5212         (class Output_segment): Change Output_data_list from std::list to
5213         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5214         output_bss_ fields.  Update declarations.
5215
5216 2010-08-02  Ian Lance Taylor  <iant@google.com>
5217
5218         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5219         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5220         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5221
5222 2010-08-02  Ian Lance Taylor  <iant@google.com>
5223
5224         PR 11855
5225         * script.cc (Script_options::Script_options): Initialize
5226         symbol_definitions_ and symbol_references_.
5227         (Script_options::add_symbol_assignment): Update
5228         symbol_definitions_ and symbol_references_.
5229         (Script_options::add_symbol_reference): New function.
5230         (script_symbol): New function.
5231         * script.h (class Script_options): Add symbol_definitions_ and
5232         symbol_references_ fields.
5233         (Script_options::referenced_const_iterator): New type.
5234         (Script_options::referenced_begin): New function.
5235         (Script_options::referenced_end): New function.
5236         (Script_options::is_referenced): New function.
5237         (Script_options::any_unreferenced): New function.
5238         * script-c.h (script_symbol): Declare.
5239         * yyscript.y (exp): Call script_symbol.
5240         * symtab.cc: Include "script.h".
5241         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5242         Change all callers.  Check symbols referenced by scripts.
5243         (Symbol_table::add_undefined_symbols_from_command_line): Add
5244         layout parameter.  Change all callers.
5245         (Symbol_table::do_add_undefined_symbols_from_command_line):
5246         Likewise.  Break out loop body.  Check symbols referenced by
5247         scripts.
5248         (Symbol_table::add_undefined_symbol_from_command_line): New
5249         function broken out of
5250         do_add_undefined_symbols_from_command_line.
5251         * symtab.h (class Symbol_table): Update declarations.
5252         * archive.cc: Include "layout.h".
5253         (Archive::should_include_member): Add layout parameter.  Change
5254         all callers.  Check for symbol mentioned in expression.
5255         * archive.h (class Archive): Update declaration.
5256         * object.cc (Sized_relobj::do_should_include_member): Add layout
5257         parameter.
5258         * object.h (Object::should_include_member): Add layout parameter.
5259         Change all callers.
5260         (Object::do_should_include_member): Add layout parameter.
5261         (class Sized_relobj): Update declaration.
5262         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5263         parameter.
5264         * dynobj.h (class Sized_dynobj): Update declaration.
5265         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5266         layout parameter.
5267         * plugin.h (class Sized_pluginobj): Update declaration.
5268
5269 2010-08-02  Ian Lance Taylor  <iant@google.com>
5270
5271         PR 11866
5272         * output.cc (Output_segment::set_offset): Search for the first and
5273         last sections rather than assuming that the list is in order.
5274         (Output_segment::find_first_and_last_list): New function.
5275         * output.h (class Output_segment): Update declarations.
5276         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5277         (relro_strip_test_SOURCES): New variable.
5278         (relro_strip_test_DEPENDENCIES): New variable.
5279         (relro_strip_test_LDFLAGS): New variable.
5280         (relro_strip_test_LDADD): New variable.
5281         (relro_strip_test.so): New target.
5282
5283 2010-08-02  Ian Lance Taylor  <iant@google.com>
5284
5285         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5286         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5287         (Target_i386::got_tlsdesc_section): New function.
5288         (Target_i386::got_section): Create space for GOT entries for
5289         TLSDESC relocations.
5290         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5291         R_386_TLS_GOTDESC.
5292         (Target_i386::Scan::global): Likewise.
5293         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5294         using TLSDESC GOT.
5295         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5296         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5297         (Target_x86_64::got_tlsdesc_section): New function.
5298         (Target_x86_64::got_section): Create space for GOT entries for
5299         TLSDESC relocations.
5300         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5301         R_386_TLS_GOTDESC.
5302         (Target_x86_64::Scan::global): Likewise.
5303         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5304         using TLSDESC GOT.
5305
5306 2010-08-02  Ian Lance Taylor  <iant@google.com>
5307
5308         * testsuite/final_layout.sh: Use dc to convert from hex to
5309         decimal.
5310
5311 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5312
5313         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5314         paramter to the call to gold::gc_process_relocs.
5315         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5316         paramter to the call to gold::gc_process_relocs.
5317         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5318         parameter to the call to gold::gc_process_relocs.
5319         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5320         template parameter to the call to gold::gc_process_relocs.
5321         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5322         paramter to the call to gold::gc_process_relocs.
5323         * gc.h (get_embedded_addend_size): New function.
5324         (gc_process_relocs): Save the size of the reloc for use by ICF.
5325         * icf.cc (get_section_contents): Get the addend from the text section
5326         for SHT_REL relocation sections.
5327         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5328         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5329         * int_encoding.h (read_from_pointer): New overloaded function.
5330         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5331         * testsuite/icf_sht_rel_addend_test.sh: New file.
5332         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5333         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5334
5335 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5336
5337         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5338         * Makefile.in: Regenerate.
5339         * testsuite/Makefile.in: Regenerate.
5340
5341 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5342
5343         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5344         * gold/testsuite/debug_msg.cc: Likewise.
5345         * gold/testsuite/odr_violation1.cc
5346         * gold/testsuite/odr_violation2.cc
5347
5348 2010-07-21  Cary Coutant  <ccoutant@google.com>
5349
5350         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5351         string, and length fields.
5352         (Output_merge_string::Merged_strings_list): New type.
5353         (Output_merge_string::Merged_strings_lists): New typedef.
5354         (Output_merge_string): Replace merged_strings_ with
5355         merged_strings_lists_.
5356         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5357         Merged_strings_list per input object and section.  Don't store pointer
5358         to the string.  Don't store length with each merged string entry.
5359         (Output_merge_string::finalize_merged_data): Loop over list of merged
5360         strings lists.  Recompute length of each merged string.
5361
5362 2010-07-15  Cary Coutant  <ccoutant@google.com>
5363
5364         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5365         here.
5366
5367 2010-07-14  Ian Lance Taylor  <iant@google.com>
5368
5369         * descriptors.cc (Descriptors::open): Report correct name in error
5370         message.
5371
5372 2010-07-13  Doug Kwan  <dougkwan@google.com>
5373
5374         * arm.cc (Arm_input_section::Arm_input_section): For a
5375         SHT_ARM_EXIDX section, always keeps the input sections.
5376         (Arm_input_section::set_exidx_section_link): New method.
5377         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5378         has_errors_ to false.
5379         (Arm_exidx_input_section::has_errors,
5380         Arm_exidx_input_section::set_has_errors): New methods.
5381         (Arm_exidx_input_section::has_errors_): New data member.
5382         (Arm_relobj::get_exidx_shndx_list): New method.
5383         (Arm_output_section::append_text_sections_to_list): Do not skip
5384         section without SHF_EXECINSTR.
5385         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5386         errors.
5387         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5388         section header.  Make error messages more verbose.  Check for
5389         a non-executable section linked to an EXIDX section.
5390         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5391         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5392         check that there is no deferred EXIDX section if we exit early.
5393         Instead of not making an EXIDX section in case of an error, make one
5394         and set the has_errors flag of it.
5395         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5396         in a relocatable link.
5397         (Target_arm::do_relax): Look for the EXIDX output section instead of
5398         assuming that it is called .ARM.exidx.
5399         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5400         section list.  Do not check for SHF_EXECINSTR section flags but
5401         skip any input section with errors.
5402         * output.cc (Output_section::Output_section): Initialize
5403         always_keeps_input_sections_ to false.
5404         (Output_section::add_input_section): Check for
5405         always_keeps_input_sections_.
5406         *  output.h (Output_section::always_keeps_input_sections,
5407         Output_section::set_always_keeps_input_sections): New methods.
5408         (Output_section::always_keeps_input_sections): New data member.
5409
5410 2010-07-13  Rafael Espindola  <espindola@google.com>
5411
5412         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5413         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5414
5415 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5416             Ian Lance Taylor  <iant@google.com>
5417
5418         * output.h (Output_section_lookup_maps::add_merge_section):
5419         Correct check of whether value was inserted.
5420         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5421         (Output_section_lookup_maps::add_relaxed_input_section):
5422         Likewise.
5423         * arm.cc (Target_arm::got_section): Remove used local os.
5424         * i386.cc (Target_i386::got_section): Likewise.
5425         * x86_64.cc (Target_x86_64::got_section): Likewise.
5426         * sparc.cc (Target_sparc::got_section): Likewise.
5427         (Target_sparc::relocate): Remove unused local have_got_offset.
5428         * powerpc.cc (Target_powerpc::relocate): Likewise.
5429
5430 2010-07-13  Ian Lance Taylor  <iant@google.com>
5431
5432         * compressed_output.cc (zlib_decompress): Fix signature in
5433         !HAVE_ZLIB_H case.
5434
5435         * archive.cc (Archive::include_member): Unlock an external member
5436         of a thin archive.  Don't bother to delete an object we know is
5437         NULL.
5438
5439 2010-07-12  Cary Coutant  <ccoutant@google.com>
5440
5441         * compressed_output.cc (zlib_decompress): New function.
5442         (get_uncompressed_size): New function.
5443         (decompress_input_section): New function.
5444         * compressed_output.h (get_uncompressed_size): New function.
5445         (decompress_input_section): New function.
5446         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5447         Handle compressed debug sections.
5448         * layout.cc (is_compressed_debug_section): New function.
5449         (Layout::output_section_name): Map compressed section names to
5450         canonical names.
5451         * layout.h (is_compressed_debug_section): New function.
5452         (is_debug_info_section): Recognize compressed debug sections.
5453         * merge.cc: Include compressed_output.h.
5454         (Output_merge_data::do_add_input_section): Handle compressed
5455         debug sections.
5456         (Output_merge_string::do_add_input_section): Handle compressed
5457         debug sections.
5458         * object.cc: Include compressed_output.h.
5459         (Sized_relobj::Sized_relobj): Initialize new data members.
5460         (build_compressed_section_map): New function.
5461         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5462         * object.h (Object::section_is_compressed): New method.
5463         (Object::do_section_is_compressed): New method.
5464         (Sized_relobj::Compressed_section_map): New type.
5465         (Sized_relobj::do_section_is_compressed): New method.
5466         (Sized_relobj::compressed_sections_): New data member.
5467         * output.cc (Output_section::add_input_section): Handle compressed
5468         debug sections.
5469         * reloc.cc: Include compressed_output.h.
5470         (Sized_relobj::write_sections): Handle compressed debug sections.
5471
5472 2010-07-08  Cary Coutant  <ccoutant@google.com>
5473
5474         * resolve.cc (Symbol_table::resolve): Remember whether undef was
5475         weak when resolving to a dynamic def.
5476         (Symbol_table::should_override): Add adjust_dyndef flag; set it
5477         for weak undef/dynamic def cases. Adjust callers.
5478         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
5479         undef_binding_weak_.
5480         (Symbol_table::sized_write_globals): Adjust symbol binding.
5481         (Symbol_table::sized_write_symbol): Add binding parameter.
5482         * symtab.h (Symbol::set_undef_binding): New method.
5483         (Symbol::is_undef_binding_weak): New method.
5484         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
5485         (Symbol_table::should_override): Add new parameter.
5486         (Symbol_table::sized_write_symbol): Add new parameter.
5487
5488         * testsuite/weak_undef_file1.cc: Add new test case.
5489         * testsuite/weak_undef_file2.cc: Fix header comment.
5490         * testsuite/weak_undef_test.cc: Add new test case.
5491
5492 2010-06-29  Doug Kwan  <dougkwan@google.com>
5493
5494         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
5495         Initialize USE_SYMBOL_.
5496         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
5497         definition.
5498         (Arm_reloc_property::uses_symbol_): New data member declaration.
5499         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
5500         uses symbol value and symbol is undefined but not weakly undefined.
5501
5502 2010-06-28  Rafael Espindola  <espindola@google.com>
5503
5504         * plugin.cc (Plugin::load): Use dlerror.
5505
5506 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
5507
5508         * symtab.cc (detect_odr_violations): When reporting an ODR
5509         violation, report an object where the symbol is defined.
5510
5511 2010-06-25  Doug Kwan  <dougkwan@google.com>
5512
5513         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
5514         (Target_arm::section_may_have_icf_unsafe_pointers): New method
5515         definition.
5516         (Target_arm::Scan::local_reloc_may_be_function_pointer,
5517         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
5518         target hook to detect function points.
5519         (Target_arm::Scan::possible_function_pointer_reloc): New method.
5520         * icf.h (Icf::check_section_for_function_pointers): Change type of
5521         parameter SECTION_NAME to const reference to std::string.  Use
5522         target hook to determine if section may have unsafe pointers.
5523         * target.h (Target::section_may_have_icf_unsafe_pointers): New
5524         method definition.
5525
5526 2010-06-21  Rafael Espindola  <espindola@google.com>
5527
5528         * fileread.cc (Input_file::find_fie): New
5529         (Input_file::open): Use Input_file::find_fie.
5530         * fileread.h (Input_file::find_fie): New
5531         * plugin.cc (set_extra_library_path): New.
5532         (Plugin::load): Add set_extra_library_path to the transfer vector.
5533         (Plugin_manager::set_extra_library_path): New.
5534         (Plugin_manager::add_input_file): Use the extra search path if set.
5535         (set_extra_library_path(): New.
5536         * plugin.h (Plugin_manager): Add set_extra_library_path and
5537         extra_search_path_.
5538
5539 2010-06-19  Cary Coutant  <ccoutant@google.com>
5540
5541         * layout.cc (gdb_sections): Add .debug_types.
5542         (lines_only_debug_sections): Likewise.
5543
5544 2010-06-18  Rafael Espindola  <espindola@google.com>
5545
5546         * plugin.cc (add_input_file,add_input_library)
5547         (Plugin_manager::add_input_file): Make filename arguments const.
5548         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
5549         const.
5550
5551 2010-06-16  Doug Kwan  <dougkwan@google.com>
5552
5553         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
5554         .ARM.attributes section if we have not merged any input
5555         attributes sections.
5556
5557 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5558
5559         * arm.cc: Allow combining objects with no EABI version
5560         information.
5561
5562 2010-06-15  Rafael Espindola  <espindola@google.com>
5563
5564         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
5565
5566 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5567
5568         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
5569         (struct iovec): Correct !HAVE_READV definition.
5570
5571 2010-06-10  Cary Coutant  <ccoutant@google.com>
5572
5573         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
5574         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
5575         reloc sections.
5576         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
5577
5578         PR 11683
5579         * symtab.h (Symbol::is_placeholder): New member function.
5580         * target-reloc.h (relocate_section): Check for placeholder symbols.
5581
5582         * testsuite/Makefile.am (plugin_test_8): New test.
5583         (plugin_test_9): New test.
5584         * testsuite/Makefile.in: Regenerate.
5585
5586 2010-06-09  Nick Clifton  <nickc@redhat.com>
5587
5588         * yyscript.y (input_list_element): Allow strings prefixed with
5589         the '-' character.  Treat these as libraries.
5590         * script.cc (script_add_library): New function.  Adds a library
5591         specified by "-l<name>" found in an input script.
5592         * script-c.h: Add prototype for script_add_library.
5593
5594 2010-06-07  Doug Kwan  <dougkwan@google.com>
5595
5596         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
5597         Restrict stub-group size to be within long conditional branch
5598         range when working around cortex-A8 erratum.
5599
5600 2010-06-07  Damien Diederen  <dd@crosstwine.com>
5601
5602         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
5603         #ifdef typo.
5604
5605 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
5606
5607         PR gold/11658
5608         * output.cc
5609         (Output_section::Input_section_sort_entry::compare_section_ordering):
5610         Change to return non-zero correctly.
5611         (Output_section::Input_section_sort_section_order_index_compare
5612         ::operator()): Change to fix ambiguity in comparisons.
5613
5614 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
5615
5616         * gold.h (is_wildcard_string): New function.
5617         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
5618         (Layout::layout_eh_frame): Ditto.
5619         (Layout::find_section_order_index): New method.
5620         (Layout::read_layout_from_file): New method.
5621         * layout.h (Layout::find_section_order_index): New method.
5622         (Layout::read_layout_from_file): New method.
5623         (Layout::input_section_position_): New private member.
5624         (Layout::input_section_glob_): New private member.
5625         * main.cc (main): Call read_layout_from_file here.
5626         * options.h (--section-ordering-file): New option.
5627         * output.cc (Output_section::input_section_order_specified_): New
5628         member.
5629         (Output_section::Output_section): Initialize new member.
5630         (Output_section::add_input_section): Add new parameter.
5631         Keep input sections when --section-ordering-file is used.
5632         (Output_section::set_final_data_size): Sort input sections when
5633         section ordering file is specified.
5634         (Output_section::Input_section_sort_entry): Add new parameter.
5635         Check sorting type.
5636         (Output_section::Input_section_sort_entry::compare_section_ordering):
5637         New method.
5638         (Output_section::Input_section_sort_compare::operator()): Change to
5639         consider section_order_index.
5640         (Output_section::Input_section_sort_init_fini_compare::operator()):
5641         Change to consider section_order_index.
5642         (Output_section::Input_section_sort_section_order_index_compare
5643         ::operator()): New method.
5644         (Output_section::sort_attached_input_sections): Change to sort
5645         according to section order when specified.
5646         (Output_section::add_input_section<32, true>): Add new parameter.
5647         (Output_section::add_input_section<64, true>): Add new parameter.
5648         (Output_section::add_input_section<32, false>): Add new parameter.
5649         (Output_section::add_input_section<64, false>): Add new parameter.
5650         * output.h (Output_section::add_input_section): Add new parameter.
5651         (Output_section::input_section_order_specified): New
5652         method.
5653         (Output_section::set_input_section_order_specified): New method.
5654         (Input_section::Input_section): Initialize section_order_index_.
5655         (Input_section::section_order_index): New method.
5656         (Input_section::set_section_order_index): New method.
5657         (Input_section::section_order_index_): New member.
5658         (Input_section::Input_section_sort_section_order_index_compare): New
5659         struct.
5660         (Output_section::input_section_order_specified_): New member.
5661         * script-sections.cc (is_wildcard_string): Delete and move modified
5662         method to gold.h.
5663         (Output_section_element_input::Output_section_element_input): Modify
5664         call to is_wildcard_string.
5665         (Output_section_element_input::Input_section_pattern
5666         ::Input_section_pattern): Ditto.
5667         (Output_section_element_input::Output_section_element_input): Ditto.
5668         * testsuite/Makefile.am (final_layout): New test case.
5669         * testsuite/Makefile.in: Regenerate.
5670         * testsuite/final_layout.cc: New file.
5671         * testsuite/final_layout.sh: New file.
5672
5673 2010-06-01  Rafael Espindola  <espindola@google.com>
5674
5675         * plugin.cc (Plugin::load): Pass the output name to the plugin.
5676
5677 2010-06-01  Rafael Espindola  <espindola@google.com>
5678
5679         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
5680         visibility of symbols.
5681
5682 2010-05-27  Doug Kwan  <dougkwan@google.com>
5683
5684         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
5685         from start of output section instead of address for a local symbol
5686         in a merged or relaxed section when doing a relocatable link.
5687
5688 2010-05-26  Rafael Espindola  <espindola@google.com>
5689
5690         PR 11604
5691         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
5692         adding sections the garbage collector removed.
5693         * gold/testsuite/Makefile.am: Add test.
5694         * gold/testsuite/Makefile.in: Regenerate.
5695         * gold/testsuite/plugin_test_7.sh: New.
5696         * gold/testsuite/plugin_test_7_1.c: New.
5697         * gold/testsuite/plugin_test_7_2.c: New.
5698
5699 2010-05-26  Rafael Espindola  <espindola@google.com>
5700
5701         * script-sections.cc (Output_section_definition::set_section_addresses):
5702         Check for --section-start.
5703
5704 2010-05-26  Doug Kwan  <dougkwan@google.com>
5705
5706         * arm.cc (Arm_scan_relocatable_relocs): New class.
5707         (Target_arm::relocate_special_relocatable): New method.
5708         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
5709         (Arm_relocate_functions::thumb_branch_common): Same.
5710         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
5711         instead of Default_scan_relocatable_relocs.
5712         * target-reloc.h (relocate_for_relocatable): Let target handle
5713         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
5714         * target.h (Sized_target::relocate_special_relocatable): New method.
5715
5716 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5717
5718         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
5719
5720 2010-05-23  Doug Kwan  <dougkwan@google.com>
5721
5722         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
5723         instead of a cast.
5724         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
5725         with a direct branch, not a conditional branch, to a stub.
5726         * merge.cc (Output_merge_base::record_input_section): New method
5727         defintion.
5728         (Output_merge_data::do_add_input_section): Record input section if
5729         keeps-input-sections flag is set.
5730         (Output_merge_string::do_add_input_section): Ditto.
5731         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
5732         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
5733         INPUT_SECTIONS_.
5734         (Output_merge_base::keeps_input_sections,
5735         Output_merge_base::set_keeps_input_sections,
5736         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
5737         method definitions.
5738         (Output_merge_base::Input_sections): New type declaration.
5739         (Output_merge_base::input_sections_begin,
5740         Output_merge_base::input_sections_end,
5741         Output_merge_base::do_set_keeps_input_sections): New method definitions.
5742         (Output_merge_base::bool keeps_input_sections_,
5743         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
5744         Output_merge_base::input_sections_): New data members.
5745         (Output_merge_data::do_set_keeps_input_sections): New method
5746         defintion.
5747         (Output_merge_string::do_set_keeps_input_sections): Ditto.
5748         * output.cc (Output_section::Input_section::relobj): Move method
5749         defintion from class declaration to here and handle merge sections.
5750         (Output_section::Input_section::shndx): Ditto.
5751         (Output_section::Output_section): Remove initializations of removed
5752         data members and initialize new data member LOOKUP_MAPS_.
5753         (Output_section::add_input_section): Set keeps-input-sections flag
5754         for a newly created merge output section as appropriate.  Adjust code
5755         to use Output_section_lookup_maps class.
5756         (Output_section::add_relaxed_input_section): Adjst code for lookup
5757         maps code refactoring.
5758         (Output_section::add_merge_input_section): Add a new parameter
5759         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
5760         class.  If adding input section to a newly created merge output
5761         section fails, remove the new merge section.
5762         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
5763         Adjust code for use of the Output_section_lookup_maps class.
5764         (Output_section::find_merge_section): Ditto.
5765         (Output_section::build_lookup_maps): New method defintion.
5766         (Output_section::find_relaxed_input_section): Adjust code to use
5767         Output_section_lookup_maps class.
5768         (Output_section::get_input_sections): Export merge sections.  Adjust
5769         code to use Output_section_lookup_maps class.
5770         (Output_section:::add_script_input_section): Adjust code to use
5771         Output_section_lookup_maps class.  Update lookup maps for merge
5772         sections also.
5773         (Output_section::discard_states): Use Output_section_lookup_maps.
5774         (Output_section::restore_states): Same.
5775         * output.h (Merge_section_properties): Move class defintion out of
5776         Output_section.
5777         (Output_section_lookup_maps): New class.
5778         (Output_section::Input_section::is_merge_section): New method
5779         defintion.
5780         (Output_section::Input_section::relobj): Move defintion out of class
5781         defintion.  Declare method only.
5782         (Output_section::Input_section::shndx): Ditto.
5783         (Output_section::Input_section::output_merge_base): New method defintion.
5784         (Output_section::Input_section::u2_.pomb): New union field.
5785         (Output_section::Merge_section_by_properties_map,
5786         Output_section::Output_section_data_by_input_section_map,
5787         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
5788         Remove types.
5789         (Output_section::add_merge_input_section): Add new parameter
5790         KEEPS_INPUT_SECTIONS.
5791         (Output_section::build_lookup_maps): New method declaration.
5792         (Output_section::merge_section_map_,
5793         Output_section::merge_section_by_properties_map_,
5794         Output_section::relaxed_input_section_map_,
5795         Output_section::is_relaxed_input_section_map_valid_): Remove data
5796         members.
5797         (Output_section::lookup_maps_): New data member.
5798
5799 2010-05-21  Doug Kwan  <dougkwan@google.com>
5800
5801         PR gold/11619
5802         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
5803         avoid a compilation error.
5804
5805 2010-05-19  Rafael Espindola  <espindola@google.com>
5806
5807         * script-sections.cc (Output_section_definition::allocate_to_segment):
5808         Update the phdrs_list even when the output section is NULL.
5809         * testsuite/Makefile.am: Add test.
5810         * testsuite/Makefile.in: Regenerate.
5811         * testsuite/script_test_9.cc: New.
5812         * testsuite/script_test_9.sh: New.
5813         * testsuite/script_test_9.t: New.
5814
5815 2010-05-19  Doug Kwan  <dougkwan@google.com>
5816
5817         * arm.cc (Arm_input_section::original_size): New method.
5818         (Arm_input_section::do_addralign): Add a cast.
5819         (Arm_input_section::do_output_offset): Remove static cast.
5820         (Arm_input_section::original_addralign,
5821          Arm_input_section::original_size_): Change type to uint32_t.
5822         (Arm_input_section::init): Add safe casts for section alignment
5823         and size.
5824         (Arm_input_section::set_final_data_size): Do not set address and
5825         offset of stub table.
5826         (Arm_output_section::fix_exidx_coverage): Change use of of
5827         Output_section::Simple_input_section to that of
5828         Output_section::Input_section.
5829         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
5830         except for the first pass.
5831         * output.cc (Output_section::get_input_sections): Change type of
5832         input_sections to std::list<Input_section>.
5833         (Output_section::add_script_input_section): Rename from
5834         Output_section::add_simple_input_section.  Change type of SIS
5835         parameter from Simple_input_section to Input_section.
5836         * output.h (Output_section::Simple_input_section): Remove class.
5837         (Output_section::Input_section): Change class visibility to public.
5838         (Output_section::Input_section::addralign): Use stored alignments
5839         for special input sections if set.
5840         (Output_section::Input_section::set_addralign): New method.
5841         (Output_section::get_input_sections): Change parameter type from
5842         list of Simple_input_section to list of Input_section.
5843         (Output_section::add_script_input_section): Rename from
5844         Output_section::add_simple_input_section. Change first parameter's
5845         type from Simple_input_section to Input_section and remove the
5846         second and third parameters.
5847         * script-sections.cc (Input_section::Input_section_list): Change
5848         type to list of Output_section::Input_section/
5849         (Input_section_info::Input_section_info): Change parameter type of
5850         INPUT_SECTION to Output_section::Input_section.
5851         (Input_section_info::input_section): Change return type.
5852         (Input_section_info::input_section_): Change type to
5853         Output_section::Input_section.
5854         (Output_section_element_input::set_section_addresses): Adjust code
5855         to use Output_section::Input_section instead of
5856         Output_section::Simple_input_section.  Adjust code for renaming
5857         of Output_section::add_simple_input_section.
5858         (Orphan_output_section::set_section_addresses): Ditto.
5859
5860 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5861
5862         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
5863         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
5864
5865 2010-05-18  Rafael Espindola  <espindola@google.com>
5866
5867         * options.cc (General_options::finalize): Handle -nostdlib.
5868         * options.h (nostdlib): New option.
5869         * script.cc (script_add_search_dir): Handle -nostdlib.
5870
5871 2010-05-12  Doug Kwan  <dougkwan@google.com>
5872
5873         * arm.cc (Target_arm::do_finalize_sections): Create an empty
5874         attributes section only if there no attributes section after merging.
5875         (Target_arm::merge_object_attributes): Move value of
5876         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
5877         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
5878         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
5879         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
5880         and arm_attr_merge_7.stdout.
5881         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
5882         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
5883         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
5884         arm_attr_merge_7b.o): New rules.
5885         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
5886         arm_attr_merge_7
5887         * testsuite/Makefile.in: Regenerate.
5888         * testsuite/arm_attr_merge.sh: New file.
5889         * testsuite/arm_attr_merge_[67][ab].s: Same.
5890
5891 2010-05-05  Nick Clifton  <nickc@redhat.com>
5892
5893         * po/es.po: Updated Spanish translation.
5894
5895 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5896
5897         * Makefile.am (install-exec-local): Properly install gold as
5898         default cross linker.
5899         * Makefile.in: Regenerated.
5900
5901 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
5902             Nick Clifton  <nickc@redhat.com>
5903
5904         * configure.ac (install_as_default): Define and set to false
5905         unless --enable-gold or --enable-gold=both/gold has been
5906         specified.
5907         * configure: Regenerate.
5908
5909         * Makefile.am (install-exec-local): Install the executable as
5910         'ld.gold'.  If install_as_default is true then also install it as
5911         'ld'.
5912         * Makefile.in: Regenerated.
5913
5914 2010-04-24  Ian Lance Taylor  <iant@google.com>
5915
5916         * layout.cc (Layout::layout_reloc): In relocatable link don't
5917         combine reloc sections for grouped sections.
5918
5919 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
5920
5921         * gc.h (gc_process_relocs): Pass information on relocs pointing to
5922         sections that are not ordinary to icf.
5923         * icf.cc (get_section_contents): Handle relocation pointing to section
5924         with no object or shndx information.
5925         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
5926         * testsuite/Makefile.in: Regenerate.
5927         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
5928         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
5929
5930 2010-04-22  Ian Lance Taylor  <iant@google.com>
5931
5932         * expression.cc (Expression::Expression_eval_info): Add
5933         result_alignment_pointer field.
5934         (Expression::eval_with_dot): Add result_alignment_pointer
5935         parameter.  Change all callers.
5936         (Expression::eval_maybe_dot): Likewise.
5937         (class Binary_expression): Add alignment_pointer parameter to
5938         left_value and right_value.  Change all callers.
5939         (BINARY_EXPRESSION): Set result alignment.
5940         (class Trinary_expression): Add alignment_pointer parameter to
5941         arg2_value and arg3_value.  Change all callers.
5942         (Trinary_cond::value): Set result alignment.
5943         (Max_expression::value, Min_expression::value): Likewise.
5944         (Align_expression::value): Likewise.
5945         * script-sections.cc (class Sections_element): Add dot_alignment
5946         parameter to set_section_addresses virtual function.  Update
5947         instantiations.
5948         (class Output_section_element): Likewise.
5949         (Script_sections::create_segments): Add dot_alignment parameter.
5950         Change all callers.
5951         (Script_sections::create_segments_from_phdrs_clause): Likewise.
5952         (Script_sections::set_phdrs_clause_addresses): Likewise.
5953         * script-sections.h: Update declarations.
5954         * script.h: Update declarations.
5955         * output.h (Output_segment::set_minimum_p_align): Don't decrease
5956         min_p_align.
5957         * testsuite/script_test_3.t: Set large alignment.
5958         * testsuite/script_test_3.sh: Make sure that at least one LOAD
5959         segment has expected alignment.
5960
5961 2010-04-22  Nick Clifton  <nickc@redhat.com>
5962
5963         * po/gold.pot: Updated by the Translation project.
5964         * po/vi.po: Updated Vietnamese translation.
5965
5966 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
5967
5968         * testsuite/Makefile.am (check_PROGRAMS): Add
5969         icf_virtual_function_folding_test.
5970         * testsuite/Makefile.in: Regenerated.
5971
5972 2010-04-15  Andrew Haley  <aph@redhat.com>
5973
5974         * options.h (merge_exidx_entries): New option.
5975         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
5976         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
5977         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
5978         (Target_arm::merge_exidx_entries): New function.
5979         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
5980         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
5981         to Arm_exidx_fixup constructor.
5982         Add new arg, merge_exidx_entries.
5983         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
5984         Arm_output_section::fix_exidx_coverage.
5985
5986 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
5987
5988         * icf.cc (get_section_contents): Check for preemptible functions.
5989         Ignore addend when appropriate.
5990         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
5991         section folded.
5992         (add_from_relobj): Check for section folded.
5993         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
5994         * symtab.h (should_add_dynsym_entry): Add new parameter.
5995         * target-reloc.h (scan_relocs): Check for section folded.
5996         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
5997         Check reloc types for function pointers in shared objects.
5998         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
5999         case.
6000         (icf_preemptible_functions_test): New test case.
6001         (icf_string_merge_test): New test case.
6002         * testsuite.Makefile.in: Regenerate.
6003         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6004         bar_glob.  Refactor code.
6005         * testsuite/icf_preemptible_functions_test.cc: New file.
6006         * testsuite/icf_preemptible_functions_test.sh: New file.
6007         * testsuite/icf_string_merge_test.cc: New file.
6008         * testsuite/icf_string_merge_test.sh: New file.
6009         * testsuite/icf_virtual_function_folding_test.cc: New file.
6010         * testsuite/icf_virtual_function_folding_test.sh: New file.
6011
6012 2010-04-14  Doug Kwan  <dougkwan@google.com>
6013
6014         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6015         for local symbol recounting if we remove a section due to ICF.
6016         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6017         there are no regular objects in input.
6018
6019 2010-04-13  Doug Kwan  <dougkwan@google.com>
6020
6021         * arm.cc (Arm_input_section::set_final_data_size): Compute
6022         accurate final data size instead of using current data size.
6023
6024 2010-04-09  Doug Kwan  <dougkwan@google.com>
6025
6026         * layout.cc (Layout::choose_output_section): Handle script section
6027         types.
6028         (Layout::make_output_section_for_script): Add section type parameter.
6029         Handle script section types.
6030         * layout.h (Layout::make_output_section_for_script): Add section
6031         type parameter.
6032         * output.cc (Output_section::Output_section): Initialize data member
6033         is_noload_.
6034         (Output_section::do_reset_address_and_file_offset): Do not set address
6035         to 0 if section is a NOLOAD section.
6036         * output.h (Output_section::is_noload): New method.
6037         (Output_section::set_is_noload): Ditto.
6038         (Output_section::is_noload_): New data member.
6039         * script-c.h (Script_section_type): New enum type.
6040         (struct Parser_output_section_header): Add new file section_type.
6041         * script-sections.cc (Sections_element::output_section_name): Add
6042         parameter for returning script section type.
6043         (Output_section_definition::output_section_name): Ditto.
6044         (Output_section_definition::section_type)P; New method.
6045         (Output_section_definiton::script_section_type_name): Ditto.
6046         (Output_section_definition::script_section_type_): New data member.
6047         (Output_section_definition::Output_section_definition): Initialize
6048         data member Output_section_definition::script_section_type_.
6049         (Output_section_definition::create_sections): Pass script section type
6050         to Layout::make_output_section_for_script.
6051         (Output_section_definition::output_section_name): Return script
6052         section type to caller.
6053         (Output_section_definition::set_section_address): Do not advance
6054         dot value and load address if section type is NOLOAD.  Set address
6055         of NOLOAD sections regardless of section flags.
6056         (Output_section_definition::print): Print section type if it is
6057         not SCRIPT_SECTION_TYPE_NONE.
6058         (Output_section_definition::section_type): New method.
6059         (Output_section_definition::script_section_type_name): Ditto.
6060         (Script_sections::output_section_name): Add new parameter
6061         PSECTION_TYPE for returning script section type.  Pass it to
6062         section elements.  Handle discard sections.
6063         (Sort_output_sections::operator()): Handle NOLOAD sections.
6064         * script-sections.h (Script_sections::Section_type): New enum type.
6065         (Script_sections::output_section_name): Add a new parameter for
6066         returning script section type.
6067         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6068         INFO and NOLOAD.
6069         * yyscript.y (union): Add new field SECTION_TYPE.
6070         (COPY, DSECT, INFO, NOLOAD): New tokens.
6071         (opt_address_and_section_type): Change type to output_section_header.
6072         (section_type): New non-terminal
6073         (section_header): Handle section type.
6074         (opt_address_and_section_type): Return section type value.
6075
6076 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6077
6078         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6079         * testsuite/plugin_common_test_2.c (foo): Likewise.
6080
6081 2010-04-08  Doug Kwan  <dougkwan@google.com>
6082
6083         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6084         Output_merge_data.
6085         * output.cc (Output_section::add_merge_input_section): Simplify
6086         code and return status of Output_merge_base::add_input_section.
6087         Update merge section map only if Output_merge_base::add_input_section
6088         returns true.
6089
6090 2010-04-07  Doug Kwan  <dougkwan@google.com>
6091
6092         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6093         if section is marked as containing instructions but has no mapping
6094         symbols.
6095         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6096         correct section index.
6097         (Arm_relobj::find_linked_text_section): Ditto.
6098
6099 2010-04-07  Cary Coutant  <ccoutant@google.com>
6100
6101         * archive.cc (include_member): Destroy Read_symbols_data object before
6102         releasing file.
6103         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6104         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6105         (Read_symbols_data::~Read_symbols_data) New destructor.
6106         (Section_relocs::Section_relocs) New constructor.
6107         (Section_relocs::~Section_relocs) New destructor.
6108         (Read_relocs_data::Read_relocs_data) New constructor.
6109         (Read_relocs_data::~Read_relocs_data) New destructor.
6110         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6111         pointers to NULL after deleting.
6112
6113 2010-04-07  Doug Kwan  <dougkwan@google.com>
6114
6115         * arm.cc: Replace "endianity" with "endianness" in comments.
6116         (Arm_exidx_cantunwind): Ditto.
6117         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6118         (Arm_relobj::merge_flags_and_attributes): New method.
6119         (Arm_relobj::merge_flags_and_attributes_): New data member.
6120         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6121         (Arm_relobj::scan_sections_for_stubs): Ditto.
6122         (Arm_relobj::do_read_symbols): Check to see if we really want to
6123         merge processor-specific flags and attributes.  Exit early if
6124         an object is empty except for section names and the undefined symbol.
6125         (Target_arm::do_finalize_sections): Move check for ELF format to
6126         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6127         attributes from a regular object only when we have determined that
6128         it is aapropriate.  Do not create an .ARM.attributes section in
6129         output if there is no regular input object.
6130         (Target_arm::merge_processor_specific_flags): Check
6131         --warn-mismatch before printing any error.
6132         (Target_arm::merge_object_attributes): Ditto.
6133         * gold.cc (queue_middle_tasks): Handle the case in which there is
6134         no regular object in input.
6135         * options.cc (General_options::parse_EB): New method.
6136         (General_options::parse_EL): Same.
6137         (General_options::General_options): Initialize endianness_.
6138         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6139         New options.
6140         (General_options::Endianness): New enum.
6141         (General_options::endianness): New method.
6142         (General_options::endianness_): New data member.
6143         * parameters.cc (Parameters::set_options): Check target endianness.
6144         (Parameters::set_target_once): Ditto.
6145         (Parameters::check_target_endianness): New method.
6146         (parameters_force_valid_target): If either -EL or -EB is specified,
6147         use it to define endianness of default target.
6148         * parameters.h (Parameters::check_target_endianness): New method
6149         declaration.
6150         * target.h (class Target): Change "endianity" to "endianness"
6151         in comments.
6152
6153 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6154
6155         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6156         * configure: Regenerate.
6157         * Makefile.in: Regenerate.
6158         * testsuite/Makefile.in: Regenerate.
6159
6160 2010-04-06  Cary Coutant  <ccoutant@google.com>
6161
6162         gcc PR lto/42757
6163         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6164         prevailing definitions of common symbols.
6165         * testsuite/plugin_test_6.sh: New test case.
6166         * testsuite/plugin_common_test_1.c: New test case.
6167         * testsuite/plugin_common_test_2.c: New test case.
6168         * testsuite/Makefile.am (plugin_test_6): New test case.
6169         * testsuite/Makefile.in: Regenerate.
6170
6171 2010-04-06  Nick Clifton  <nickc@redhat.com>
6172
6173         * po/vi.po: New Vietnamese translation.
6174
6175 2010-03-30  Doug Kwan  <dougkwan@google.com>
6176
6177         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6178
6179 2010-03-25  Doug Kwan  <dougkwan@google.com>
6180
6181         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6182         to avoid a conversion warning on a 32-bit host.
6183
6184 2010-03-24  Ian Lance Taylor  <iant@google.com>
6185
6186         * testsuite/script_test_3.t: Add a TLS segment.
6187         * testsuite/Makefile.am (check_PROGRAMS): Add
6188         tls_phdrs_script_test.
6189         (tls_phdrs_script_test_SOURCES): Define.
6190         (tls_phdrs_script_test_DEPENDENCIES): Define.
6191         (tls_phdrs_script_test_LDFLAGS): Define.
6192         (tls_phdrs_script_test_LDADD): Define.
6193         * testsuite/Makefile.in: Rebuild.
6194
6195 2010-03-23  Cary Coutant  <ccoutant@google.com>
6196
6197         * fileread.cc (find_or_make_view): Fix comment.
6198
6199 2010-03-23  Ian Lance Taylor  <iant@google.com>
6200
6201         * script-sections.cc (class Orphan_section_placement): Define
6202         PLACE_TLS and PLACE_TLS_BSS.
6203         (Orphan_section_placement::Orphan_section_placement): Initialize
6204         new places.
6205         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6206         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6207         (tls_script_test_SOURCES): Define.
6208         (tls_script_test_DEPENDENCIES): Define.
6209         (tls_script_test_LDFLAGS): Define.
6210         (tls_script_test_LDADD): Define.
6211         * testsuite/Makefile.in: Rebuild.
6212
6213 2010-03-22  Doug Kwan  <dougkwan@google.com>
6214
6215         * arm.cc (Arm_relocate_functions::abs8,
6216         Arm_relocate_functions::abs16): Use correct check for overflow
6217         specified in the ARM ELF specs.
6218         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6219         target of a BLX instruction specially.
6220         (Reloc_stub::stub_type_for_reloc): Ditto.
6221         (Relocate::relocate): Use symbolic names instead of numeric relocation
6222         codes to report error.
6223         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6224         workaround.
6225         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6226         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6227         thumb2_blx_out_of_range.stdout
6228         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6229         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6230         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6231         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6232         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6233         thumb2_blx_in_range, thumb2_blx_in_range.o,
6234         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6235         thumb2_blx_out_of_range.o): New rules.
6236         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6237         thumb2_blx_in_range and thumb2_blx_out_of_range.
6238         * testsuite/Makefile.in: Regenerate.
6239         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6240         * testsuite/thumb_blx_in_range.s: New file.
6241         * testsuite/thumb_blx_out_of_range.s: New file.
6242
6243 2010-03-22  Rafael Espindola  <espindola@google.com>
6244
6245         * archive.cc (Should_include): Move to archive.h.
6246         (should_include_member): Make it a member of Archive.
6247         (Lib_group): New.
6248         (Add_lib_group_symbols): New.
6249         * archive.h: Include options.h.
6250         (Archive_member): Moved from Archive.
6251         (Should_include): Moved from archive.cc.
6252         (Lib_group): New.
6253         (Add_lib_group_symbols): New.
6254         * dynobj.cc (do_should_include_member): New.
6255         * dynobj.h (do_should_include_member): New.
6256         * gold.cc (queue_initial_tasks): Update call to queue.
6257         * main.cc (main): Print lib group stats.
6258         * object.cc (do_should_include_member): New.
6259         * object.h: Include archive.h.
6260         (Object::should_include_member): New.
6261         (Object::do_should_include_member): New.
6262         (Sized_relobj::do_should_include_member): New.
6263         * options.cc (General_options::parse_start_lib): New.
6264         (General_options::parse_end_lib): New.
6265         (Input_arguments::add_file): Handle lib groups.
6266         (Input_arguments::start_group): Check we are not in a lib.
6267         (Input_arguments::start_lib): New.
6268         (Input_arguments::end_lib): New.
6269         * options.h (General_options): Add start_lib and end_lib.
6270         (Input_argument::lib_): New.
6271         (Input_argument::lib): New.
6272         (Input_argument::is_lib): New.
6273         (Input_file_lib): New.
6274         (Input_arguments::in_lib_): New.
6275         (Input_arguments::in_lib): New.
6276         (Input_arguments::start_lib): New.
6277         (Input_arguments::end_lib_): New.
6278         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6279         in unused members as preempted.
6280         (Sized_pluginobj::do_should_include_member): New.
6281         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6282         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6283         return the blocker.
6284         (Read_symbols::do_whole_lib_group): New.
6285         (Read_symbols::do_lib_group): New.
6286         (Read_symbols::do_read_symbols): Handle lib groups.
6287         (Read_symbols::get_name): Handle lib groups.
6288         * readsyms.h (Read_symbols): Add an archive member pointer.
6289         (Read_symbols::do_whole_lib_group): New.
6290         (Read_symbols::do_lib_group): New.
6291         (Read_symbols::member_): New.
6292         * script.cc (read_input_script): Update call to queue_soon.
6293
6294 2010-03-19  Doug Kwan  <dougkwan@google.com>
6295
6296         * arm.cc (Stub_table::Stub_table): Initialize new data members
6297         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6298         (Stub_table::add_reloc_stub): Assign stub offset and update
6299         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6300         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6301         New data members.
6302         (Stub_table::update_data_size_and_addralign): Use
6303         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6304         instead of going over all reloc stubs.
6305         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6306         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6307         Stringpool_template::offset_ to size of Stringpool_char.
6308         (Stringpool_template::new_key_offset): Remove code to initialize
6309         Stringpool_template::offset_.
6310         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6311         Stringpool_template::offset_ to zero.
6312
6313 2010-03-15  Doug Kwan  <dougkwan@google.com>
6314
6315         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6316         offset_.
6317         (Stringpool_template::new_key_offset): New method.
6318         (Stringpool_template::add_string): Assign offsets when adding new
6319         strings.
6320         (Stringpool_template::set_string_offsets): Do not set string offsets
6321         when not optimizing.
6322         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6323         member size_.
6324         (Chunked_vector::clear): Clear size_.
6325         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6326         (Chunked_vector::size): Return size_.
6327         (Chunked_vector::push_back): Use size_ to find insert position.
6328         (Chunked_vector::size_): New data member.
6329         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6330         (Stringpool_template::new_key_offset): New method declaration.
6331         (Stringpool_template::offset_): New data member.
6332
6333 2010-03-15   Rafael Espindola  <espindola@google.com>
6334
6335         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6336         Add_symbols' constructor.
6337         * readsyms.h (Add_symbols): Remove the input_group member.
6338
6339 2010-03-10  Ian Lance Taylor  <iant@google.com>
6340
6341         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6342         target to ask whether a reference to a symbol requires a stack
6343         split.
6344         * target.h (Target::is_call_to_non_split): New function.
6345         (Target::do_is_call_to_non_split): Declare virtual function.
6346         * target.cc: Include "symtab.h".
6347         (Target::do_is_call_to_non_split): New function.
6348         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6349
6350 2010-03-10  Cary Coutant  <ccoutant@google.com>
6351
6352         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6353         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6354         (File_read::open[2]): Add whole_file_view_ to list of views.
6355         (File_read::make_view): Remove test of whole_file_view_.
6356         (File_read::find_or_make_view): Create whole_file_view_ if
6357         necessary.
6358         (File_read::clear_views): Replace bool parameter with enum;
6359         adjust all callers.  Don't delete views with permanent data;
6360         do delete cached views and views from archives if
6361         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6362         if clearing the corresponding view.
6363         * fileread.h (File_read::Clear_views_mode): New enum.
6364         (File_read::View::is_permanent_view): New method.
6365         (File_read::clear_views): Replace bool parameter
6366         with enum; adjust all callers.
6367         * options.h (General_options): Change keep_files_mapped option;
6368         add map_whole_files.
6369         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6370         releasing the file.
6371         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6372         the file.
6373
6374 2010-03-10  David S. Miller  <davem@davemloft.net>
6375
6376         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6377
6378 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6379
6380         * icf.cc (get_section_contents): Add '@' marker after processing the
6381         merge reloc.
6382
6383 2010-03-08  Doug Kwan  <dougkwan@google.com>
6384
6385         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6386         due to a conversion warning.
6387         (Arm_relobj::update_output_local_symbol_count): Check for local
6388         symbol with unset output index.
6389
6390 2010-03-05  Ian Lance Taylor  <iant@google.com>
6391
6392         * options.h (class General_options): Add --spare-dynamic-tags.
6393         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6394         --spare-dynamic-tags.
6395
6396 2010-03-05  Ian Lance Taylor  <iant@google.com>
6397
6398         * incremental.cc: Include "libiberty.h".
6399
6400 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6401
6402         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6403         function, is_info_ member.
6404         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6405         (Versions::Versions): Update caller.
6406         (Versions::define_base_version): Likewise.
6407         (Versions::add_def): Likewise.
6408
6409 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6410
6411         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6412         (Scan::possible_function_pointer_reloc): New function.
6413         (Scan::local_reloc_may_be_function_pointer): Change to call
6414         possible_function_pointer_reloc.
6415         (Scan::global_reloc_may_be_function_pointer): Ditto.
6416         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6417         relocations in ".data.rel.ro._ZTV" section.
6418         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6419         * testsuite/icf_safe_so_test.cc: Ditto.
6420         * testsuite/icf_safe_test.cc: Ditto.
6421         * testsuite/icf_safe_test.sh: Ditto.
6422
6423 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6424             Ian Lance Taylor  <iant@google.com>
6425
6426         * target-reloc.h (relocate_section): Check the symbol table index
6427         for -1U before setting the local symbol index.
6428         (scan_relocatable_relocs): If copying the relocation, record that
6429         the local symbol is required.
6430         * object.h (Symbol_value::is_output_symtab_index_set): New
6431         function.
6432         (Symbol_value::may_be_discarded_from_output_symtab): New
6433         function.
6434         (Symbol_value::has_output_symtab_entry): New function.
6435         (Symbol_value::needs_output_symtab_entry): Remove.
6436         (Symbol_value::output_symtab_index): Make sure the symbol index is
6437         set.
6438         (Symbol_value::set_output_symtab_index): Make sure the symbol
6439         index is not set.  Make sure the new index is valid.
6440         (Symbol_value::set_must_have_output_symtab_entry): New function.
6441         (Symbol_value::has_output_dynsym_entry): New function.
6442         (Symbol_value::set_output_dynsym_index): Make sure the new index
6443         is valid.
6444         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6445         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6446         local symbol if permitted.
6447         (Sized_relobj::do_finalize_local_symbols): Call
6448         is_output_symtab_index_set rather than needs_output_symtab_entry.
6449         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6450         rather than needs_output_symtab_entry.  Call
6451         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6452         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6453         is_output_symtab_index_set rather than needs_output_symtab_entry.
6454         * testsuite/discard_locals_relocatable_test.c: New file.
6455         * testsuite/discard_locals_test.sh: Test -r.
6456         * testsuite/Makefile.am (check_DATA): Add
6457         discard_locals_relocatable_test1.syms,
6458         discard_local_relocatable_test2.syms.
6459         (MOSTLYCLEANFILES): Likewise.  Also add
6460         discard_locals_relocatable_test1.lout and
6461         discard_locals_relocatable_test2.out.
6462         (discard_locals_relocatable_test1.syms): New target.
6463         (discard_locals_relocatable_test.o): New target.
6464         (discard_locals_relocatable_test1.out): New target.
6465         (discard_locals_relocatable_test2.syms): New target.
6466         (discard_locals_relocatable_test2.out): New target.
6467         (various): Add missing ../ld-new dependencies.
6468         * testsuite/Makefile.in: Rebuild.
6469
6470 2010-03-03  Nick Clifton  <nickc@redhat.com>
6471
6472         * po/fi.po: New Finnish translation.
6473
6474 2010-03-01  Doug Kwan  <dougkwan@google.com>
6475
6476         * layout.cc (Layout::Layout): Force section types of .init_array*,
6477         .preinit_array* and .fini_array* sections.
6478         * output.cc (Output_section::Input_section_sort_entry::has_priority):
6479         Fix check of return value of std::string::find.().
6480         (Output_section::Input_section_sort_compare::operator()): Remove
6481         comment about .init_array.
6482         (Output_section::Input_section_sort_init_fini_compare::operator()):
6483         New method.
6484         (Output_section::sort_attached_input_sections): Handle .init_array
6485         and .fini_array specially.
6486         * output.h (Output_section::Inut_section_sort_compare): Update
6487         comment.
6488         (Output_section::Input_section_sort_init_fini_compare): New struct.
6489
6490 2010-02-26  Doug Kwan  <dougkwan@google.com>
6491
6492         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
6493         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
6494         * testsuite/debug_msg.sh: Avoid matching source line number for
6495         use of global variable undef_int.
6496
6497 2010-02-26  Doug Kwan  <dougkwan@google.com>
6498
6499         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
6500         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
6501         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
6502         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
6503         * options.cc (General_options::General_options): Initialize member
6504         fix_v4bx_.
6505         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
6506         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
6507         and rm_no_fix_v4bx.stdout
6508         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
6509         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
6510         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
6511         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
6512         and arm_no_fix_v4bx.
6513         * Makefile.in: Regenerate.
6514         * testsuite/arm_fix_v4bx.s: New file.
6515         * testsuite/arm_fix_v4bx.sh: Ditto.
6516
6517 2010-02-24  Doug Kwan  <dougkwan@google.com>
6518
6519         * arm.cc (Target_arm::got_section): Make the .got section the first
6520         non RELRO section in the data segment.
6521         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
6522         suffixes of section names.
6523
6524 2010-02-24  Doug Kwan  <dougkwan@google.com>
6525
6526         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
6527         flags and attributes merging if an input file is a binary file.
6528         * fileread.cc (Input_file::open): Record format of original file.
6529         * fileread.h (Input_file::Format): New enum type.
6530         (Input_file::Input_file): Initialize data member format_.
6531         (Input_file::format): New method definition.
6532         (Input_file::format_):: New data member.
6533
6534 2010-02-24  Doug Kwan  <dougkwan@google.com>
6535
6536         * arm.cc (Arm_output_data_got): New class.
6537         (ARM_TCB_SIZE): New constant
6538         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
6539         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
6540         If user uses a script with a SECTIONS clause, issue only a warning
6541         for a misplaced EXIDX input section.  Otherwise, issue an error.
6542         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
6543         garbage collection.
6544         (Target_arm::got_mode_index_entry): Handle static linking.
6545         (Target_arm::Scan::local): Ditto.
6546         (Target_arm::Scan::global): Ditto.
6547         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
6548         all incorrectly implemented relocations.
6549         (Target_arm::fix_exidx_coverage): Pass layout to
6550         Arm_output_section::fix_exidx_coverage.
6551         * layout.cc (Layout::section_name_mapping): Remove trailing dots
6552         from ".ARM.exidx." and ".ARM.extab.".
6553
6554 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6555
6556         * arm.cc (Target_arm::do_finalize_sections): Create attribute
6557         section if it does not already exist.
6558         * attributes.cc (Attributes_section_data::Attributes_section_data):
6559         Don't crash if size is zero.
6560
6561 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6562             Ian Lance Taylor  <iant@google.com>
6563
6564         * gold.cc (queue_middle_tasks): If no input files were opened,
6565         exit.
6566         * workqueue.h (Task_function::Task_function): Assert that there is
6567         a blocker.
6568
6569 2010-02-22  Doug Kwan  <dougkwan@google.com>
6570
6571         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
6572         * icf.cc (get_section_contents): Cast snprintf arguments to long long
6573         types to avoid warnings due to different uint64_t implementations
6574         on different hosts.
6575
6576 2010-02-21  Doug Kwan  <dougkwan@google.com>
6577
6578         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
6579         handling of the maximum backward branch offset.
6580         (Arm_relocate_functions::thumb_branch_common): Ditto.
6581         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
6582         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
6583         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
6584         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
6585         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
6586         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
6587         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
6588         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
6589         thumb_bl_out_of_range thumb_bl_out_of_range.o,
6590         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
6591         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
6592         thumb2_bl_out_of_range.o): New rules.
6593         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
6594         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
6595         thumb2_bl_out_of_range
6596         * testsuite/Makefile.in: Regenerate.
6597         * testsuite/arm_bl_in_range.s: New file.
6598         * testsuite/arm_bl_out_of_range.s: Ditto.
6599         * testsuite/arm_branch_in_range.sh: Ditto.
6600         * testsuite/arm_branch_range.t: Ditto.
6601         * testsuite/thumb2_branch_range.t: Ditto.
6602         * testsuite/thumb_bl_in_range.s: Ditto.
6603         * testsuite/thumb_bl_out_of_range.s: Ditto.
6604         * testsuite/thumb_branch_range.t: Ditto.
6605
6606 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
6607
6608         * gc.h (gc_process_relocs): Change vectors to point to the new list.
6609         Add reloc offset information.
6610         * icf.cc (get_section_contents): Change iterators to point to the new
6611         vectors. Add reloc offset information to the contents.
6612         * icf.h (Icf::Sections_reachable_info): New typedef.
6613         (Icf::Sections_reachable_list): New typedef.
6614         (Icf::Offset_info): New typedef.
6615         (Icf::Reloc_info): New struct typedef.
6616         (Icf::Reloc_info_list): New typedef.
6617         (Icf::symbol_reloc_list): Delete method.
6618         (Icf::addend_reloc_list): Delete method.
6619         (Icf::section_reloc_list): Delete method.
6620         (Icf::reloc_info_list): New method.
6621         (Icf::reloc_info_list_): New member.
6622
6623 2010-02-19  Doug Kwan  <dougkwan@google.com>
6624
6625         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
6626         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
6627         * arm.cc (Arm_relocation_functions): New forward declaration.
6628         (Target_arm::Target_arm): Initialize new data members
6629         got_mod_index_offset_ and tls_base_symbol_defined_.
6630         (Target_arm::Relocate::relocate_tls): New method.
6631         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
6632          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
6633         New methods.
6634         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
6635         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
6636         (Target_arm::got_mod_index_offset_,
6637         Target_arm::tls_base_symbol_defined_): New data members.
6638         (Target_arm::Scan::local, Target::Scan::global,
6639         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
6640         relocations.
6641
6642 2010-02-18  Doug Kwan  <dougkwan@google.com>
6643
6644         * arm.cc (Arm_relobj::find_linked_text_section): New method.
6645         (Arm_relobj::make_exidx_input_section): Pass section index of linked
6646         text section as a parameter becuase some broken tools may not set
6647         the link in section header.
6648         (Target_arm::has_got_section): New method.
6649         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
6650         without any mapping symbol as data only.  Remove warning.
6651         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
6652         link in its section header, try to discover the link by inspecting the
6653         REL31 relocation at the beginning of the section.
6654         (Target_arm::Scan::check_non_pic): Report name of offending relocation
6655         in error message.
6656         (Target_arm::Scan::global): Treat any reference to the symbol
6657         _GLOBAL_OFFSET_TABLE_ as a GOT access.
6658
6659 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
6660
6661         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
6662         (Scan::global_reloc_may_be_function_pointer): New function.
6663         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6664         (Scan::global_reloc_may_be_function_pointer): New function.
6665         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
6666         (Scan::global_reloc_may_be_function_pointer): New function.
6667         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
6668         (Scan::global_reloc_may_be_function_pointer): New function.
6669         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
6670         (Scan::global_reloc_may_be_function_pointer): New function.
6671         (Scan::possible_function_pointer_reloc): New function.
6672         (Target_x86_64::can_check_for_function_pointers): New function.
6673         * gc.h (gc_process_relocs): Scan relocation types to determine if
6674         function pointers were taken for targets that support it.
6675         * icf.cc (Icf::find_identical_sections): Include functions for
6676         folding in safe ICF whose pointer is not taken.
6677         * icf.h (Secn_fptr_taken_set): New typedef.
6678         (fptr_section_id_): New member.
6679         (section_has_function_pointers): New function.
6680         (set_section_has_function_pointers): New function.
6681         (check_section_for_function_pointers): New function.
6682         * options.h: Fix comment for safe ICF option.
6683         * target.h (can_check_for_function_pointers): New function.
6684         * testsuite/Makefile.am: Add icf_safe_so_test test case.
6685         Modify icf_safe_test for X86-64.
6686         * testsuite/Makefile.in: Regenerate.
6687         * testsuite/icf_safe_so_test.cc: New file.
6688         * testsuite/icf_safe_so_test.sh: New file.
6689         * testsuite/icf_safe_test.cc (kept_func_3): New function.
6690         (main): Change to take pointer to function kept_func_3.
6691         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
6692         folding is done correctly for X86-64.
6693
6694 2010-02-12  David S. Miller  <davem@davemloft.net>
6695
6696         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
6697         is_symbolless parameter.
6698         (Output_reloc<SHT_REL>::is_symbolless): New.
6699         (Output_reloc<SHT_REL>::is_symbolless_): New.
6700         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
6701         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
6702         (Output_reloc<SHT_RELA>::is_symbolless): New.
6703         (Output_data_reloc::add_global): Handle is_symbolless.
6704         (Output_data_reloc::add_global_relative): Likewise.
6705         (Output_data_reloc::add_local): Likewise.
6706         (Output_data_reloc::add_local_relative): Likewise.
6707         (Output_data_reloc::add_symbolless_global_addend): New.
6708         (Output_data_reloc::add_symbolless_local_addend): New.
6709         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
6710         is_symbolless.
6711         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
6712         instead of ->is_relative_
6713         (Output_reloc::write): Likewise.
6714         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
6715         (Output_reloc::write_rel): Simplify.
6716
6717         * sparc.cc (Target_sparc::Scan::local): Use
6718         ->add_symbolless_local_addend as needed.
6719         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
6720         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
6721         based upon relocation offset.
6722
6723 2010-02-11  Doug Kwan  <dougkwan@google.com>
6724
6725         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
6726         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
6727         beginning of function.
6728         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
6729         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
6730         parameter is_32bit in calls to should_apply_static_reloc.
6731         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
6732         (check_DATA): Add arm_abs_global.stdout.
6733         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
6734         arm_abs_global.stdout): New rules.
6735         (MOSTLLYCLEANFILES): Add arm_abs_global
6736         * Makefile.in: Regenerate.
6737         * testsuite/arm_abs_global.s: New file.
6738         * testsuite/arm_abs_global.sh: Ditto.
6739         * testsuite/arm_abs_lib.s: Ditto.
6740
6741 2010-02-11  Ian Lance Taylor  <iant@google.com>
6742
6743         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
6744         Read_relocs task.
6745         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
6746         Allocate_commons_task first.
6747         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
6748         task, rather than symtab_lock_.
6749         (Gc_process_relocs::~Gc_process_relocs): New function.
6750         (Gc_process_relocs::is_runnable): Check this_blocker_.
6751         (Gc_process_relocs::locks): Use next_blocker_ rather than
6752         blocker_.
6753         (Scan_relocs::~Scan_relocs): New function.
6754         (Scan_relocs::is_runnable): Check this_blocker_ rather than
6755         symtab_lock_.
6756         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
6757         next_blocker_.
6758         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
6759         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
6760         constructor accordingly.
6761         (class Gc_process_relocs): Likewise.
6762         (class Scan_relocs): Likewise.
6763         * common.h (class Allocate_commons_task): Remove symtab_lock_
6764         field, and corresponding constructor parameter.
6765         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
6766         symtab_lock_.
6767         (Allocate_commons_task::locks): Likewise.
6768
6769 2010-02-11  Ian Lance Taylor  <iant@google.com>
6770
6771         * gold-threads.h (class Once): Define.
6772         (class Initialize_lock): Rewrite as child of Once.
6773         * gold-threads.cc (class Once_initialize): Define.
6774         (once_pointer_control): New static variable.
6775         (once_pointer, once_arg): New static variables.
6776         (c_run_once): New static function.
6777         (Once::Once, Once::run_once, Once::internal_run): New functions.
6778         (class Initialize_lock_once): Remove.
6779         (initialize_lock_control): Remove.
6780         (initialize_lock_pointer): Remove.
6781         (initialize_lock_once): Remove.
6782         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
6783         (Initialize_lock::initialize): Rewrite.
6784         (Initialize_lock::do_run_once): New function.
6785         * archive.cc (Archive::interpret_header): Only clear name if it is
6786         not already empty.
6787         * fileread.cc: Include "gold-threads.h"
6788         (file_counts_lock): New static variable.
6789         (file_counts_initialize_lock): Likewise.
6790         (File_read::release): Only increment counts when using --stats.
6791         Use a lock around the increment.
6792         * parameters.cc (class Set_parameters_target_once): Define.
6793         (set_parameters_target_once): New static variable.
6794         (Parameters::Parameters): Move here from parameters.h.
6795         (Parameters::set_target): Rewrite.
6796         (Parameters::set_target_once): New function.
6797         (Parameters::clear_target): Move here and rewrite.
6798         * parameters.h (class Parameters): Update declarations.  Add
6799         set_parameters_target_once_ field.
6800         (Parameters::Parameters): Move to parameters.cc.
6801         (Parameters::clear_target): Likewise.
6802         * readsyms.cc (Read_symbols::do_group): Create a Start_group
6803         task.
6804         (Start_group::~Start_group): New function.
6805         (Start_group::is_runnable): New function.
6806         (Start_group::locks, Start_group::run): New functions.
6807         (Finish_group::run): Change saw_undefined to size_t.
6808         * readsyms.h (class Start_group): Define.
6809         (class Finish_group): Change saw_undefined_ field to size_t.
6810         (Finish_group::Finish_group): Remove saw_undefined and
6811         this_blocker parameters.  Change all callers.
6812         (Finish_group::set_saw_undefined): New function.
6813         (Finish_group::set_blocker): New function.
6814         * symtab.h (class Symbol_table): Change saw_undefined to return
6815         size_t.  Change saw_undefined_ field to size_t.
6816         * target-select.cc (Set_target_once::do_run_once): New function.
6817         (Target_selector::Target_selector): Initialize set_target_once_
6818         field.  Don't initialize lock_ and initialize_lock_ fields.
6819         (Target_selector::instantiate_target): Rewrite.
6820         (Target_selector::set_target): New function.
6821         * target-select.h (class Set_target_once): Define.
6822         (class Target_selector): Update declarations.  Make
6823         Set_target_once a friend.  Remove lock_ and initialize_lock_
6824         fields.  Add set_target_once_ field.
6825
6826 2010-02-10  Ian Lance Taylor  <iant@google.com>
6827
6828         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
6829         queueing any tasks.
6830         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
6831         (queue_middle_tasks): Add all blockers before queueing any tasks.
6832         (queue_final_tasks): Likewise.
6833         * token.h (Task_token::add_blockers): New function.
6834         * object.h (Input_objects::number_of_relobjs): New function.
6835
6836 2010-02-10  Ian Lance Taylor  <iant@google.com>
6837
6838         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
6839         shared, not if not position independent.
6840         * x86_64.cc (Relocate::relocate_tls): Likewise.
6841         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
6842         (tls_pie_pic_test): New target.
6843         * testsuite/Makefile.in: Rebuild.
6844
6845         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
6846         (tls_test_main_pie.o, tls_test_pie.o): New targets.
6847         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
6848         * testsuite/Makefile.in: Rebuild.
6849
6850 2010-02-09  David S. Miller  <davem@davemloft.net>
6851
6852         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
6853         R_SPARC_RELATIVE using ->add_local_relative().
6854         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
6855
6856         * output.h (Output_data_dynamic::add_section_size): New method
6857         that takes two Output_data objects.
6858         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
6859         entry param.  Handle it in initializers.
6860         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
6861         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
6862         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
6863         arg.
6864         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
6865         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
6866         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
6867         for dynrel_includes_plt.
6868         * i386.cc (Target_i386::do_finalize_sections): Likewise.
6869         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6870         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
6871         before .rela.plt
6872         (Target_sparc::do_finalize_sections): Update to pass true for
6873         dynrel_includes_plt.
6874         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
6875         output before .rela.plt
6876         (Target_powerpc::do_finalize_sections): Update to pass true for
6877         dynrel_includes_plt when 32-bit.
6878
6879 2010-02-08  Doug Kwan  <dougkwan@google.com>
6880
6881         * arm.cc (Arm_relobj::simple_input_section_output_address): New
6882         method.
6883         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
6884         Arm_relobj::scan_section_for_cortex_a8_stubs,
6885         Arm_relobj::do_relocation_section): Instead of calling
6886         Output_section::output_address, use faster
6887         Arm_relobj::simple_input_section_output_address.
6888
6889 2010-02-08  David S. Miller  <davem@davemloft.net>
6890
6891         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
6892         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
6893         relocation helper function.
6894
6895         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
6896         just like R_SPARC_GOT{10,13,22}.
6897         (Target_sparc::Scan::local): Likewise.
6898         (Target_sparc::Relocate:relocate): Likewise.
6899
6900 2010-02-06  Ian Lance Taylor  <iant@google.com>
6901
6902         * configure.ac: Rewrite targetobjs duplicate removal code to use
6903         only shell constructs.
6904         * configure: Rebuild.
6905
6906 2010-02-05  Doug Kwan  <dougkwan@google.com>
6907
6908         PR 11247
6909         * arm.cc (Arm_relobj::section_is_scannable): New method.
6910         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
6911         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
6912
6913 2010-02-04  Doug Kwan  <dougkwan@google.com>
6914
6915         PR 11247
6916         * arm-reloc-property.cc (cstdio): Include.
6917         * configure.ac (targetobjs): Remove duplicates.
6918         * configure: Regenerate.
6919         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
6920         big and little endian version for a given address size.
6921
6922 2010-02-03  Doug Kwan  <dougkwan@google.com>
6923
6924         * arm-reloc-property.cc
6925         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6926         definition.
6927         * arm-reloc-property.h
6928         (Arm_reloc_property_table::get_implemented_static_reloc_property):
6929         New method definition.
6930         (Arm_reloc_property_table::reloc_name_in_error_message): New method
6931         declaration.
6932         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
6933         overflow to N.
6934         (GOT_PREL): Change implemented to Y.
6935         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
6936         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
6937         (Arm_relocate_functions::movw_abs_nc): Remove method.
6938         (Arm_relocate_functions::movt_abs): Ditto.
6939         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
6940         (Arm_relocate_functions::thm_movt_abs): Ditto.
6941         (Arm_relocate_functions::movw_rel_nc): Ditto.
6942         (Arm_relocate_functions::movw_rel): Ditto.
6943         (Arm_relocate_functions::movt_rel): Ditto.
6944         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
6945         (Arm_relocate_functions:thm_movw_rel): Ditto.
6946         (Arm_relocate_functions:thm_movt_rel): Ditto.
6947         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
6948         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
6949         New method definitions.
6950         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
6951         (Arm_relocation_functions::arm_grp_ldr): Ditto.
6952         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
6953         (Arm_relocation_functions::arm_grp_ldc): Ditto.
6954         (Target_arm::Relocate::relocate): Check for non-static or
6955         unimplemented relocation code and exit early.  Change calls to
6956         Target_arm::reloc_uses_thumb_bit and
6957         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
6958         instead.  Refactor code to handle similar relocations to increase
6959         code sharing.  Remove check for unsupported relocation code in switch
6960         statement.
6961         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
6962         relocation property table to find out size.  Change error message to
6963         print out the name of a relocation code instead of the numeric value.
6964         (Target_arm::scan_reloc_for_stub): Use relocation property table
6965         instead of calling Target_arm::reloc_uses_thumb_bit().
6966
6967 2010-02-02  Doug Kwan  <dougkwan@google.com>
6968
6969         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
6970         types of relaxed input section.
6971
6972 2010-02-02  Doug Kwan  <dougkwan@google.com>
6973
6974         * Makefile.am (HFILES): Add arm-reloc-property.h.
6975         (DEFFILES): New.
6976         (TARGETSOURCES): Add arm-reloc-property.cc
6977         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
6978         (libgold_a_SOURCES): $(DEFFILES)
6979         * Makefile.in: Regenerate.
6980         * arm-reloc-property.cc: New file.
6981         * arm-reloc-property.h: New file.
6982         * arm-reloc.def: New file.
6983         * arm.cc: Update comments.
6984         (arm-reloc-property.h): New included header.
6985         (arm_reloc_property_table): New global variable.
6986         (Target_arm::do_select_as_default_target): New method definition.
6987         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
6988         arm-reloc-property to targ_extra_obj.
6989         * parameters.cc (set_parameters_target): Call
6990         Target::select_as_default_target().
6991         * target.h (Target::select_as_default_target): New method definition.
6992         (Target::do_select_as_default_target): Same.
6993
6994 2010-02-01  Doug Kwan  <dougkwan@google.com>
6995
6996         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
6997         first_output_text_section_.
6998         (Arm_exidx_fixup::first_output_text_section): New method definition.
6999         (Arm_exidx_fixup::first_output_text_section_): New data member.
7000         (Arm_exidx_fixup::process_exidx_section): Record the first text
7001         output section seen.
7002         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7003         and entsize in output section header.
7004
7005 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7006
7007         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7008         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7009         (Arm_relocate_functions::thm_alu11): New Method.
7010         (Arm_relocate_functions::thm_pc8): New Method.
7011         (Arm_relocate_functions::thm_pc12): New Method.
7012         (Target_arm::Scan::local): Handle the relocations.
7013         (Target_arm::Scan::global): Likewise.
7014         (Target_arm::Relocate::relocate): Likewise.
7015         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7016
7017 2010-01-29  Doug Kwan  <dougkwan@google.com>
7018
7019         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7020         of relocation types as ld.
7021
7022 2010-01-29  Doug Kwan  <dougkwan@google.com>
7023
7024         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7025         to public.
7026         (Arm_relocate_functions::thumb_branch_common): Ditto.
7027         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7028         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7029         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7030         Arm_relocate_functions::jump24): Remove.
7031         (Target_arm::Relocate::relocate): Adjust code to call
7032         Arm_relocation_functions::arm_branch_common and
7033         Arm_relocation_functions::thumb_branch_common instead of their removed
7034         wrappers.  Merge switch-cases together to reduce source code size.
7035
7036 2010-01-29  Doug Kwan  <dougkwan@google.com>
7037
7038         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7039         output_local_symbol_count_needs_update_.
7040         (Arm_relobj::output_local_symbol_count_needs_update,
7041          Arm_relobj::set_output_local_symbol_count_needs_update,
7042          Arm_relobj::update_output_local_symbol_count): New methods.
7043         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7044         member.
7045         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7046         of pointed function as in a R_ARM_PREL31 relocation.
7047         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7048         for output local symbol count updating.
7049         (Target_arm::do_relax): Update output local symbol counts in objects
7050         if necessary.
7051         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7052
7053 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7054
7055         * arm.cc: Added support for the ARM relocations:
7056         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7057         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7058         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7059         movw_prel_nc).
7060         (Arm_relocate_functions::movw_rel): New method.
7061         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7062         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7063         thm_movw_prel_nc).
7064         (Arm_relocate_functions::thm_movw_rel): New method.
7065         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7066         thm_movt_prel).
7067         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7068         relocations.
7069         (Target_arm::Scan::global): Likewise.
7070         (Target_arm::Relocate::relocate): Likewise.
7071         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7072         Likewise.
7073
7074 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7075
7076         * arm.cc: Added support for ARM group relocations.
7077         (Target_arm::reloc_needs_sym_origin): New method.
7078         (Arm_relocate_functions::calc_grp_kn): New method.
7079         (Arm_relocate_functions::calc_grp_residual): New method.
7080         (Arm_relocate_functions::calc_grp_gn): New method.
7081         (Arm_relocate_functions::arm_grp_alu): New Method.
7082         (Arm_relocate_functions::arm_grp_ldr): New Method.
7083         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7084         (Arm_relocate_functions::arm_grp_ldc): New Method.
7085         (Target_arm::Scan::local): Handle the ARM group relocations.
7086         (Target_arm::Scan::global): Likewise.
7087         (Target_arm::Relocate::relocate): Likewise.
7088         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7089         Likewise.
7090
7091 2010-01-26  Doug Kwan  <dougkwan@google.com>
7092
7093         * arm.cc (set): Include.
7094         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7095         pointer type.
7096         (Arm_output_section::Text_section_list): New type.
7097         (Arm_output_section::append_text_sections_to_list): New method.
7098         (Arm_output_section::fix_exidx_coverage): Ditto.
7099         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7100         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7101         Relobj::set_section_offset() instead of
7102         Sized_relobj::invalidate_section_offset().
7103         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7104         parameter for section headers. Ignore relocation sections for
7105         unallocated sections and EXIDX sections.
7106         (Target_arm::fix_exidx_coverage): New method.
7107         (Target_arm::output_section_address_less_than): New type.
7108         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7109         linked text section instead of the EXIDX section.
7110         (Arm_output_section::create_stub_group): Add an assertion to check
7111         that this is not an EXIDX output section.
7112         (Arm_output_section::append_text_sections_to_list): New method.
7113         (Arm_output_section::fix_exidx_coverage): Ditto.
7114         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7115         Arm_relobj::section_needs_reloc_stub_scanning.
7116         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7117         first pass.
7118         (Target_arm::fix_exidx_coverage): New method.
7119         * object.h (Relobj::set_output_section): New method.
7120         (Sized_relobj::invalidate_section_offset): Remove method.
7121         (Sized_relobj::do_invalidate_section_offset): Remove method.
7122         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7123
7124 2010-01-25  Doug Kwan  <dougkwan@google.com>
7125
7126         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7127         Fix warning due to signed and unsigned comparison on a 32-bit host.
7128
7129 2010-01-22  Doug Kwan  <dougkwan@google.com>
7130
7131         * arm.cc (Target_arm::do_relax): Record an output section for section
7132         offset adjustment it contains any stub table that has changed.
7133         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7134         offsets in an output section if necessary.
7135         * output.cc (Output_section::Output_section): Initialize
7136         section_offsets_need_adjustments_.
7137         (Output_section::add_input_section_for_script): Renamed to
7138         Output_section::add_simple_input_section.
7139         (Output_section::save_states): Add a comment.
7140         (Output_section::discard_states): New method defintion.
7141         (Output_section::adjust_section_offsets): Same.
7142         * output.h (Output_section::add_input_section_for_script): Renamed to
7143         Output_section::add_simple_input_section.
7144         (Output_section::discard_states): New method declaration.
7145         (Output_section::adjust_section_offsets): Same.
7146         (Output_section::section_offsets_need_adjustment,
7147         Output_section::set_section_offsets_need_adjustment): New method
7148         definitions.
7149         (Output_section::section_offsets_need_adjustment_): New data member.
7150         * script-sections.cc
7151         (Output_section_element_input::set_section_address): Adjust code for
7152         renaming of Output_section::add_input_section_for_script.
7153         (Orphan_output_section::set_section_address): Same.
7154
7155 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7156
7157         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7158         Fix_v4bx enum values .
7159         * gold/options.h (General_options): New option definitions.
7160         (General_options::fix_v4bx): New method.
7161         (General_options::Fix_v4bx): New enum.
7162         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7163         (General_options::parse_fix_v4bx_interworking): New method.
7164
7165 2010-01-22  Doug Kwan  <dougkwan@google.com>
7166
7167         * arm.cc (Arm_exidx_fixup): New class.
7168
7169 2010-01-21  Doug Kwan  <dougkwan@google.com>
7170
7171         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7172         classes.
7173         (Arm_exidx_section_offset_map): New type.
7174
7175 2010-01-21  Doug Kwan  <dougkwan@google.com>
7176
7177         * arm.cc (Arm_exidx_input_section): New class.
7178         (Arm_relobj::exidx_input_section_by_link,
7179         Arm_relobj::exidx_input_section_by_shndx,
7180         Arm_relobj::make_exidx_input_section): New methods.
7181         (read_arm_attributes_section): Remove.
7182         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7183         information about them.
7184         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7185         to here.
7186
7187 2010-01-20  Doug Kwan  <dougkwan@google.com>
7188
7189         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7190         Input_section_specifier to Section_id.
7191         (Target_arm::new_arm_input_section: Adjust code for change of key
7192         type.
7193         (Target_arm::find_arm_input_section): Ditto.
7194         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7195         (Section_id): Remove.
7196         (Garbage_collection::Section_id_hash): Remove.
7197         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7198         (Section_id): Remove.
7199         (Icf::Section_id_hash): Remove.
7200         * object.h (Section_id, Const_section_id, Section_id_hash,
7201         Const_section_id_hash): New type definitions.
7202         * output.cc (Output_section::add_relaxed_input_section): Change to
7203         use Const_section_id instead of Input_section_specifier as key type.
7204         (Output_section::add_merge_input_section): Ditto.
7205         (Output_section::build_relaxation_map): Change to use Section_id
7206         instead of Input_section_specifier as key type.
7207         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7208         Ditto.
7209         (Output_section::convert_input_sections_to_relaxed_sections): Change
7210         to use Const_section_id instead of Input_section_specifier as key type.
7211         (Output_section::find_merge_section): Ditto.
7212         (Output_section::find_relaxed_input_section): Ditto.
7213         * output.h (Input_section_specifier): Remove class.
7214         (Output_section::Output_section_data_by_input_section_map): Change
7215         key type to Const_section_id.
7216         (Output_section::Output_relaxed_input_section_by_input_section_map):
7217         Ditto.
7218         (Output_section::Relaxation_map): Change key type to Section_id.
7219
7220 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7221
7222         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7223         (class Arm_v4bx_stub): New class.
7224         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7225         (Stub_factory::make_arm_v4bx_stub): New method.
7226         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7227         (Stub_table::empty): Handle v4bx stubs.
7228         (Stub_table::add_arm_v4bx_stub): New method.
7229         (Stub_table::find_arm_v4bx_stub): New method.
7230         (Arm_relocate_functions::v4bx): New method.
7231         (Target_arm::fix_v4bx): New method.
7232         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7233         (Stub_table::relocate_stubs): Likewise.
7234         (Stub_table::do_write): Likewise.
7235         (Stub_table::update_data_size_and_addralign): Likewise.
7236         (Stub_table::finalize_stubs):  Likewise.
7237         (Target_arm::Scan::local): Likewise.
7238         (Target_arm::Scan::global): Likewise.
7239         (Target_arm::do_finalize_sections): Likewise.
7240         (Target_arm::Relocate::relocate): Likewise.
7241         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7242         Likewise.
7243         (Target_arm::scan_reloc_for_stub): Likewise.
7244         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7245
7246 2010-01-19  Ian Lance Taylor  <iant@google.com>
7247
7248         * output.cc (Output_section_headers::do_sized_write): Write large
7249         segment count to sh_info field.
7250         (Output_file_header::do_sized_write): For large segment count,
7251         write PN_XNUM to e_phnum field.
7252
7253 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7254
7255         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7256         (Arm_relocate_functions::thm_jump8): New function.
7257         (Arm_relocate_functions::thm_jump11): New function.
7258         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7259         R_ARM_THM_JUMP11.
7260         (Target_arm::Scan::global): Likewise.
7261         (Target_arm::Relocate::relocate): Likewise.
7262         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7263         Likewise.
7264
7265 2010-01-14  Doug Kwan  <dougkwan@google.com>
7266
7267         * arm.cc (map, utility): Include headers.
7268         (Target_arm::apply_cortex_a8_workaround): New method.
7269         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7270         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7271         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7272         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7273         the --[no-]fix-cortex-a8 command line options.
7274         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7275         (Target_arm::relocate_stub): Use addend in instruction template.
7276         * options.h (DEFINE_bool): Set the user-set flag.
7277         (General_options): Add --[no-]-fix-cortex options.
7278         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7279         : Update fast look-up map after conversion.
7280
7281 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7282
7283         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7284         in the first pass of do_layout.
7285
7286 2010-01-13  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7289         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7290         apparent compiler problem of not folding static constant integral
7291         data members of elfcpp::Elf_sizes<32>.
7292
7293 2010-01-13  Doug Kwan  <dougkwan@google.com>
7294
7295         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7296         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7297         Arm_relobj::scan_section_for_cortex_a8_erratum,
7298         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7299         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7300         sections to scan for relocation stubs into a new method
7301         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7302         relocation and Cortex-A8 stub scanning.
7303         (Target_arm::do_relax): Force stubs to be after stubbed sections
7304         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7305         the beginning of a new relaxation pass.  Update a comment.
7306         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7307
7308 2010-01-12  Ian Lance Taylor  <iant@google.com>
7309
7310         * target-reloc.h (visibility_error): New inline function.
7311         (relocate_section): Call visibility_error.
7312         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7313         (MOSTLYCLEANFILES): Likewise.
7314         (protected_4_pic.o, protected_3.err): New targets.
7315         * testsuite/protected_4.cc: New file.
7316
7317 2010-01-12  Doug Kwan  <dougkwan@google.com>
7318
7319         * arm.cc (Cortex_a8_reloc): New class.
7320         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7321         and cortex_a8_relocs_info_.
7322         (Target_arm::fix_cortex_a8): New method definition.
7323         (Target_arm::Cortex_a8_relocs_info): New type.
7324         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7325         New data member declarations.
7326         (Target_arm::scan_reloc_for_stub): Record information about
7327         relocations for THUMB branches that might be exempted from the
7328         Cortex-A8 workaround.
7329         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7330         at the beginning of a relaxation pass.
7331
7332 2010-01-12  Doug Kwan  <dougkwan@google.com>
7333
7334         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7335         (Arm_relobj::Mapping_symbol_position,
7336          Arm_reloj::Mapping_symbol_position_less,
7337          Arm_relobj::Mapping_symbols_info): New types.
7338         (Target_arm::is_mapping_symbol_name): New method definition.
7339         (Arm_relobj::do_count_local_symbols): Save information about mapping
7340         symbols.
7341
7342 2010-01-11  Doug Kwan  <dougkwan@google.com>
7343
7344         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7345         Arm_relocate_functions::thumb32_branch_upper,
7346         Arm_relocate_functions::thumb32_branch_lower,
7347         Arm_relocate_functions::thumb32_cond_branch_offset,
7348         Arm_relocate_functions::thumb32_cond_branch_upper,
7349         Arm_relocate_functions::thumb32_cond_branch_lower,
7350         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7351         branch offset encoding.
7352         (Arm_relocate_functions::thumb_branch_common): Use new branch
7353         offset encoding methods to avoid code duplication.
7354         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7355         (Stub_addend_reader::operator()): Use new branch encoding method
7356         to avoid code duplication.
7357
7358 2010-01-11  Doug Kwan  <dougkwan@google.com>
7359
7360         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7361         (Target_arm::do_finalize_sections): Define special EXIDX section
7362         symbols only if referenced.
7363         * gc.h (Garbage_collection::add_reference): New method.
7364         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7365         code duplication.
7366
7367 2010-01-11  Ian Lance Taylor  <iant@google.com>
7368
7369         * script.cc (Version_script_info::build_expression_list_lookup):
7370         Change complaing about duplicate wildcard match from error to
7371         warning.
7372
7373         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7374         of 2009-12-30.
7375         (Version_script_info::Version_script_info): Initialize globs_,
7376         default_version_, default_is_global_, and exact_.  Don't
7377         initialize globals_ or locals_.
7378         (Version_script_info::build_lookup_tables): Build local symbols
7379         first.
7380         (Version_script_info::unquote): New function.
7381         (Version_script_info::add_exact_match): New function.
7382         (Version_script_info::build_expression_list_lookup): Remove lookup
7383         parameter.  Add is_global parameter.  Change all callers.  Handle
7384         wildcard pattern specially.  Unquote pattern.  Call
7385         add_exact_match.
7386         (Version_script_info::get_name_to_match): New function.
7387         (Version_script_info::get_symbol_version): New function.
7388         (Version_script_info::get_symbol_version_helper): Remove.
7389         (Version_script_info::check_unmatched_names): Call unquote.
7390         * script.h (class Version_script_info): Change get_symbol_version
7391         to be non-inline and add is_global parameter; change all callers.
7392         Rewrite symbol_is_local.  Update declarations.  Define struct
7393         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7394         Remove globals_ and locals_ members.  Add exact_, globs_,
7395         default_version_, is_global_.
7396         (Version_script_info::Glob): Remove pattern, add expression and
7397         is_global.  Update constructor.  Change all callers.
7398         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7399         default version.
7400         (Versions::symbol_section_contents): If a symbol is undefined, or
7401         defined in a dynamic object, set the version index to
7402         VER_NDX_LOCAL.
7403         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7404         symbol_is_local.
7405         (Symbol_table::add_from_pluginobj): Likewise.
7406         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7407
7408 2010-01-11  Doug Kwan  <dougkwan@google.com>
7409
7410         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7411         (incremental_dump_LDADD): Add linking option for libintl.
7412         * Makefile.in: Regenerate.
7413
7414 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7415
7416         PR gold/11144
7417         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7418         instead of -Ds.
7419         * testsuite/Makefile.in: Regenerated.
7420
7421 2010-01-10  Doug Kwan  <dougkwan@google.com>
7422
7423         * options.h (DEFINE_var): Use parentheses around argument varname__
7424         in macro body to avoid any unintended subsequent substitutions.
7425
7426 2010-01-10  Ian Lance Taylor  <iant@google.com>
7427
7428         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7429         candidates before doing symbol resolution.
7430
7431         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7432         ODR candidates if only one is weak.
7433
7434 2010-01-08  Ian Lance Taylor  <iant@google.com>
7435
7436         * script.cc (Version_script_info::build_expression_list_lookup):
7437         Don't warn about ambiguous version, just record the ambiguity.
7438         (Version_script_info::get_symbol_version_helper): Give error if
7439         version is ambiguous.
7440
7441 2010-01-08  Doug Kwan  <dougkwan@google.com>
7442
7443         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7444         prev_data_size_ and prev_addralign_.  Remove initializer for
7445         deleted data member has_been_changed_.
7446         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7447         to determine if the table is empty.
7448         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7449         Remove.
7450         (Stub_table::add_reloc_stub): Define method in class definition
7451         instead of just declaring it there.
7452         (Stub_table::add_cortex_a8_stub): New method definition.
7453         (Stub_table::update_data_size_and_addralign): Ditto.
7454         (Stub_table::finalize_stubs): Ditto.
7455         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7456         (Stub_table::do_addralign_): Return address alignment in the
7457         (Stub_table::do_reset_address_and_file_offset): Define method in
7458         class definition instead of declaring it there.  Set current data
7459         size to be the data size of the previous pass.
7460         (Stub_table::set_final_data_size): Use current data size as the
7461         final data size.
7462         (Stub_table::relocate_stub): Change parameter type of stub from
7463         Reloc_stub pointer to Stub pointer.
7464         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7465         (Stub_table::Cortex_a8_stub_list): New typedef.
7466         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7467          Stub_table::prev_addralign_): New data member.
7468         (Arm_relobj::Arm_relobj): Initialize data member
7469         section_has_cortex_a8_workaround_.
7470         (Arm_relobj::section_has_cortex_a8_workaround,
7471          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7472          definitions.
7473         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7474         declarations.
7475         (Target_arm::relocate_stub): Change parameter type of stub from
7476         Reloc_stub pointer to Stub pointer.
7477         (Insn_template::size, Insn_template::alignment): Handle
7478         THUMB16_SPECIAL_TYPE.
7479         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
7480          Stub_table::update_data_size_and_addralign,
7481          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
7482         definitions.
7483         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
7484         (Stub_table::do_write): Ditto.
7485         (Target_arm::do_relax): Adjust code for changes in Stub_table.
7486
7487 2010-01-08  Ian Lance Taylor  <iant@google.com>
7488
7489         PR 11108
7490         * symtab.h (class Symbol): Remove fields is_target_special_ and
7491         has_plt_offset_.  Add field is_defined_in_discarded_section_.
7492         (Symbol::is_defined_in_discarded_section): New function.
7493         (Symbol::set_is_defined_in_discarded_section): New function.
7494         (Symbol::has_plt_offset): Rewrite.
7495         (Symbol::set_plt_offset): Verify that new offset is not -1U.
7496         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
7497         Don't initialize is_target_special_ or has_plt_offset_.
7498         Initialize is_defined_in_discarded_section_.
7499         (Symbol_table::add_from_relobj): If appropriate, set
7500         is_defined_in_discarded_section.
7501         * resolve.cc (Symbol::override_base_with_special): Don't test
7502         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
7503         * target-reloc.h (relocate_section): Do special handling for
7504         symbols defined in discarded sections for global symbols as well
7505         as local symbols.
7506
7507 2010-01-08  Ian Lance Taylor  <iant@google.com>
7508
7509         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
7510         the SHT_SYMTAB case.
7511
7512 2010-01-08  Ian Lance Taylor  <iant@google.com>
7513
7514         * object.cc (Sized_relobj::do_layout): Don't get confused if
7515         layout_eh_frame returns NULL.
7516
7517 2010-01-08  Ian Lance Taylor  <iant@google.com>
7518
7519         PR 11084
7520         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
7521         dynamic symbol table, use the normal symbol table.
7522         (Sized_dynobj::do_read_symbols): Remove assertion about type of
7523         symbol table.
7524
7525 2010-01-08  Ian Lance Taylor  <iant@google.com>
7526
7527         PR 11072
7528         * layout.cc (Layout::include_section): Remove .gnu_debuglink
7529         sections.
7530
7531 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
7532
7533         * version.cc (print_version): Change to "Copyright 2010".
7534
7535 2010-01-08  Ian Lance Taylor  <iant@google.com>
7536
7537         PR 10287
7538         PR 11063
7539         * i386.cc (class Target_i386): Change return type of plt_section
7540         to be non-const.
7541         (class Output_data_plt_i386): Add tls_desc_rel_ field.
7542         (Output_data_plt_i386::Output_data_plt_i386): Initialize
7543         tls_desc_rel_ field.
7544         (Output_data_plt_i386::rel_tls_desc): New function.
7545         (Target_i386::rel_tls_desc_section): New function.
7546         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
7547         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
7548         R_386_TLS_DESC reloc in rel_tls_desc_section.
7549         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
7550         Define struct Tlsdesc_info.
7551         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
7552         (Target_x86_64::do_reloc_symbol_index): New function.
7553         (Target_x86_64::add_tlsdesc_info): New function.
7554         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
7555         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
7556         tlsdesc_rel_ field.
7557         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
7558         all callers.
7559         (Output_data_plt_x86_64::rela_tlsdesc): New function.
7560         (Target_x86_64::rela_tlsdesc_section): New function.
7561         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
7562         handling.
7563         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
7564         (Target_x86_64::do_reloc_addend): New function.
7565         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
7566         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
7567         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
7568         (Output_reloc::type): New function.
7569         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
7570         (Output_reloc::is_target_specific): New function.
7571         (Output_reloc::target_arg): New function.
7572         (class Output_reloc) [SHT_RELA]: Add four new constructors for
7573         absolute relocs and target specific relocs.
7574         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
7575         add_target_specific.
7576         (class Output_data_reloc) [SHT_RELA]: Likewise.
7577         * output.cc (Output_reloc::Output_reloc): Add four new versions
7578         for absolute relocs and target specific relocs.
7579         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
7580         (Output_reloc::get_symbol_index): Likewise.
7581         (Output_reloc::local_section_offset): Check that local_sym_index_
7582         is not TARGET_CODE or 0.
7583         (Output_reloc::symbol_value): Likewise.
7584         (Output_reloc::write) [SHT_RELA]: Call target for target specific
7585         reloc.
7586         * target.h (class Target): Add reloc_symbol_index and reloc_addend
7587         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
7588         functions.
7589         * layout.cc (add_target_dynamic_tags): Use output section for
7590         DT_PLTRELSZ and DT_JMPREL.
7591
7592 2010-01-07  Ian Lance Taylor  <iant@google.com>
7593
7594         PR 11061
7595         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
7596         function.
7597         (class Output_data_reloc_generic): Define.
7598         (class Output_data_reloc_base): Change base class to
7599         Output_data_reloc_generic.  Change add() method to call
7600         bump_relative_reloc_count for a relative reloc.  Remove
7601         sort_relocs_ field.
7602         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
7603         to sort_relocs().
7604         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
7605         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
7606         appropriate.
7607         * layout.h (class Layout): Update declaration.
7608
7609 2010-01-07  Ian Lance Taylor  <iant@google.com>
7610
7611         * output.h (class Output_data): Add const version of
7612         output_section and do_output_section.
7613         (class Output_section_data): Add const version of
7614         do_output_section.
7615         (class Output_section): Likewise.
7616         * layout.cc (Layout::add_target_dynamic_tags): New function.
7617         * layout.h (class Layout): Update declarations.
7618         * arm.cc (Target_arm::do_finalize_sections): Use
7619         add_target_dynamic_tags.
7620         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7621         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
7622         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
7623         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7624
7625 2010-01-07  Ian Lance Taylor  <iant@google.com>
7626
7627         PR 11042
7628         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
7629         object as needed.
7630
7631 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
7632             Ian Lance Taylor  <iant@google.com>
7633
7634         PR 11019
7635         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
7636         Xindex::read_symtab_xindex.
7637
7638 2010-01-07  Doug Kwan  <dougkwan@google.com>
7639
7640         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
7641         (Insn_template::thumb16_bcond_insn): New method declaration.
7642         (Insn_template): Fix spelling.
7643         (Stub::thumb16_special): New method declaration.
7644         (Stub::do_write): Define virtual method which was previously pure
7645         virtual.
7646         (Stub::do_thumb16_special): New method declaration.
7647         (Stub::do_fixed_endian_write): New template member.
7648         (Reloc_stub::do_write): Remove.
7649         (Reloc_stub::do_fixed_endian_write): Remove.
7650         (Cortex_a8_stub): New class definition.
7651         (Stub_factory::make_cortex_a8_stub): New method definition.
7652         (Stub_factory::Stub_factory): Add missing static storage class
7653         qualifier for elf32_arm_stub_a8_veneer_blx.
7654
7655 2010-01-07  Ian Lance Taylor  <iant@google.com>
7656
7657         PR 10980
7658         * options.h (class General_options): Add --warn-unresolved-symbols
7659         and --error-unresolved-symbols.
7660         * errors.cc (Errors::undefined_symbol): Implement
7661         --warn-unresolved-symbols.
7662
7663         * options.h (class General_options): Add -z text and -z textoff.
7664         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
7665
7666 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
7667
7668         * gc.h (Garbage_collection::Cident_section_map): New typedef.
7669         (Garbage_collection::cident_sections): New function.
7670         (Garbage_collection::add_cident_section): New function.
7671         (Garbage_collection::cident_sections_): New member.
7672         (gc_process_relocs): Add references to sections whose names are C
7673         identifiers.
7674         * gold.h (cident_section_start_prefix): New constant.
7675         (cident_section_stop_prefix): New constant.
7676         (is_cident): New function.
7677         * layout.cc (Layout::define_section_symbols): Replace string constants
7678         with the newly defined constants.
7679         * object.cc (Sized_relobj::do_layout): Track sections whose names are
7680         C identifiers.
7681         * testsuite/Makefile.am: Add gc_orphan_section_test.
7682         * testsuite/Makefile.in: Regenerate.
7683         * testsuite/gc_orphan_section_test.cc: New file.
7684         * testsuite/gc_orphan_section_test.sh: New file.
7685
7686 2010-01-06  Ian Lance Taylor  <iant@google.com>
7687
7688         PR 10980
7689         * options.h (class General_options): Add --warn-shared-textrel.
7690         * layout.cc (Layout::finish_dynamic_section): Implement
7691         --warn-shared-textrel.
7692
7693         PR 10980
7694         * options.h (class General_options): Add --warn-multiple-gp.
7695
7696 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7697
7698         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
7699         $(THREADSLIB) and $(LIBDL).
7700         * Makefile.in: Rebuild.
7701
7702 2010-01-06  Ian Lance Taylor  <iant@google.com>
7703
7704         PR 10980
7705         * options.cc (General_options::parse_section_start): New function.
7706         (General_options::section_start): New function.
7707         (General_options::General_options): Initialize all members.
7708         * options.h: Include <map>
7709         (class General_options): Add --section-start.  Add section_starts_
7710         member.
7711         * layout.cc (Layout::attach_allocated_section_to_segment): If
7712         --section-start was used, set the address of the segment.  Remove
7713         local sort_sections.
7714         (Layout::relaxation_loop_body): If the address of the load segment
7715         has been set by --section-start, don't use it.
7716         * output.h (Output_segment::update_flags_for_output_section): New
7717         function.
7718         * output.cc (Output_segment::add_output_section): Call
7719         update_flags_for_output_section.
7720
7721 2010-01-05  Ian Lance Taylor  <iant@google.com>
7722
7723         PR 10980
7724         * options.h (class General_options): Add --undefined-version.
7725         * script.cc (struct Version_expression): Add was_matched_by_symbol
7726         field.
7727         (Version_script_info::matched_symbol): New function.
7728         (Version_script_info::get_symbol_version_helper): Call
7729         matched_symbol.
7730         (Version_script_info::check_unmatched_names): New function.
7731         * script.h (class Version_script_info): Update declarations.
7732         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
7733
7734         * options.h (class General_options): Use DEFINE_bool_alias for
7735         allow_multiple_definition.
7736         * resolve.cc (Symbol_table::should_override): Don't test
7737         allow_multiple_definition.
7738
7739         PR 10980
7740         * options.h (class General_options): Add --cref.
7741         * main.cc (main): Print cref table if --cref.  Don't close mapfile
7742         until after printing cref table.
7743         * cref.cc: Include "symtab.h".
7744         (class Cref_inputs): Define Cref_table_compare and Cref_table.
7745         (Cref_table_compare::operator()): New function.
7746         (Cref_inputs::gather_cref): New function.
7747         (filecol): New static const.
7748         (Cref_inputs::print_cref): New function.
7749         (Cref::print_cref): New function.
7750         * cref.h: Include <cstdio>.
7751         (class Cref): Update declarations.
7752         * mapfile.h (Mapfile::file): New function.
7753         * object.h (class Object): Define Symbols.  Declare virtual
7754         do_get_global_symbols.
7755         (Object::get_global_symbols): New function.
7756         * object.cc (Input_objects::add_object): Pass object to cref_ if
7757         --cref.
7758         (Input_objects::archive_start): Likewise.
7759         (Input_objects::archive_stop): Likewise.
7760         (Input_objects::print_cref): New function.
7761         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
7762         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
7763         --cref.
7764         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
7765         function.
7766         * plugin.h (class Sized_pluginobj): Update declarations.
7767
7768 2010-01-05  Ian Lance Taylor  <iant@google.com>
7769
7770         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
7771         to is_default_version.  Rename insdef to insdefault.
7772         (Symbol_table::add_from_relobj): Rename def to is_default_version
7773         and local to is_forced_local.
7774         (Symbol_table::add_from_pluginobj): Likewise.
7775         (Symbol_table::add_from_dynobj): Likewise.
7776         (Symbol_table::define_special_symbol): Rename insdef to
7777         insdefault.
7778
7779 2010-01-04  Ian Lance Taylor  <iant@google.com>
7780
7781         PR 10980
7782         * options.h (class General_options): Add
7783         --allow-multiple-definition and -z muldefs.
7784         * resolve.cc (Symbol_table::should_override): Don't warn about a
7785         multiple symbol definition if --allow-multiple-definition or -z
7786         muldefs.
7787
7788         PR 10980
7789         * options.h (class General_options): Add --add-needed and
7790         --copy-dt-needed-entries.  Tweak --as-needed help entry.
7791         * object.cc (Input_objects::check_dynamic_dependencies): Give an
7792         error if --copy-dt-needed-entries aka --add-needed is used and
7793         would cause a change in behaviour.
7794
7795         PR 10980
7796         * options.h (class General_options): Add -G as a short version of
7797         --shared.  Add no-op options -assert, -g, and -i.
7798
7799 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
7800
7801         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
7802         check for .text or .gnu.linkonce.t sections.
7803         * icf.cc (Icf::find_identical_sections): Ditto.
7804         Change the detection for mangled function name within the section
7805         name.
7806         * icf.h (is_section_foldable_candidate): New function.
7807
7808 2009-12-30  Ian Lance Taylor  <iant@google.com>
7809
7810         PR 10980
7811         * options.h (class General_options): Permit two dashes with
7812         --retain-symbols-file.
7813
7814 2009-12-30  Ian Lance Taylor  <iant@google.com>
7815
7816         PR 10979
7817         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
7818         don't put the file header and segment headers in the text
7819         segment.
7820
7821         PR 10979
7822         * common.cc (Sort_commons::operator()): Stabilize sort when both
7823         entries are NULL.
7824         (Symbol_table::do_allocate_commons_list): When allocating common
7825         symbols, skip a symbol which is no longer common.
7826         * symtab.h (Symbol::is_common): Test whether the symbol comes from
7827         an object before checking its type.
7828         * testsuite/common_test_2.c: New file.
7829         * testsuite/common_test_3.c: New file.
7830         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
7831         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
7832         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
7833         (common_test_2_pic.o, common_test_2.so): New targets.
7834         (common_test_3_pic.o, common_test_3.so): New targets.
7835         * testsuite/Makefile.in: Rebuild.
7836
7837         PR 10979
7838         * script.cc (read_input_script): If we see a new SECTIONS clause,
7839         and we have added an input section, give an error.
7840         * layout.h (class Layout): Add have_added_input_section function.
7841         Add have_added_input_section_ field.
7842         * layout.cc (Layout::Layout): Initialize
7843         have_added_input_section_.
7844         (Layout::layout): Set have_added_input_section_.
7845         (Layout::layout_eh_frame): Likewise.
7846
7847 2009-12-30  Ian Lance Taylor  <iant@google.com>
7848
7849         PR 10931
7850         * options.h (class General_options): Add --sort-common option.
7851         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
7852         * common.cc (Sort_common): Add sort_order parameter to
7853         constructor.  Add sort_order_ field.
7854         (Sort_commons::operator): Check sort_order_.
7855         (Symbol_table::allocate_commons): Determine the sort order.
7856         (Symbol_table::do_allocate_commons): Add sort_order parameter.
7857         Change all callers.
7858         (Symbol_table::do_allocate_commons_list): Likewise.
7859
7860 2009-12-30  Ian Lance Taylor  <iant@google.com>
7861
7862         PR 10916
7863         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
7864         symbols from this object, don't change the visibility of an
7865         undefined symbol.
7866         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
7867
7868 2009-12-30  Ian Lance Taylor  <iant@google.com>
7869
7870         PR 10861
7871         * script.h (class Version_script_info): Define Language enum.
7872         Update declarations.  Define Glob, Exact, and Lookup types.  Add
7873         new fields globals_, locals_, and is_finalized_.
7874         * script.cc: Various formatting fixes.
7875         (class Parser_closure): Change language_stack_ from a vector of
7876         std::string to one of Version_script_info::Language.  Adjust all
7877         uses accordingly.
7878         (class Lazy_demangler): Remove.
7879         (struct Version_expression): Change language from std::string to
7880         Version_script_info::Language.
7881         (Version_script_info::Version_script_info): New function.
7882         (Version_script_info::~Version_script_info): Don't call clear.
7883         (Version_script_info::finalize): New function.
7884         (Version_script_info::build_lookup_tables): New function.
7885         (Version_script_info::build_expression_list_lookup): New
7886         function.
7887         (Version_script_info::get_symbol_version_helper): Rewrite to use
7888         lookup tables.
7889         (Version_script_info::print_expression_list): Adjust to use
7890         Version_script_info::Language.
7891         (script_push_lex_into_version_mode): Check that the version script
7892         has not been finalized.
7893         (version_script_push_lang): Change language string to
7894         Version_script_info::Language.
7895         * options.cc (Command_line::version_script): New function.
7896         * options.h (class General_options): Add finalize_dynamic_list
7897         function.  Change version_script from declaration to definition.
7898         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
7899         * testsuite/version_script.map: Remove duplicate def of foo.
7900         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
7901         version_script.map.
7902         * testsuite/Makefile.in: Rebuild.
7903
7904 2009-12-30  Ian Lance Taylor  <iant@google.com>
7905
7906         PR 10843
7907         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
7908         if the input symbol index is 0, make the output symbol index 0.
7909
7910 2009-12-30  Ian Lance Taylor  <iant@google.com>
7911
7912         PR 10670
7913         * options.h (class General_options): Add -x/--discard-all.
7914         * object.cc (Sized_relobj::do_count_local_symbols): Handle
7915         --discard-all.  If the local symbol needs a dynamic entry, check
7916         that before handling --discard-locals.
7917
7918 2009-12-30  Ian Lance Taylor  <iant@google.com>
7919
7920         PR 10450
7921         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
7922         flags to PF_R.
7923         (Output_segment::add_output_section): Don't change the flags if
7924         the type is PT_TLS.
7925
7926         PR 10450
7927         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
7928         GNU hash table if they need a dynamic value.  Otherwise, don't add
7929         them if they are defined in a dynamic object or are forced local.
7930
7931 2009-12-29  Ian Lance Taylor  <iant@google.com>
7932
7933         PR 10450
7934         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
7935         .gnu.hash table for a 32-bit target.
7936
7937         PR 10450
7938         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
7939         regular and a dynamic object only needs a dynamic symbol table
7940         entry if it is externally visible.
7941
7942         PR 10450
7943         * i386.cc (class Target_i386): Initialize global_offset_table_ in
7944         constructor.  Add global_offset_table_ field.
7945         (Target_i386::got_section): Set global_offset_table_.
7946         (Target_i386::do_finalize_sections): Set global_offset_table_
7947         size.
7948         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
7949         in constructor.  Add global_offset_table_ field.
7950         (Target_x86_64::got_section): Set global_offset_table_.
7951         (Target_x86_64::do_finalize_sections): Set global_offset_table_
7952         size.
7953
7954         * layout.cc (Layout::Layout): Initialize increase_relro_.
7955         (Layout::get_output_section): Add is_relro, is_last_relro, and
7956         is_first_non_relro parameters.  Change all callers.
7957         (Layout::choose_output_section): Likewise.
7958         (Layout::add_output_section_data): Likewise.
7959         (Layout::make_output_section): Likewise.
7960         (Layout::set_segment_offsets): Clear increase_relro when using a
7961         linker script.
7962         * layout.h (class Layout): Add increase_relro method.  Add
7963         increase_relro_ field.  Update declarations.
7964         * output.cc (Output_section::Output_section): Initialize
7965         is_last_relro_ and is_first_non_relro_.
7966         (Output_segment::add_output_section): Group relro sections is
7967         do_sort is true.  Handle is_last_relro and is_first_non_relro.
7968         (Output_segment::maximum_alignment): Remove relro handling.
7969         (Output_segment::set_section_addresses): Add increase_relro
7970         parameter.  Change all callers.  Add initial alignment to align
7971         relro sections on separate page.  Remove old relro handling.
7972         (Output_segment::set_section_list_addresses): Remove in_relro
7973         parameter.  Change all callers.
7974         (Output_segment::set_offset): Add increase parameter.  Change all
7975         callers.  Remove old relro handling.
7976         * output.h (class Output_section): Add new methods: is_last_relro,
7977         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
7978         Add is_last_relro_ and is_first_non_relro_ fields.
7979         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
7980         Create separate .got.plt section.  Call increase_relro.
7981         * x86_64.cc (Target_x86_64::got_section): Likewise.
7982         * testsuite/relro_script_test.t: Add .got.plt.
7983
7984         PR 10450
7985         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
7986         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
7987         (Layout::finalize): Call set_dynamic_symbol_size.
7988         (Layout::set_dynamic_symbol_size): New function.
7989         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
7990         set_dynamic_symbol_size.
7991
7992         PR 10450
7993         * output.h (class Output_section): Add is_entsize_zero_ field.
7994         * output.cc (Output_section::Output_section): Initialize
7995         is_entsize_zero_.
7996         (Output_section::set_entsize): If two different entsizes are
7997         requested, force it to zero.
7998         (Output_section::add_input_section): Set flags for .debug_str
7999         before updating section flags.  Set entsize.
8000         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8001         and SHF_STRING if all input sections have those flags.
8002
8003 2009-12-29   Rafael Espindola  <espindola@google.com>
8004
8005         * main.cc (main): Fix the sys time reporting.
8006         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8007         reporting.
8008
8009 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8010
8011         * options.cc (General_options::parse_version): Allow -v to exit
8012         without an error if there is nothing to link.
8013
8014 2009-12-29  Ian Lance Taylor  <iant@google.com>
8015
8016         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8017         using a version of gcc before 4.1.
8018         * configure: Rebuild.
8019
8020 2009-12-28  Chris Demetriou  <cgd@google.com>
8021
8022         * attributes.cc (Output_attributes_section_data::do_write): Use
8023         std::vector::front rather than std::vector::data.
8024
8025 2009-12-28  Ian Lance Taylor  <iant@google.com>
8026
8027         * symtab.h (class Symbol_table): Add enum Defined.
8028         * resolve.cc (Symbol_table::should_override): Add defined
8029         parameter.  Change all callers.  Test whether object is NULL
8030         before calling a method on it.
8031         (Symbol_table::report_resolve_problem): Add defined parameter.
8032         Change all callers.
8033         (Symbol_table::should_override_with_special): Likewise.
8034         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8035         parameter.  Change all callers.
8036         (Symbol_table::do_define_in_output_data): Likewise.
8037         (Symbol_table::define_in_output_segment): Likewise.
8038         (Symbol_table::do_define_in_output_segment): Likewise.
8039         (Symbol_table::define_as_constant): Likewise.
8040         (Symbol_table::do_define_as_constant): Likewise.
8041         * script.h (class Symbol_assignment): Add is_defsym parameter to
8042         constructor; change all callers.
8043         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8044         parameter.  Change all callers.  Add is_defsym_ field.
8045         (class Parser_closure): Add parsing_defsym parameter to
8046         constructor; change all callers.  Add parsing_defsym accessor
8047         function.  Add parsing_defsym_ field.
8048
8049 2009-12-28  Ian Lance Taylor  <iant@google.com>
8050
8051         * gold.cc (queue_middle_tasks): Fix formatting.
8052         * object.cc (Relobj::is_section_name_included): Likewise.
8053
8054 2009-12-23  Ian Lance Taylor  <iant@google.com>
8055
8056         * i386.cc (Target_i386::do_calls_non_split): Recognize
8057         -fsplit-stack prologue for a function with a static chain.
8058         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8059         -fsplit-stack prologue when using %r11.
8060
8061 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8062
8063         * options.cc (General_options::parse_version): Make -v continue and do
8064         the link like GNU ld does.
8065
8066 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8067
8068         * Makefile.am (CCFILES): Add timer.cc.
8069         (HFILES): Add timer.h.
8070         * configure.ac: Check for sysconf and times.
8071         * main.cc: include timer.h.
8072         (main): Use Timer instead of get_run_time.
8073         * timer.cc: New.
8074         * timer.h: New.
8075         * workqueue.cc: include timer.h.
8076         (Workqueue::find_and_run_task):
8077         Report user, sys and wall time.
8078         * Makefile.in: Regenerate.
8079         * config.in: Regenerate.
8080         * configure: Regenerate.
8081
8082 2009-12-16  Doug Kwan  <dougkwan@google.com>
8083
8084         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8085         sections.
8086         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8087         relaxed input sections.
8088         * output.cc (Output_section::find_relaxed_input_section): Change
8089         return type to Output_relaxed_input_section pointer.  Adjust code
8090         for new type of relaxed_input_section_map_.
8091         * output.h (Output_section::find_relaxed_input_section): Change
8092         return type to Output_relaxed_input_section pointer.
8093         (Output_section::Output_relaxed_input_section_by_input_section_map):
8094         New type.
8095         (Output_section::relaxed_input_section_map_): Change type to
8096         Output_section::Output_relaxed_input_section_by_input_section_map.
8097         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8098         input section.
8099
8100 2009-12-15  Ian Lance Taylor  <iant@google.com>
8101
8102         * layout.cc (Layout::create_shstrtab): Only write out after input
8103         sections if we are compressing debug sections.
8104
8105 2009-12-15  Ian Lance Taylor  <iant@google.com>
8106
8107         * archive.cc (Archive::add_symbols): Only look up a symbol without
8108         a version if there is, in fact, a version.
8109
8110 2009-12-14  Ian Lance Taylor  <iant@google.com>
8111
8112         Revert -Wshadow changes, all changes from:
8113         2009-12-11  Doug Kwan  <dougkwan@google.com>
8114         2009-12-11  Nick Clifton  <nickc@redhat.com>
8115         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8116
8117 2009-12-11  Doug Kwan  <dougkwan@google.com>
8118
8119         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8120         due to -Wshadow.
8121         * attributes.cc (Object_attribute::size): Ditto.
8122         (Attributes_section_data::size): Ditto.
8123         (Attributes_section_data::Attributes_section_data): Ditto.
8124         (Output_attributes_section_data::do_write): Ditto.
8125         * attributes.h (Object_attribute::set_type): Ditto.
8126         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8127
8128 2009-12-11  Nick Clifton  <nickc@redhat.com>
8129
8130         * archive.cc: Fix shadowed variable warnings.
8131         * arm.cc: Likewise.
8132         * compressed_output.cc: Likewise.
8133         * compressed_output.h: Likewise.
8134         * configure: Likewise.
8135         * dwarf_reader.cc: Likewise.
8136         * dynobj.cc: Likewise.
8137         * dynobj.h: Likewise.
8138         * ehframe.cc: Likewise.
8139         * ehframe.h: Likewise.
8140         * errors.cc: Likewise.
8141         * expression.cc: Likewise.
8142         * fileread.cc: Likewise.
8143         * fileread.h: Likewise.
8144         * freebsd.h: Likewise.
8145         * i386.cc: Likewise.
8146         * icf.cc: Likewise.
8147         * incremental.h: Likewise.
8148         * layout.cc: Likewise.
8149         * layout.h: Likewise.
8150         * mapfile.cc: Likewise.
8151         * merge.cc: Likewise.
8152         * merge.h: Likewise.
8153         * object.cc: Likewise.
8154         * object.h: Likewise.
8155         * options.h: Likewise.
8156         * output.cc: Likewise.
8157         * output.h: Likewise.
8158         * parameters.cc: Likewise.
8159         * plugin.cc: Likewise.
8160         * powerpc.cc: Likewise.
8161         * reduced_debug_output.cc: Likewise.
8162         * reduced_debug_output.h: Likewise.
8163         * reloc.cc: Likewise.
8164         * reloc.h: Likewise.
8165         * resolve.cc: Likewise.
8166         * script-sections.cc: Likewise.
8167         * script.cc: Likewise.
8168         * script.h: Likewise.
8169         * sparc.cc: Likewise.
8170         * symtab.cc: Likewise.
8171         * symtab.h: Likewise.
8172         * target-select.cc: Likewise.
8173         * target-select.h: Likewise.
8174         * token.h: Likewise.
8175         * workqueue.cc: Likewise.
8176         * workqueue.h: Likewise.
8177         * x86_64.cc: Likewise.
8178
8179 2009-12-10  Doug Kwan  <dougkwan@google.com>
8180
8181         * arm.cc (attributes.h): New include.
8182         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8183         (Arm_relobj::~Arm_relobj): Delete object pointed by
8184         attributes_section_data_.
8185         (Arm_relobj::attributes_section_data): New method definition.
8186         (Arm_relobj::attributes_section_data_): New data member declaration.
8187         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8188         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8189         attributes_section_data_.
8190         (Arm_dynobj::attributes_section_data): New method definition.
8191         (Arm_dynobj::attributes_section_data_): New data member declaration.
8192         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8193         initialization value of may_use_blx_ to false.
8194         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8195         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8196         object attributes to compute results instead of hard-coding.
8197         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8198         Target_arm::get_secondary_compatible_arch,
8199         Target_arm::set_secondary_compatible_arch
8200         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8201         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8202         New method declarations.
8203         (Target_arm::get_aeabi_object_attribute): New method definition.
8204         (Target_arm::attributes_section_data_): New data member declaration.
8205         (read_arm_attributes_section): New template definition.
8206         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8207         (Arm_dynobj::do_read_symbols): Ditto.
8208         (Target_arm::do_finalize_sections): Merge attributes sections from
8209         input.  Check for BLX use after attributes section merging.
8210         Fix __exidx_start and __exidx_end visibility.  Create an
8211         .ARM.attributes section if necessary.
8212         (Target_arm::get_secondary_compatible_arch,
8213         Target_arm::set_secondary_compatible_arch,
8214         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8215         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8216         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8217         New method definitions.
8218
8219 2009-12-09  Ian Lance Taylor  <iant@google.com>
8220
8221         * plugin.cc (Plugin::load): Don't cast from void* to a function
8222         pointer.
8223
8224 2009-12-09  Ian Lance Taylor  <iant@google.com>
8225
8226         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8227         information fields.
8228
8229 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8230
8231         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8232         Replace two_file_shared_1.so with two_file_shared_2.so.
8233         * testsuite/Makefile.in: Regenerated.
8234
8235 2009-12-08  Doug Kwan  <dougkwan@google.com>
8236
8237         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8238         (HFILES): Add attributes.h and int_encoding.h.
8239         * Makefile.in: Regenerate.
8240         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8241         function definitions to int_encoding.cc
8242         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8243         prototypes to int_encoding.h
8244         * reduced_debug_output.cc (int_encoding.h): New include.
8245         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8246         function definitions to int_encoding.cc
8247         (insert_into_vector, read_from_pointer): Move template definitions to
8248         int_encoding.h
8249         * attributes.cc: New file.
8250         * attributes.h: New file.
8251         * int_encoding.cc: New file.
8252         * int_encoding.h: New file.
8253
8254 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8255
8256         PR gold/11055
8257         * incremental-dump.cc (dump_incremental_inputs): New.
8258         (main): Use dump_incremental_inputs.
8259
8260 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8261
8262         PR gold/10893
8263         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8264         checking elfcpp::STT_FUNC.
8265         (Target_i386::Relocate::relocate): Likewise.
8266         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8267
8268         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8269         symbols from shared libraries into normal FUNC symbols.
8270
8271         * symtab.h (Symbol): Add is_func and use it.
8272
8273 2009-12-05  Doug Kwan  <dougkwan@google.com>
8274
8275         * arm.cc (Target_arm::arm_info): Initialize new fields
8276         attributes_section and attributes_vendor.
8277         * i386.cc (Target_i386::i386_info): Same.
8278         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8279         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8280         fields attributes_section and attributes_vendor.
8281         * sparc.cc (Target_sparc::sparc_info): Same.
8282         * target.h (Target::attributes_section, Target::attributes_vendor,
8283         Target::is_attributes_section, Target::attribute_arg_type,
8284         Target::attributes_order): New method definitions.
8285         (Target::Target_info::attributes_section,
8286         Target::Target_info::attributes_vendor): New fields.
8287         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8288         virtual method definitions.
8289         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8290         attributes_section and attributes_vendor.
8291         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8292
8293 2009-12-05  Doug Kwan  <dougkwan@google.com>
8294
8295         * arm.cc: Update comments about interworking and stub generation.
8296         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8297         considered as non-PIC.
8298         (Arm_relocate_functions::base_abs): Fix formatting.
8299         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8300         of function to use GOT entry address instead of offset.
8301         (Target_arm::Scan::global): Issue an error if a symbol would need a
8302         PLT does not get one because it is untyped.  Remove code to create
8303         dynamic symbols for relative branches.
8304         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8305         takes unsigned integer instead of boolean.
8306
8307 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8308
8309         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8310         (two_file_test_LDADD): Likewise.
8311         (common_test_1_LDADD): Likewise.
8312         (exception_test_LDADD) Likewise.
8313         (weak_test_LDADD): Likewise.
8314         (many_sections_test_LDADD): Likewise.
8315         (initpri1_LDADD): Likewise.
8316         (script_test_1_LDADD): Likewise.
8317         (script_test_2_LDADD): Likewise.
8318         (justsyms_LDADD): Likewise.
8319         (binary_test_LDADD): Likewise.
8320         (large_LDADD): Likewise.
8321         * testsuite/Makefile.in: Regenerated.
8322
8323 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8324
8325         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8326         (Symbol_table::override_with_special): Likewise.
8327         (Symbol_table::add_from_object): Likewise.
8328
8329 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8330
8331         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8332         Don't set the data_offset twice.
8333
8334 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8335
8336         * testsuite/Makefile.in: Regenerate.
8337
8338 2009-12-03  Doug Kwan  <dougkwan@google.com>
8339
8340         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8341         (Target_arm::do_finalize_sections): Add parameter for symbol table
8342         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8343         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8344         parameter for symbol table pointer.
8345         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8346         an additional parameter for a pointer to symbol table.
8347         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8348         parameter for a symbol table pointer.
8349         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8350         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8351         Ditto.
8352         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8353         parameter for a symbol table pointer.
8354
8355 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8356
8357         * incremental.cc (Incremental_inputs_header)
8358         (Incremental_inputs_header_write, Incremental_inputs_entry)
8359         (Incremental_inputs_entry_write): Move ...
8360         * incremental.h (Incremental_inputs_header)
8361         (Incremental_inputs_header_write, Incremental_inputs_entry)
8362         (Incremental_inputs_entry_write): here.
8363
8364 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8365
8366         * incremental.cc (make_sized_incremental_binary): Set the target.
8367         Error if it is incompatible.
8368         * output.h (Output_file): Add filename method.
8369
8370 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8371
8372         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8373         from the get_* methods.
8374
8375 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8376
8377         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8378         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8379         Write 0 for the data_offset of scripts.
8380
8381 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8382
8383         * testsuite/Makefile.am: Add the incremental_test.sh test.
8384         * testsuite/incremental_test.sh: New.
8385         * testsuite/incremental_test_1.c: New.
8386         * testsuite/incremental_test_2.c: New.
8387
8388 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8389
8390         * incremental-dump.cc (main): Fix typos.
8391
8392 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8393
8394         PR gold/11025
8395         * incremental-dump.cc (main): Use llu to print 64 bit values.
8396
8397 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8398             H.J. Lu  <hongjiu.lu@intel.com>
8399
8400         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8401         $(LIBDL).
8402         (incremental_dump_LDADD): Likewise.
8403         * Makefile.in: Regenerated.
8404
8405 2009-11-25  Doug Kwan  <dougkwan@google.com>
8406
8407         Revert:
8408
8409         2009-11-25  Doug Kwan  <dougkwan@google.com>
8410
8411                 * arm.cc (Target_arm::Target_arm): Move method definition
8412                 outside of class definition.  Add code to handle
8413                 --target1-rel, --target1-abs and --target2= options.
8414                 (Target_arm::get_reloc_reloc_type): Change method to be
8415                 non-static and const.
8416                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8417                 New data member declaration.
8418                 (Target_arm::Scan::local, Target_arm::Scan::global,
8419                 Target_arm::Relocate::relocate,
8420                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8421                 Adjust call to Target_arm::get_real_reloc_type.
8422                 (Target_arm::get_real_reloc_type): Use command line options
8423                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8424                 * options.h (--target1-rel, --target1-abs, --target2): New
8425                 ARM-only options.
8426
8427 2009-11-25  Doug Kwan  <dougkwan@google.com>
8428
8429         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8430         class definition.  Add code to handle --target1-rel, --target1-abs
8431         and --target2= options.
8432         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8433         and const.
8434         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8435         member declaration.
8436         (Target_arm::Scan::local, Target_arm::Scan::global,
8437         Target_arm::Relocate::relocate,
8438         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8439         call to Target_arm::get_real_reloc_type.
8440         (Target_arm::get_real_reloc_type): Use command line options to
8441         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8442         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8443         options.
8444
8445 2009-11-25  Doug Kwan  <dougkwan@google.com>
8446
8447         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8448         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8449         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8450         formatting.
8451         (Arm_relocate_functions::thm_call): Replace body with a call to
8452         Arm_relocate_functions::thumb_branch_common.
8453         (Arm_relocate_functions::thm_jump24,
8454         Arm_relocate_functions::thm_xpc22): New method definitions.
8455         (Arm_relocate_functions::thumb_branch_common): New method definition.
8456         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8457         operator.
8458         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8459         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8460
8461 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8462
8463         * Makefile.am: Build incremental-dump
8464         * Makefile.in: Regenerate.
8465         * incremental-dump.cc: New.
8466         * incremental.cc (Incremental_inputs_header_data,
8467         Incremental_inputs_entry_data): Move to incremental.h
8468         * incremental.h: (Incremental_inputs_header_data,
8469         Incremental_inputs_entry_data): Move from incremental.cc
8470
8471 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8472
8473         * incremental.cc (Incremental_inputs_header,
8474         Incremental_inputs_header_write, Incremental_inputs_entry,
8475         Incremental_inputs_entry_write): Add a typedef with the data type.
8476
8477 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8478
8479         * incremental.cc (Incremental_inputs_header,
8480         Incremental_inputs_header_write, Incremental_inputs_entry,
8481         Incremental_inputs_entry_write): Update comment about which
8482         type has the filed descriptions.
8483
8484 2009-11-15  Doug Kwan  <dougkwan@google.com>
8485
8486         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
8487         (Arm_relocate_functions::arm_branch_common): Change method defintion
8488         in class definition to a method declaration and update list of formal
8489         parameters.
8490         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
8491         Arm_relocation_functions::jump24): Adjust call to
8492         Arm_relocate_functions::arm_branch_common.  Update list of formal
8493         parameters.
8494         (Arm_relocate_functions::xpc25): New method definition.
8495         (Arm_relocate_functions::arm_branch_common): Move method defintion
8496         out from class definition.  Use stubs for mode-switching and extending
8497         branch ranges.
8498         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
8499         specially.  Change code to enable use of stubs in ARM branches.
8500
8501 2009-11-10  Doug Kwan  <dougkwan@google.com>
8502
8503         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
8504         in method declaration.
8505         (Target_arm::relocate_stub): New method declaration.
8506         (Target_arm::default_target): Change to return a pointer instead of
8507         a const reference.
8508         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
8509         Target_arm::default_target.
8510         (Arm_Relobj::do_relocate_sections): Remove options paramater in
8511         method definition.
8512         (Target_arm::relocate_section): Adjust view.
8513         (Target_arm::relocate_stub): New method definition.
8514
8515 2009-11-10  Doug Kwan  <dougkwan@google.com>
8516
8517         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
8518         a format warning.
8519         * incremental.cc (open_incremental_binary): Initialized local
8520         variables to avoid warnings.
8521         * object.cc (make_elf_object): Ditto.
8522         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
8523         a format warning.
8524
8525 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
8526
8527         PR gold/10930
8528         * testsuite/plugin_test.c: Include "config.h".
8529
8530 2009-11-09  Doug Kwan  <dougkwan@google.com>
8531
8532         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
8533         (arm_symbol_value): Remove.
8534         (Arm_relocate_functions::arm_branch_common,
8535         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
8536         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
8537         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
8538         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
8539         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
8540         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
8541         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
8542         Arm_relocate_functions::thm_mobw_abs_nc,
8543         Arm_relocate_functions::thm_mov_abs,
8544         Arm_relocate_functions::movw_prel_nc,
8545         Arm_relocate_functions::thm_movt_abs,
8546         Arm_relocate_functions::movt_prel,
8547         Arm_relocate_functions::thm_movw_prel_nc,
8548         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
8549         (Target_arm::Relocate::relocate): Only decompose address into two
8550         parts if relocation type uses the thumb-bit and pass the actual
8551         bit instead of a flag indicating that the thumb-bit is used.  Adjust
8552         calls to methods in Arm_relocate_functions for this change.
8553
8554 2009-11-08  Ian Lance Taylor  <iant@google.com>
8555
8556         PR 10925
8557         * reloc.cc: Instantiate
8558         Sized_relobj::initialize_input_to_output_maps and
8559         Sized_relobj:free_input_to_output_maps.
8560
8561 2009-11-06  Ian Lance Taylor  <iant@google.com>
8562
8563         PR 10876
8564         * defstd.cc (in_segment): Set only_if_ref true for "end".
8565
8566 2009-11-06  Doug Kwan  <dougkwan@google.com>
8567
8568         * arm.cc (class Reloc_stub): Correct a comment.
8569         (Target_arm::Target_arm): Initialize arm_input_section_map_.
8570         (Target_arm::scan_section_for_stubs): New method declaration.
8571         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
8572         Change methods from private to protected.
8573         (Target_arm::do_may_relax): New method definition.
8574         (Target_arm::do_relax, Target_arm::group_sections,
8575         Target_arm::scan_reloc_for_stub,
8576         Target_arm::scan_reloc_section_for_stubs): New method declarations.
8577         (Target_arm::arm_input_section_map_): New data member declaration.
8578         (Target_arm::scan_reloc_for_stub,
8579         Target_arm::scan_reloc_section_for_stubs,
8580         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
8581         Target_arm::do_relax): New method definitions.
8582
8583 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
8584
8585         * configure.ac: Check for (struct stat)::st_mtim
8586         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
8587         * config.in: Regenerate.
8588         * configure: Regenerate.
8589
8590 2009-11-05  Ian Lance Taylor  <iant@google.com>
8591
8592         PR 10910
8593         * output.cc (Output_segment::add_output_section): Add missing
8594         return statement.
8595
8596 2009-11-04  Ian Lance Taylor  <iant@google.com>
8597
8598         PR 10880
8599         * object.h (class Object): Add is_needed and set_is_needed
8600         methods.  Add is_needed_ field.  Make bool fields into bitfields.
8601         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
8602         defined in a dynamic object and referenced by a regular object,
8603         set is_needed for the dynamic object.
8604         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
8605         if the file is marked with as_needed and it is not needed.
8606
8607 2009-11-04  Ian Lance Taylor  <iant@google.com>
8608
8609         PR 10887
8610         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
8611         tags if data is discarded by linker script.
8612         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8613         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8614         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8615         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8616
8617 2009-11-04  Ian Lance Taylor  <iant@google.com>
8618
8619         * layout.cc (Layout::get_output_section): Add is_interp and
8620         is_dynamic_linker_section parameters.  Change all callers.
8621         (Layout::choose_output_section): Likewise.
8622         (Layout::make_output_section): Likewise.
8623         (Layout::add_output_section_data): Add is_dynamic_linker_section
8624         parameter.  Change all callers.
8625         * layout.h (class Layout): Update declarations.
8626         * output.h (class Output_section): Add is_interp, set_is_interp,
8627         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
8628         Add is_interp_, is_dynamic_linker_section_ fields.  Change
8629         generate_code_fills_at_write_ to a bitfield.
8630         * output.cc (Output_section::Output_sections): Initialize new
8631         fields.
8632         (Output_segment::add_output_section): Add do_sort parameter.
8633         Change all callers.
8634
8635 2009-11-03  Ian Lance Taylor  <iant@google.com>
8636
8637         PR 10860
8638         * options.h (class General_options): Add --warn-common.
8639         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
8640         merging two common symbols.
8641         (Symbol_table::should_override): Handle --warn-common when merging
8642         a common symbol with a defined symbol.  Use report_resolve_problem
8643         for multiple definitions.
8644         (Symbol_table::report_resolve_problem): New function.
8645         * symtab.h (class Symbol_table): Declare report_resolve_problem.
8646
8647 2009-11-03  Doug Kwan  <dougkwan@google.com>
8648
8649         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
8650         stub_factory_.
8651         (Target_arm::stub_factory): New method definition.
8652         (Target_arm::new_arm_input_section,
8653         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
8654         Target_arm::reloc_uses_thumb_bit): New method declarations.
8655         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
8656         New type definitions.
8657         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
8658         member declarations.
8659         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
8660         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
8661         New method definitions.
8662
8663 2009-11-03  Ian Lance Taylor  <iant@google.com>
8664
8665         * options.h (class General_options): Add --warn_constructors.
8666
8667 2009-11-03  Ian Lance Taylor  <iant@google.com>
8668
8669         PR 10893
8670         * defstd.cc (in_section): Add entries for __rel_iplt_start,
8671         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
8672
8673 2009-11-03  Ian Lance Taylor  <iant@google.com>
8674
8675         PR 10895
8676         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
8677         --msgid-bugs-address.
8678         (install-pdf): New target.
8679         (install-data_yes): Look up one directory to find mkinstalldirs.
8680
8681 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
8682
8683         * po/Make-in (.po.gmo): Don't generate .gmo files in source
8684         tree.
8685
8686 2009-10-30  Doug Kwan  <dougkwan@google.com>
8687
8688         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
8689
8690 2009-10-30  Doug Kwan  <dougkwan@google.com>
8691
8692         * arm.cc (Stub_addend_reader): New struct template definition
8693         and partial specializations.
8694         (Stub_addend_reader::operator()): New method definition for a
8695         partially specialized template.
8696
8697 2009-10-30  Doug Kwan  <dougkwan@google.com>
8698
8699         * arm.cc (Arm_relobj::processor_specific_flags): New method
8700         definition.
8701         (Arm_relobj::do_read_symbols): New method declaration.
8702         (Arm_relobj::processor_specific_flags_): New data member declaration.
8703         (Arm_dynobj): New class definition.
8704         (Target_arm::do_finalize_sections): Add input_objects parameter.
8705         (Target_arm::do_adjust_elf_header): New method declaration.
8706         (Target_arm::are_eabi_versions_compatible,
8707         (Target_arm::merge_processor_specific_flags): New method declaration.
8708         (Target_arm::do_make_elf_object): New overloaded method definitions
8709         and declaration.
8710         (Arm_relobj::do_read_symbols): New method definition.
8711         (Arm_dynobj::do_read_symbols): Ditto.
8712         (Target_arm::do_finalize_sections): Add input_objects parameters.
8713         Merge processor-specific flags from all input objects.
8714         (Target_arm::are_eabi_versions_compatible,
8715         Target_arm::merge_processor_specific_flags,
8716         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
8717         New method definitions.
8718         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
8719         Input_objects pointer type parameter.
8720         * layout.cc (Layout::finalize): Pass input objects to target's.
8721         finalize_sections function.
8722         * output.cc (Output_file_header::do_sized_write): Set ELF file
8723         header's processor-specific flags.
8724         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
8725         Input_objects pointer type parameter.
8726         * sparc.cc (Target_sparc::do_finalize_sections): Same.
8727         * target.h (Input_objects): New forward class declaration.
8728         (Target::processor_specific_flags,
8729         Target::are_processor_specific_flags_sect): New method definitions.
8730         (Target::finalize_sections): Add input_objects parameter.
8731         (Target::Target): Initialize processor_specific_flags_ and
8732         are_processor_specific_flags_set_.
8733         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
8734         parameter.
8735         (Target::set_processor_specific_flags): New method definition.
8736         (Target::processor_specific_flags_,
8737         Target::are_processor_specific_flags_set_): New data member
8738         declarations.
8739         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
8740         Input_objects pointer type parameter.
8741
8742 2009-10-30  Doug Kwan  <dougkwan@google.com>
8743
8744         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
8745
8746 2009-10-28  Ian Lance Taylor  <iant@google.com>
8747
8748         * object.h (class Relobj): Drop options parameter from
8749         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
8750         do_scan_relocs, do_relocate.  Change all callers.
8751         (class Sized_relobj): Drop options parameters from
8752         do_gc_process_relocs, do_scan_relocs, do_relocate,
8753         do_relocate_sections, relocate_sections, emit_relocs_scan,
8754         emit_relocs_scan_reltype.  Change all callers.
8755         (struct Relocate_info): Remove options field and all references to
8756         it.
8757         * reloc.h (class Read_relocs): Remove options constructor
8758         parameter and options_ field.  Change all callers.
8759         (class Gc_process_relocs, class Scan_relocs): Likewise.
8760         (class Relocate_task): Likewise.
8761         * target-reloc.h (scan_relocs): Remove options parameter.  Change
8762         all callers.
8763         (scan_relocatable_relocs): Likewise.
8764         * target.h (class Sized_target): Remove options parameter from
8765         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
8766         all callers.
8767         * gc.h (gc_process_relocs): Remove options parameter.  Change all
8768         callers.
8769         * arm.cc: Update functions to remove options parameters.
8770         * i386.cc: Likewise.
8771         * powerpc.cc: Likewise.
8772         * sparc.cc: Likewise.
8773         * x86_64.cc: Likewise.
8774         * testsuite/testfile.cc: Likewise.
8775
8776 2009-10-28  Doug Kwan  <dougkwan@google.com>
8777
8778         * arm.cc (Arm_relobj): New class definition.
8779         (Arm_relobj::scan_sections_for_stubs,
8780         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
8781         New method definitions.
8782
8783 2009-10-28  Cary Coutant  <ccoutant@google.com>
8784
8785         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
8786         (Plugin::cleanup_done_): New member.
8787         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
8788         (Plugin_manager::cleanup_done_): Remove.
8789         (Plugin_manager::add_input_file): Edit error message.
8790         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
8791         (Plugin_manager::cleanup): Remove use of cleanup_done_.
8792
8793 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
8794
8795         * fileread.cc: (File_read::View::~View): Use the new
8796         data_ownership_ filed.
8797         (File_read::~File_read): Dispose the new whole_file_view_.
8798         (File_read::open): Mmap the whole file if needed.
8799         (File_read::open): Use whole_file_view_ instead of contents_.
8800         (File_read::find_view): Use whole_file_view_ if applicable.
8801         (File_read::do_read): Use whole_file_view_ instead of contents_.
8802         (File_read::make_view): Use whole_file_view_ instead of contents_,
8803         update File_read::View::View call.
8804         (File_read::find_or_make_view): Update File_read::View::View
8805         call.
8806         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
8807         remove contents_
8808         (File_read::View::Data_ownership): New enum.
8809         (File_read::View::View): Replace bool mapped_ with Data_ownership
8810         argument.
8811         (File_read::View::mapped_): Remove (replaced by data_ownership_).
8812         (File_read::View::data_ownership_): New field.
8813         (File_read::contents_): Remove (replaced by whole_file_view_).
8814         (File_read::whole_file_view_): New field.
8815         * options.h (class General_options): Add --keep-files-mapped.
8816
8817 2009-10-27  Cary Coutant  <ccoutant@google.com>
8818
8819         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
8820         * testsuite/Makefile.am (plugin_test_5): New test case.
8821         * testsuite/Makefile.in: Regenerate.
8822
8823 2009-10-25  Doug Kwan  <dougkwan@google.com>
8824
8825         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
8826         from private to protected to allow access by child class.
8827         (Sized_relobj::do_relocate_sections): New method declaration.
8828         (Sized_relobj::relocate_sections): Virtualize.
8829         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
8830         Sized_relobj::relocate_sections.  Instantiate template explicitly
8831         for different target sizes and endianity.
8832
8833 2009-10-24  Doug Kwan  <dougkwan@google.com>
8834
8835         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
8836         (Arm_input_section::as_arm_input_section): New method.
8837         (Arm_output_section): New class definition.
8838         (Arm_output_section::create_stub_group,
8839         Arm_output_section::group_sections): New method definitions.
8840
8841 2009-10-22  Doug Kwan  <dougkwan@google.com>
8842
8843         * arm.cc (Arm_input_section): New class definition.
8844         (Arm_input_section::init, Arm_input_section:do_write,
8845         Arm_input_section::set_final_data_size,
8846         Arm_input_section::do_reset_address_and_file_offset): New method
8847         definitions.
8848
8849 2009-10-21  Doug Kwan  <dougkwan@google.com>
8850
8851         * arm.cc (Stub_table, Arm_input_section): New forward class
8852         declarations.
8853         (Stub_table): New class defintion.
8854         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
8855         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
8856         New method definition.
8857
8858 2009-10-21  Doug Kwan  <dougkwan@google.com>
8859
8860         * arm.cc: Update copyright comments.
8861         (Target_arm): New forward class template declaration.
8862         (Arm_address): New type.
8863         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
8864         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
8865         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
8866         constants.
8867         (Insn_template): Same.
8868         (DEF_STUBS): New macro.
8869         (Stub_type): New enum type.
8870         (Stub_template): New class definition.
8871         (Stub): Same.
8872         (Reloc_stub): Same.
8873         (Stub_factory): Same.
8874         (Target_arm::Target_arm): Initialize may_use_blx_ and
8875         should_force_pic_veneer_.
8876         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
8877         Target_arm::should_force_pic_veneer,
8878         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
8879         Target_arm::using_thumb_only, Target_arm:;default_target): New
8880         method defintions.
8881         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
8882         New data member declarations.
8883         (Insn_template::size, Insn_template::alignment): New method defintions.
8884         (Stub_template::Stub_template): New method definition.
8885         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
8886         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
8887         (Stub_factory::Stub_factory): New method definition.
8888         * gold.h (string_hash): New template.
8889         * output.h (Input_section_specifier::hash_value): Use
8890         gold::string_hash.
8891         (Input_section_specifier::string_hash): Remove.
8892         * stringpool.cc (Stringpool_template::string_hash): Use
8893         gold::string_hash.
8894
8895 2009-10-20  Doug Kwan  <dougkwan@google.com>
8896
8897         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
8898         symbols of relaxed input sections.
8899         * output.h (Output_section::find_relaxed_input_section): Make
8900         method public.
8901
8902 2009-10-16  Doug Kwan  <dougkwan@google.com>
8903
8904         * dynobj.cc (Versions::Versions): Initialize version_script_.
8905         Only insert base version symbol definition for a shared object
8906         if version script defines any version versions.
8907         (Versions::define_base_version): New method definition.
8908         (Versions::add_def): Check that base version is not needed.
8909         (Versions::add_need): Define base version lazily.
8910         * dynobj.h (Versions::define_base_version): New method declaration.
8911         (Versions::needs_base_version_): New data member declaration.
8912         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
8913         (check_DATA): Add no_version_test.stdout.
8914         (libno_version_test.so, no_version_test.o no_version_test.stdout):
8915         New make rules.
8916         * testsuite/Makefile.in: Regenerate.
8917         * testsuite/no_version_test.c: New file.
8918         * testsuite/no_version_test.sh: Ditto.
8919
8920 2009-10-16  Doug Kwan  <dougkwan@google.com>
8921
8922         * expression.cc (class Segment_start_expression): New class definition.
8923         (Segment_start_expression::value): New method definition.
8924         (script_exp_function_segment_start): Return a new
8925         Segment_start_expression.
8926         * gold/script-c.h (script_saw_segment_start_expression): New function
8927         prototype.
8928         * script-sections.cc (Script_sections::Script_sections): Initialize
8929         SAW_SEGMENT_START_EXPRESSION_ to false.
8930         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
8931         and -Tbbs options to specify section addresses if given in
8932         command line and no SEGMENT_START expression is seen in a script.
8933         * script-sections.h (Script_sections::saw_segment_start_expression,
8934         Script_sections::set_saw_segment_start_expression): New method
8935         definition.
8936         (Script_sections::saw_segment_start_expression_): New data member
8937         declaration.
8938         * script.cc (script_saw_segment_start_expression): New function.
8939         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
8940         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
8941         script_test_7.sh and script_test_8.sh.
8942         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
8943         script_test_8.stdout.
8944         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
8945         (script_test_6, script_test_6.stdout, script_test_7,
8946         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
8947         * Makefile.in: Regenerate.
8948         * testsuite/script_test_6.sh: New file.
8949         * testsuite/script_test_6.t: Same.
8950         * testsuite/script_test_7.sh: Same.
8951         * testsuite/script_test_7.t: Same.
8952         * testsuite/script_test_8.sh: Same.
8953
8954 2009-10-16  Doug Kwan  <dougkwan@google.com>
8955
8956         * output.cc (Output_segment::set_section_list_address): Cast
8957         expressions to unsigned long long type to avoid format warnings.
8958
8959 2009-10-15  Ian Lance Taylor  <iant@google.com>
8960
8961         * script.cc (Script_options::add_symbol_assignment): Always add a
8962         dot assignment to script_sections_.
8963         * script-sections.cc (Script_sections::add_dot_assignment):
8964         Initialize if necessary.
8965
8966         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
8967         program headers with no load segment if there is a linker script.
8968
8969         * layout.cc (Layout::set_segment_offsets): Align the file offset
8970         to the segment aligment for -N or -n with no load segment.
8971         * output.cc (Output_segment::add_output_section): Don't crash if
8972         the first section is a TLS section.
8973         (Output_segment::set_section_list_addresses): Print an error
8974         message if the address moves backward in a linker script.
8975         * script-sections.cc
8976         (Output_section_element_input::set_section_addresses): Don't
8977         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
8978         (Orphan_output_section::set_section_addresses): Likewise.
8979
8980 2009-10-15  Doug Kwan  <dougkwan@google.com>
8981
8982         * layout.cc (Layout::finish_dynamic_section): Generate tags
8983         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
8984         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
8985         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
8986
8987 2009-10-14  Ian Lance Taylor  <iant@google.com>
8988
8989         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
8990         fields.
8991         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
8992         data_shdr fields of relinfo.
8993         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
8994         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
8995         R_386_TLS_LDO_32, adjust based on section flags.
8996         (Target_i386::Relocate::fix_up_ldo): Remove.
8997
8998 2009-10-13  Ian Lance Taylor  <iant@google.com>
8999
9000         Add support for -pie.
9001         * options.h (class General_options): Add -pie and
9002         --pic-executable.
9003         (General_options::output_is_position_independent): Test -pie.
9004         (General_options::output_is_executable): Return true if not shared
9005         and not relocatable.
9006         (General_options::output_is_pie): Remove.
9007         * options.cc (General_options::finalize): Reject incompatible uses
9008         of -pie.
9009         * gold.cc (queue_middle_tasks): A -pie link is not static.
9010         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9011         * symtab.cc (Symbol::final_value_is_known): Return false if
9012         output_is_position_independent.
9013         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9014         output_is_position_independent.
9015         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9016         output_is_position_independent.
9017         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9018         output_is_position_independent.
9019         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9020         two_file_pie_test.
9021         (basic_pie_test.o, basic_pie_test): New targets.
9022         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9023         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9024         (two_file_pie_test): New target.
9025         * testsuite/Makefile.in: Rebuild.
9026         * README: Remove note saying that -pie is not supported.
9027
9028 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9029
9030         * options.h (class General_options): Add -init and -fini.
9031         * layout.cc (Layout::finish_dynamic_section): Emit
9032         given init and fini functions.
9033
9034 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9035
9036         * gc.h (gc_process_relocs): Check if icf is enabled using new
9037         function.
9038         * gold.cc (queue_initial_tasks): Likewise.
9039         (queue_middle_tasks): Likewise.
9040         * object.cc (do_layout): Likewise.
9041         * symtab.cc (is_section_folded): Likewise.
9042         * main.cc (main): Likewise.
9043         * reloc.cc (Read_relocs::run): Likewise.
9044         (Sized_relobj::do_scan_relocs): Likewise.
9045         * icf.cc (is_function_ctor_or_dtor): New function.
9046         (Icf::find_identical_sections): Check if function is ctor or dtor when
9047         safe icf is chosen.
9048         * options.h (General_options::icf): Change option to be an enum.
9049         (Icf_status): New enum.
9050         (icf_enabled): New method.
9051         (icf_safe_folding): New method.
9052         (set_icf_status): New method.
9053         (icf_status_): New variable.
9054         * (options.cc) (General_options::finalize): Set icf_status_.
9055         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9056         icf_test and icf_keep_unique_test to use the --icf enum flag.
9057         * testsuite/icf_safe_test.sh: New file.
9058         * testsuite/icf_safe_test.cc: New file.
9059
9060 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9061
9062         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9063         includes to gc.h and icf.h.
9064         * arm.cc: Include gc.h.
9065         * gold.cc: Likewise.
9066         * i386.cc: Likewise.
9067         * powerpc.cc: Likewise.
9068         * sparc.cc: Likewise.
9069         * x86_64.cc: Likewise.
9070         * gc.h: Include icf.h.
9071
9072 2009-10-11  Ian Lance Taylor  <iant@google.com>
9073
9074         * plugin.cc: Include "gold.h" before other header files.
9075
9076 2009-10-10  Chris Demetriou  <cgd@google.com>
9077
9078         * options.h (Input_file_argument::Input_file_type): New enum.
9079         (Input_file_argument::is_lib_): Replace with...
9080         (Input_file_argument::type_): New member.
9081         (Input_file_argument::Input_file_argument): Take Input_file_type
9082         'type' rather than boolean 'is_lib' as second argument.
9083         (Input_file_argument::is_lib): Use type_.
9084         (Input_file_argument::is_searched_file): New function.
9085         (Input_file_argument::may_need_search): Handle is_searched_file.
9086         * options.cc (General_options::parse_library): Support -l:filename.
9087         (General_options::parse_just_symbols): Update for Input_file_argument
9088         changes.
9089         (Command_line::process): Likewise.
9090         * archive.cc (Archive::get_file_and_offset): Likewise.
9091         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9092         * script.cc (read_script_file, script_add_file): Likewise.
9093         * fileread.cc (Input_file::Input_file): Likewise.
9094         (Input_file::will_search_for): Handle is_searched_file.
9095         (Input_file::open): Likewise.
9096         * readsyms.cc (Read_symbols::get_name): Likewise.
9097         * testsuite/Makefile.am (searched_file_test): New test.
9098         * testsuite/Makefile.in: Regenerate.
9099         * testsuite/searched_file_test.cc: New file.
9100         * testsuite/searched_file_test_lib.cc: New file.
9101
9102 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9103             Ian Lance Taylor  <iant@google.com>
9104
9105         * descriptor.cc: Include <cstdio> and "binary-io.h".
9106         (Descriptors::open): Open the files in binary mode always.
9107         * script.cc (Lex::get_token): Treat \r as whitespace.
9108
9109 2009-10-09  Ian Lance Taylor  <iant@google.com>
9110
9111         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9112
9113 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9114             Ian Lance Taylor  <iant@google.com>
9115
9116         * configure.ac: Check for readv function also.
9117         * fileread.cc (readv): Define if not HAVE_READV.
9118         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9119         does not exist.
9120         * config.in: Regenerate.
9121         * configure: Regenerate.
9122
9123 2009-10-09  Doug Kwan  <dougkwan@google.com>
9124
9125         * layout.cc (Layout::make_output_section): Call target hook to make
9126         ordinary output section.
9127         (Layout::finalize): Adjust parameter list of call the
9128         Target::may_relax().
9129         * layout.h (class Layout::section_list): New method.
9130         * merge.h (Output_merge_base::entsize): Change visibility to public.
9131         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9132         New methods.
9133         (Output_merge_string::do_is_string): New method.
9134         * object.cc (Sized_relobj::do_setup): renamed from
9135         Sized_relobj::set_up.
9136         * object.h (Sized_relobj::adjust_shndx,
9137         Sized_relobj::initializ_input_to_output_maps,
9138         Sized_relobj::free_input_to_output_maps): Change visibilities to
9139         protected.
9140         (Sized_relobj::setup): Virtualize.
9141         (Sized_relobj::do_setup): New method declaration.
9142         (Sized_relobj::invalidate_section_offset,
9143         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9144         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9145         * options.cc (parse_int): New function.
9146         * options.h (parse_int): New declaration.
9147         (DEFINE_int): New macro.
9148         (stub_group_size): New option.
9149         * output.cc (Output_section::Output_section): Initialize memebers
9150         merge_section_map_, merge_section_by_properties_map_,
9151         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9152         (Output_section::add_input_section): Handled deferred code-fill
9153         generation and remove an old comment.
9154         (Output_section::add_relaxed_input_section): New method definition.
9155         (Output_section::add_merge_input_section): Use merge section by
9156         properties map to speed to search.  Update merge section maps
9157         as appropriate.
9158         (Output_section::build_relaxation_map): New method definition.
9159         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9160         Same.
9161         (Output_section::relax_input_section): Renamed to
9162         Output_section::convert_input_sections_to_relaxed_sections and change
9163         interface to take a vector of pointers to relaxed sections.
9164         (Output_section::find_merge_section,
9165         Output_section::find_relaxed_input_section): New method definitions.
9166         (Output_section::is_input_address_mapped,
9167         Output_section::output_offset, Output_section::output_address):
9168         Use output section data maps to speed up searching.
9169         (Output_section::find_starting_output_address): Add comments.
9170         (Output_section::do_write,
9171         Output_section::write_to_postprocessing_buffer): Do code-fill
9172         generation as appropriate.
9173         (Output_section::get_input_sections): Invalidate relaxed input section
9174         map.
9175         (Output_section::restore_states): Adjust type of checkpoint .
9176         Invalidate relaxed input section map.
9177         * output.h (Output_merge_base): New class declaration.
9178         (Input_section_specifier): New class defintion.
9179         (class Output_relaxed_input_section) Change base class to
9180         Output_section_data_build.
9181         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9182         base class initializer.
9183         (Output_section::add_relaxed_input_section): New method declaration.
9184         (Output_section::Input_section): Change visibility to protected.
9185         (Output_section::Input_section::relobj,
9186         Output_section::Input_section::shndx): Handle relaxed input sections.
9187         Output_section::input_sections) Change visibility to protected.  Also
9188         define overload to return a non-const pointer.
9189         (Output_section::Merge_section_properties): New class defintion.
9190         (Output_section::Merge_section_by_properties_map,
9191         Output_section::Output_section_data_by_input_section_map,
9192         Output_section::Relaxation_map): New types.
9193         (Output_section::relax_input_section): Rename method to
9194         Output_section::convert_input_sections_to_relaxed_sections and change
9195         interface to take a vector of relaxed section pointers.
9196         (Output_section::find_merge_section,
9197         Output_section::find_relaxed_input_section,
9198         Output_section::build_relaxation_map,
9199         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9200         New method declarations.
9201         (Output_section::merge_section_map_
9202         Output_section::merge_section_by_properties_map_,
9203         Output_section::relaxed_input_section_map_,
9204         Output_section::is_relaxed_input_section_map_valid_,
9205         Output_section::generate_code_fills_at_write_): New data members.
9206         * script-sections.cc
9207         (Output_section_element_input::set_section_addresses): Call
9208         current_data_size and addralign methods of relaxed input sections.
9209         (Orphan_output_section::set_section_addresses): Call current_data_size
9210         and addralign methods of relaxed input sections.
9211         * symtab.cc (Symbol_table::compute_final_value): Extract template
9212         from the body of Symbol_table::sized_finalize_symbol.
9213         (Symbol_table::sized_finalized_symbol): Call
9214         Symbol_table::compute_final_value.
9215         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9216         (Symbol_table::compute_final_value): New templated method declaration.
9217         * target.cc (Target::do_make_output_section): New method defintion.
9218         * target.h (Target::make_output_section): New method declaration.
9219         (Target::relax): Add more parameters for input objects, symbol table
9220         and layout.  Adjust call to do_relax.
9221         (Target::do_make_output_section): New method declaration.
9222         (Target::do_relax): Add parameters for input objects, symbol table
9223         and layout.
9224
9225 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9226
9227         * pread.c: Include stdio.h.
9228
9229 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9230
9231         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9232         defined.
9233
9234 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9235
9236         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9237         Change read_shndx type to unsigned int.
9238         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9239         int.
9240         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9241         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9242         Change read_shndx type to unsigned int.
9243         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9244         int.
9245         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9246         * layout.cc (Layout::create_symtab_sections): Cast the result of
9247         local_symcount * symsize to off_t in the gold_assert.
9248
9249 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9250
9251         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9252         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9253         R_ARM_BASE_ABS.
9254         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9255         (Arm_relocate_functions::thm_abs5): New function.
9256         (Arm_relocate_functions::abs12): New function.
9257         (Arm_relocate_functions::abs16): New function.
9258         (Arm_relocate_functions::base_abs): New function.
9259         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9260         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9261         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9262         R_ARM_BASE_ABS.
9263         (Scan::global): Likewise.
9264         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9265         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9266         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9267         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9268         R_ARM_BASE_ABS.
9269
9270 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9271
9272         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9273         (Arm_relocate_functions::movt_prel): New function.
9274         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9275         (Arm_relocate_functions::thm_movt_prel): New function.
9276         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9277         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9278         (Scan::global, Relocate::relocate): Likewise.
9279         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9280
9281 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9282
9283         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9284         Incremental_checker.
9285         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9286         unsigned int.
9287         (class Incremental_inputs_header): New class.
9288         (Incremental_inputs_header_writer): Edit comment.
9289         (Incremental_inputs_entry): New class.
9290         (Incremental_inputs_entry_writer): Edit comment.
9291         (Sized_incremental_binary::do_find_incremental_inputs_section):
9292         Add *strtab_shndx parameter, fill it.
9293         (Sized_incremental_binary::do_check_inputs): New method.
9294         (Incremental_checker::can_incrementally_link_output_file): Use
9295         Sized_incremental_binary::check_inputs.
9296         (Incremental_inputs::report_command_line): Save command line in
9297         command_line_.
9298         * incremental.h:
9299         (Incremental_binary::find_incremental_inputs_section): New
9300         method.
9301         (Incremental_binary::do_find_incremental_inputs_section): Add
9302         strtab_shndx parameter.
9303         (Incremental_binary::do_check_inputs): New pure virtual method.
9304         (Sized_incremental_binary::do_check_inputs): Declare.
9305         (Incremental_checker::Incremental_checker): Add incremental_inputs
9306         parameter, use it to initialize incremental_inputs_.
9307         (Incremental_checker::incremental_inputs_): New field.
9308         (Incremental_checker::command_line): New method.
9309         (Incremental_checker::inputs): New method.
9310         (Incremental_checker::command_line_): New field.
9311
9312 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9313
9314         * incremental.cc: Include <cstdarg> and "target-select.h".
9315         (vexplain_no_incremental): New function.
9316         (explain_no_incremental): New function.
9317         (Incremental_binary::error): New method.
9318         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9319         method.
9320         (make_sized_incremental_binary): New function.
9321         (open_incremental_binary): New function.
9322         (can_incrementally_link_file): Add checks if output is ELF and has
9323         inputs section.
9324         * incremental.h: Include "elfcpp_file.h" and "output.h".
9325         (Incremental_binary): New class.
9326         (Sized_incremental_binary): New class.
9327         (open_incremental_binary): Declare.
9328         * object.cc (is_elf_object): Use
9329         elfcpp::Elf_recognizer::is_elf_file.
9330         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9331         * output.h (Output_file::filesize): New method.
9332
9333 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9334
9335         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9336         New function.
9337         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9338         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9339         function.
9340         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9341         function.
9342         (Arm_relocate_functions::movw_abs_nc): New function.
9343         (Arm_relocate_functions::movt_abs): New function.
9344         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9345         (Arm_relocate_functions::thm_movt_abs): New function.
9346         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9347         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9348         (Scan::global): Likewise.
9349         (Relocate::relocate): Likewise.
9350         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9351
9352 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9353
9354         * arm.cc (Arm_relocate_functions::got_prel) New function.
9355         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9356         (Relocate::relocate): Likewise.
9357         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9358
9359 2009-10-06  Ian Lance Taylor  <iant@google.com>
9360
9361         * options.h (class General_options): Define
9362         split_stack_adjust_size parameter.
9363         * object.h (class Object): Add uses_split_stack_ and
9364         has_no_split_stack_ fields.  Add uses_split_stack and
9365         has_no_split_stack accessor functions.  Declare
9366         handle_split_stack_section.
9367         (class Reloc_symbol_changes): Define.
9368         (class Sized_relobj): Define Function_offsets.  Declare
9369         split_stack_adjust, split_stack_adjust_reltype, and
9370         find_functions.
9371         * object.cc (Object::handle_split_stack_section): New function.
9372         (Sized_relobj::do_layout): Call handle_split_stack_section.
9373         * dynobj.cc (Sized_dynobj::do_layout): Call
9374         handle_split_stack_section.
9375         * reloc.cc (Sized_relobj::relocate_sections): Call
9376         split_stack_adjust for executable sections in split_stack
9377         objects.  Pass reloc_map to relocate_section.
9378         (Sized_relobj::split_stack_adjust): New function.
9379         (Sized_relobj::split_stack_adjust_reltype): New function.
9380         (Sized_relobj::find_functions): New function.
9381         * target-reloc.h: Include "object.h".
9382         (relocate_section): Add reloc_symbol_changes parameter.  Change
9383         all callers.
9384         * target.h (class Target): Add calls_non_split method.  Declare
9385         do_calls_non_split virtual method.  Declare match_view and
9386         set_view_to_nop.
9387         * target.cc: Include "elfcpp.h".
9388         (Target::do_calls_non_split): New function.
9389         (Target::match_view): New function.
9390         (Target::set_view_to_nop): New function.
9391         * gold.cc (queue_middle_tasks): Give an error if mixing
9392         split-stack and non-split-stack objects with -r.
9393         * i386.cc (Target_i386::relocate_section): Add
9394         reloc_symbol_changes parameter.
9395         (Target_i386::do_calls_non_split): New function.
9396         * x86_64.cc (Target_x86_64::relocate_section): Add
9397         reloc_symbol_changes parameter.
9398         (Target_x86_64::do_calls_non_split): New function.
9399         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9400         parameter.
9401         * powerpc.cc (Target_powerpc::relocate_section): Add
9402         reloc_symbol_changes parameter.
9403         * sparc.cc (Target_sparc::relocate_section): Add
9404         reloc_symbol_changes parameter.
9405         * configure.ac: Call AM_CONDITIONAL for the default target.
9406         * configure: Rebuild.
9407         * testsuite/Makefile.am (TEST_AS): New variable.
9408         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9409         (check_DATA): Add split_i386 and split_x86_64 files.
9410         (SPLIT_DEFSYMS): Define.
9411         (split_i386_[1234n].o): New targets.
9412         (split_i386_[124]): New targets.
9413         (split_i386_[1234r].stdout): New targets.
9414         (split_x86_64_[1234n].o): New targets.
9415         (split_x86_64_[124]): New targets.
9416         (split_x86_64_[1234r].stdout): New targets.
9417         (MOSTLYCLEANFILES): Add new executables.
9418         * testsuite/split_i386.sh: New file.
9419         * testsuite/split_x86_64.sh: New file.
9420         * testsuite/split_i386_1.s: New file.
9421         * testsuite/split_i386_2.s: New file.
9422         * testsuite/split_i386_3.s: New file.
9423         * testsuite/split_i386_4.s: New file.
9424         * testsuite/split_i386_n.s: New file.
9425         * testsuite/split_x86_64_1.s: New file.
9426         * testsuite/split_x86_64_2.s: New file.
9427         * testsuite/split_x86_64_3.s: New file.
9428         * testsuite/split_x86_64_4.s: New file.
9429         * testsuite/split_x86_64_n.s: New file.
9430         * testsuite/testfile.cc (Target_test): Update relocation_section
9431         function.
9432         * testsuite/Makefile.in: Rebuild.
9433
9434 2009-10-06  Ian Lance Taylor  <iant@google.com>
9435
9436         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9437         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9438         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9439         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9440         the address on ldo_addrs_.
9441         (Target_i386::Relocate::fix_up_ldo): New function.
9442
9443 2009-10-06   Rafael Espindola  <espindola@google.com>
9444
9445         * plugin.cc (add_input_library): New.
9446         (Plugin::load): Add add_input_library to tv.
9447         (Plugin_manager::add_input_file): Add the is_lib argument.
9448         (add_input_file): Update call to Plugin_manager::add_input_file.
9449         (add_input_library): New.
9450         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9451
9452 2009-09-30  Doug Kwan  <dougkwan@google.com>
9453
9454         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9455         symbol and call Symbol::may_need_copy_reloc to determine if
9456         a copy reloc is needed.
9457         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9458         nocopyreloc is given in command line.
9459         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9460         given in command line.
9461         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9462         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9463         of the removed Target_i386::may_need_copy_reloc.
9464         * options.h (copyreloc): New option with default value false.
9465         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9466         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9467         instead of the removed Target_powerpc::may_need_copy_reloc.
9468         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9469         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9470         instead of the removed Target_sparc::may_need_copy_reloc.
9471         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9472         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9473         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9474         instead of the removed Target_x86_64::may_need_copy_reloc.
9475
9476 2009-09-30  Ian Lance Taylor  <iant@google.com>
9477
9478         * object.h (class Object): Remove target_ field, and target,
9479         sized_target, and set_target methods.
9480         (Object::sized_target): Remove.
9481         (class Sized_relobj): Update declarations.  Remove sized_target.
9482         * object.cc (Sized_relobj::setup): Remove target parameter.
9483         Change all callers.
9484         (Input_objects::add_object): Don't do anything with the target.
9485         (make_elf_sized_object): Add punconfigured parameter.  Change all
9486         callers.  Set or test parameter target.
9487         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
9488         Change all callers.
9489         * parameters.cc (Parameters::set_target): Change parameter type to
9490         be non-const.
9491         (Parameters::default_target): Remove.
9492         (set_parameters_target): Change parameter type to be non-const.
9493         (parameters_force_valid_target): New function.
9494         (parameters_clear_target): New function.
9495         * parameters.h (class Parameters): Update declarations.  Remove
9496         default_target method.  Add sized_target and clear_target
9497         methods.  Change target_ to be non-const.
9498         (set_parameters_target): Update declaration.
9499         (parameters_force_valid_target): Declare.
9500         (parameters_clear_target): Declare.
9501         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
9502         as NULL if we aren't searching.
9503         (Add_symbols::run): Don't check for compatible target.
9504         * fileread.cc (Input_file::open_binary): Call
9505         parameters_force_valid_target.
9506         * gold.cc (queue_middle_tasks): Likewise.
9507         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
9508         set_target on object.
9509         * dynobj.h (class Sized_dynobj): Update declarations.
9510         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
9511         make_elf_object returns NULL.
9512         (Archive::include_member): Don't check whether object target is
9513         compatible.
9514         * output.cc (Output_section::add_input_section): Get target from
9515         parameters.
9516         (Output_section::relax_input_section): Likewise.
9517         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
9518         parameters.
9519         (Sized_relobj::do_scan_relocs): Likewise.
9520         (Sized_relobj::relocate_sections): Likewise.
9521         * resolve.cc (Symbol_table::resolve): Likewise.
9522         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
9523         parameter.  Change all callers.
9524         (Symbol_table::add_from_object): Get target from parameters.
9525         (Symbol_table::add_from_relobj): Don't check object target.
9526         (Symbol_table::add_from_dynobj): Likewise.
9527         (Symbol_table::define_special_symbol): Get target from
9528         parameters.
9529         * symtab.h (class Symbol_table): Update declaration.
9530         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
9531         parameter.  Change all callers.  Clear parameter target.
9532         (Binary_test): Test target here.
9533         * testsuite/object_unittest.cc (gold_testsuite): Remove
9534         target_test_pointer parameter.  Change all callers.
9535         (Object_test): Test target here.
9536
9537 2009-09-26  Ian Lance Taylor  <iant@google.com>
9538
9539         * testsuite/initpri1.c: Don't try to use constructor priorities if
9540         compiling with gcc before 4.3.
9541
9542 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
9543
9544         * testsuite/retain_symbols_file_test.sh (check_present): Change
9545         output file name to retain_symbols_file_test.stdout.
9546         (check_absent): Likewise.
9547
9548 2009-09-18  Craig Silverstein  <csilvers@google.com>
9549
9550         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
9551         * options.cc: Include <cerrno> and <fstream>.
9552         (General_options::finalize): Parse -retain-symbols-file tag.
9553         * options.h: New flag.
9554         (General_options): New method should_retain_symbol, new
9555         variable symbols_to_retain.
9556         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
9557         should_retain_symbol map.
9558         * testsuite/Makefile.am (retain_symbols_file_test): New test.
9559         * testsuite/Makefile.in: Regenerate.
9560         * testsuite/retain_symbols_file_test.sh: New file.
9561
9562 2009-09-18  Nick Clifton  <nickc@redhat.com>
9563
9564         * po/es.po: Updated Spanish translation.
9565
9566 2009-09-17  Doug Kwan  <dougkwan@google.com>
9567
9568         * debug.h (DEBUG_RELAXATION): New constant.
9569         (DEBUG_ALL): Add DEBUG_RELAXATION.
9570         (debug_string_to_enum): Add relaxation debug option.
9571         * layout.cc
9572         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
9573         Layout::Relaxation_debug_check::read_sections,
9574         Layout::Relaxation_debug_check::read_sections): New method definitions.
9575         (Layout::Layout): Initialize data members
9576         record_output_section_data_from_scrips_,
9577         script_output_section_data_list_ and relaxation_debug_check_.
9578         (Layout::save_segments, Layout::restore_segments,
9579         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9580         Layout::relaxation_loop_body): New method definitions.
9581         (Layout::finalize): Support relaxation.  Move section layout code to
9582         Layout::relaxation_loop_body.
9583         (Layout::set_asection_address_from_script): Move code for orphan
9584         section placement out.
9585         (Layout::place_orphan_sections_in_script): New method definition.
9586         * layout.h (Output_segment_headers, Output_file_header):
9587         New forward class declarations.
9588         (Layout::~Layout): Define.
9589         (Layout::new_output_section_data_from_script): New method definition.
9590         (Layout::place_orphan_sections_in_script): New method declaration.
9591         (Layout::Segment_states): New type declaration.
9592         (Layout::save_segments, Layout::restore_segments,
9593         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
9594         Layout::relaxation_loop_body): New method declarations.
9595         (Layout::Output_section_data_list): New type declaration.
9596         (Layout::Relaxation_debug_check): New class definition.
9597         (Layout::record_output_section_data_from_script_,
9598         Layout::script_output_section_data_list_, Layout::segment_states_,
9599         Layout::relaxation_debug_check_): New data members.
9600         * output.cc: (Output_section_headers::do_size): New method definition.
9601         (Output_section_headers::Output_section_headers): Move size
9602         computation to Output_section_headers::do_size.
9603         (Output_segment_headers::do_size): New method definition.
9604         (Output_file_header::Output_file_header): Move size computation to
9605         Output_file_header::do_size and call it.
9606         (Output_file_header::do_size): New method definition.
9607         (Output_data_group::Output_data_group): Adjust call to
9608         Output_section_data.
9609         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
9610         (Output_symtab_xindex::do_write): Add array bound check.
9611         (Output_section::Input_section::print_to_mapfile): Handle
9612         RELAXED_INPUT_SECTION_CODE.
9613         (Output_section::Output_section): Initialize data member checkpoint_.
9614         (Output_section::~Output_section): Delete checkpoint object pointed
9615         by checkpoint_.
9616         (Output_section::add_input_section): Always add an Input_section if
9617         relaxing.
9618         (Output_section::add_merge_input_section): Add assert.
9619         (Output_section::relax_input_section): New method definition.
9620         (Output_section::set_final_data_size): Set load address to zero for
9621         an unallocated section.
9622         (Output_section::do_address_and_file_offset_have_reset_values):
9623         New method definition.
9624         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
9625         Handle relaxed input section.
9626         (Output_section::sort_attached_input_sections): Checkpoint input
9627         section list lazily.
9628         (Output_section::get_input_sections): Change type of input_sections to
9629         list of Simple_input_section pointers.  Checkpoint input section list
9630         lazily.  Also handle relaxed input sections.
9631         (Output_section::add_input_section_for_script): Take a reference to
9632         a Simple_input_section object instead of Relobj pointer and section
9633         index as parameter.  Handle relaxed input sections.
9634         (Output_section::save_states, Output_section::restore_states): New
9635         method definitions.
9636         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
9637         (Output_data::is_data_size_fixed): New method definition.
9638         (Output_data::reset_addresss_and_file_offset): Do not reset data size
9639         if it is fixed.
9640         (Output_data::address_and_file_offset_have_reset_values): New method
9641         definition.
9642         (Output_data::do_address_and_file_offset_have_reset_values): New method
9643         definition.
9644         (Output_data::set_data_size): Check that data size is not fixed.
9645         (Output_data::fix_data_size): New method definition.
9646         (Output_data::is_data_size_fixed_): New data member.
9647         (Output_section_headers::set_final_data_size): New method definition.
9648         (Output_section_headers::do_size): New method declaration.
9649         (Output_segment_headers::set_final_data_size): New method definition.
9650         (Output_segment_headers::do_size): New method declaration.
9651         (Output_file_header::set_final_data_size)::New method definition.
9652         (Output_file_header::do_size)::New method declaration.
9653         (Output_section_data::Output_section_data): Add new parameter
9654         is_data_size_fixed and use it to fix data size.
9655         (Output_data_const::Output_data_const): Adjust call to base class
9656         constructor and fix data size.
9657         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
9658         base class constructor and fix data size.
9659         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
9660         base class constructor and fix data size.
9661         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
9662         class constructor and fix data size.
9663         (Output_data_group::set_final_data_size): New method definition.
9664         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
9665         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
9666         class constructor and fix data size.
9667         (Output_relaxed_input_section): New class definition.
9668         (Output_section::Simple_input_section): New class definition.
9669         (Output_section::get_input_sections): Adjust parameter list.
9670         (Output_section::add_input_section_for_script): Same.
9671         (Output_section::save_states, Output_section::restore_states,
9672         Output_section::do_address_and_file_offset_have_reset_values,
9673         (Output_section::Input_section::Input_section): Handle
9674         RELAXED_INPUT_SECTION_CODE.  Add new overload for
9675         Output_relaxed_input_section.
9676         (Output_section::Input_section::is_input_section,
9677         Output_section::Input_section::set_output_section): Handle relaxed
9678         input section.
9679         (Output_section::Input_section::is_relaxed_input_section,
9680         Output_section::Input_section::output_section_data,
9681         Output_section::Input_section::relaxed_input_section): New method
9682         definitions.
9683         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
9684         value.
9685         (Output_section::Input_section::u1_): Update comments.
9686         (Output_section::Input_section::u2_): Add new union member poris.
9687         (Output_section::Checkpoint_output_section): New classs definition.
9688         (Output_section::relax_input_section): New method declaration.
9689         (Output_section::checkpoint_): New data member.
9690         (Output_segment): Update comments.
9691         (Output_segment::Output_segment): Un-privatize copy constructor.
9692         (Output_segment::operator=): Un-privatize.
9693         * script-sections.cc (Output_section_element::Input_section_list):
9694         Change element type to Output_section::Simple_input_section.
9695         (Output_section_element_dot_assignment::set_section_addresses):
9696         Register output section data for relaxation clean up.
9697         (Output_data_exression::Output_data_expression): Adjust call to base
9698         constructor to fix data size.
9699         (Output_section_element_data::set_section_addresses): Register
9700         Output_data_expression object for relaxation clean up.
9701         (struct Input_section_info): Replace Relobj pointer and section index
9702         pair with Output_section::Simple_input_section and Convert struct to a
9703         class.
9704         (Input_section_sorter::operator()): Adjust access to
9705         Input_section_info data member to use accessors.
9706         (Output_section_element_input::set_section_addresses): Use layout
9707         parameter.  Adjust code to use Output_section::Simple_input_section
9708         and Input_secction_info classes.  Register filler for relaxation
9709         clean up.
9710         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
9711         and section index pair with Output_section::Simple_input_section
9712         class.  Adjust code accordingly.
9713         (Phdrs_element::release_segment): New method definition.
9714         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
9715         segment list.
9716         (Script_sections::release_segments): New method definition.
9717         * gold/script-sections.h (Script_sections::release_segments): New
9718         method declaration.
9719         * gold/target.h (Target::may_relax, Target::relax,
9720         Target::do_may_relax, Target::do_relax): New method definitions.
9721
9722 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9723
9724         * arm.cc (has_signed_unsigned_overflow): New function.
9725         (Arm_relocate_functions::abs8): New function.
9726         (Target_arm::Scan::local): Handle R_ARM_ABS8.
9727         (Target_arm::Scan::global): Likewise.
9728         (Target_arm::relocate::relocate): Likewise.
9729         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9730         Likewise.
9731
9732 2009-09-16  Cary Coutant  <ccoutant@google.com>
9733
9734         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
9735         * testsuite/Makefile.in: Regenerate.
9736
9737 2009-09-11  Nick Clifton  <nickc@redhat.com>
9738
9739         * po/gold.pot: Updated by the Translation project.
9740
9741 2009-09-08  Cary Coutant  <ccoutant@google.com>
9742
9743         * output.cc (Output_file::open): Add execute permission to empty file.
9744         * testsuite/Makefile.am (permission_test): New test.
9745         * testsuite/Makefile.in: Regenerate.
9746
9747 2009-09-02  Ian Lance Taylor  <iant@google.com>
9748
9749         * output.cc (Output_file::resize): Call map_no_anonymous rather
9750         than map.
9751
9752 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
9753
9754         * gold.cc: Include "incremental.h".
9755         (queue_initial_tasks): Call Incremental_checker methods.
9756         * incremental.cc: Include "output.h".
9757         (Incremental_checker::can_incrementally_link_output_file): New
9758         method.
9759         * incremental.h (Incremental_checker): New class.
9760
9761         * output.cc (Output_file::open_for_modification): New method.
9762         (Output_file::map_anonymous): Changed return type to bool.  Record
9763         map in base_ field.
9764         (Output_file::map_no_anonymous): New method, broken out of map.
9765         (Output_file::map): Use map_no_anonymous and map_anonymous.
9766         * output.h (class Output_file): Update declarations.
9767
9768 2009-08-24  Cary Coutant  <ccoutant@google.com>
9769
9770         * options.h (Command_line::Pre_options): New class.
9771         (Command_line::pre_options): New member.
9772         * options.cc (gold::options::ready_to_register): New variable.
9773         (One_option::register_option): Do nothing if not registering options.
9774         Assert if same short option registered twice.
9775         (General_options::General_options): Turn off option registration when
9776         done constructing.
9777         (Command_line::Pre_options::Pre_options): New constructor.
9778
9779 2009-08-24  Cary Coutant  <ccoutant@google.com>
9780
9781         * options.h (General_options::no_keep_memory): Remove incorrect
9782         short option.
9783
9784 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9785
9786         * Makefile.am (am__skiplex, am__skipyacc): New.
9787         * Makefile.in: Regenerate.
9788
9789 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9790
9791         * Makefile.am (AM_CPPFLAGS): Renamed from ...
9792         (INCLUDES): ... this.
9793         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
9794         (AM_CPPFLAGS): Renamed from ...
9795         (INCLUDE): ... this.
9796         * Makefile.in, testsuite/Makefile.in: Regenerate.
9797
9798         * Makefile.in: Regenerate.
9799         * aclocal.m4: Likewise.
9800         * config.in: Likewise.
9801         * configure: Likewise.
9802         * testsuite/Makefile.in: Likewise.
9803
9804         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9805         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
9806         * Makefile.in: Regenerate.
9807         * testsuite/Makefile.in: Regenerate.
9808
9809 2009-08-19  Cary Coutant  <ccoutant@google.com>
9810
9811         * resolve.cc (Symbol_table::resolve): Don't complain about defined
9812         symbols in shared libraries overridden by hidden or internal symbols
9813         in the main program.
9814
9815 2009-08-19  Chris Demetriou  <cgd@google.com>
9816
9817         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
9818         checking source file names in error messages.
9819
9820 2009-08-18  Doug Kwan  <dougkwan@google.com>
9821
9822         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
9823         an elcpp::Ehdr as parameter.  Adjust call to set_target.
9824         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
9825         an elfcpp::Ehdr as parameter.
9826         * object.cc (Object::set_target): Remove the version that looks up
9827         a target and sets it.
9828         (Sized_relobj::setup): Take a Target object instead of
9829         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
9830         (make_elf_sized_object): Find target and ask target to
9831         make an ELF object.
9832         * object.h: (Object::set_target): Remove the version that looks up
9833         a target and sets it.
9834         (Sized_relobj::setup): Take a Target object instead of
9835         an elfcpp:Ehdr as parameter.
9836         * target.cc: Include dynobj.h.
9837         (Target::do_make_elf_object_implementation): New.
9838         (Target::do_make_elf_object): New.
9839         * target.h (Target::make_elf_object): New template declaration.
9840         (Target::do_make_elf_object): New method declarations.
9841         (Target::do_make_elf_object_implementation): New template declaration.
9842
9843 2009-08-14  Ian Lance Taylor  <iant@google.com>
9844
9845         * gold.h (FUNCTION_NAME): Define.
9846         (gold_unreachable): Use FUNCTION_NAME.
9847
9848 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9849
9850         * icf.cc (Icf::find_identical_sections): Issue a warning when a
9851         symbol in the --keep-unique list is not found.
9852
9853 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
9854
9855         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
9856         been maked as --keep-unique.
9857         (Icf::unfold_section): New function.
9858         * icf.h (Icf::unfold_section): New function.
9859         * options.h (General_options::keep_unique): New option.
9860         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
9861         * testsuite/Makefile.in: Regenerate.
9862         * testsuite/icf_keep_unique_test.sh: New file.
9863         * testsuite/icf_keep_unique_test.cc: New file.
9864
9865 2009-08-12  Cary Coutant  <ccoutant@google.com>
9866
9867         PR 10471
9868         * resolve.cc (Symbol_table::resolve): Check for references from
9869         dynamic objects to hidden and internal symbols.
9870         * testsuite/Makefile.am (hidden_test.sh): New test.
9871         * testsuite/Makefile.in: Regenerate.
9872         * testsuite/hidden_test.sh: New script.
9873         * testsuite/hidden_test_1.c: New test source.
9874         * testsuite/hidden_test_main.c: New test source.
9875
9876 2009-08-11  Doug Kwan  <dougkwan@google.com>
9877
9878         * arm.cc: Update comments.
9879         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
9880         segment to locate the .ARM.exidx section if present.
9881
9882 2009-08-09  Doug Kwan  <dougkwan@google.com>
9883
9884         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
9885         patch.
9886
9887 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
9888         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
9889         compiler warnings.
9890
9891 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
9892
9893         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
9894         valid tls_segment only for non-debug-section relocations.
9895         * testsuite/Makefile.am: Add gc_tls_test.
9896         * testsuite/Makefile.in: Regenerate.
9897         * testsuite/gc_tls_test.cc: New file.
9898         * testsuite/gc_tls_test.sh: New file.
9899
9900 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
9901
9902         * icf.cc: New file.
9903         * icf.h: New file.
9904         * Makefile.am (CCFILES): Add icf.cc.
9905         (HFILES): Add icf.h
9906         * Makefile.in: Regenerate.
9907         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
9908         * gc.h (gc_process_relocs): Populate lists used by icf to contain
9909         section, symbol and addend information for the relocs.
9910         * gold.cc (queue_middle_tasks): Call identical code folding.
9911         * gold.h: Add defines for multimap.
9912         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
9913         to the call of finalize_local_symbols.
9914         * main.cc (main): Create object of class Icf.
9915         * object.cc (Sized_relobj::do_layout): Allow this function to be
9916         called twice during icf.
9917         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
9918         to sections marked as identical by icf.
9919         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
9920         when available.
9921         (Sized_relobj::do_section_entsize): New function.
9922         * object.h (Object::section_entsize): New function.
9923         (Object::do_section_entsize): New pure virtual function.
9924         (Relobj::finalize_local_symbols): Add new parameter.
9925         (Relobj::do_section_entsize): New function.
9926         * options.h (General_options::icf): New option.
9927         (General_options::icf_iterations): New option.
9928         (General_options::print_icf_sections): New option.
9929         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
9930         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
9931         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
9932         icf.
9933         * symtab.cc (Symbol_table::is_section_folded): New function.
9934         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
9935         to sections marked as identical by icf.
9936         * symtab.h (Symbol_table::set_icf): New function.
9937         (Symbol_table::icf): New function.
9938         (Symbol_table::is_section_folded): New function.
9939         (Symbol_table::icf_): New data member.
9940         * target-reloc.h (relocate_section): Ignore sections folded by icf.
9941         * testsuite/Makefile.am: Add commands to build icf_test.
9942         * testsuite/Makefile.in: Regenerate.
9943         * testsuite/icf_test.sh: New file.
9944         * testsuite/icf_test.cc: New file.
9945
9946 2009-07-24  Chris Demetriou  <cgd@google.com>
9947
9948         * layout.cc (is_compressible_debug_section): Fix incorrect
9949         comment about compressed section names.
9950
9951 2009-07-20  Ian Lance Taylor  <ian@airs.com>
9952
9953         PR 10419
9954         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
9955
9956 2009-07-16  Ian Lance Taylor  <iant@google.com>
9957
9958         PR 10400
9959         * layout.h: #include <map>.
9960         (class Kept_section): Change from struct to class.  Add accessors
9961         and setters.  Add section size to Comdat_group mapping.  Change
9962         Comdat_group to std::map.  Add is_comdat_ field.  Add
9963         linkonce_size field in union.
9964         (class Layout): Update declaration of find_or_add_kept_section.
9965         Don't declare find_kept_object.
9966         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
9967         parameter.  Add object, shndx, is_comdat, and is_group_name
9968         parameters.  Change all callers.  Adjust for new Kept_section.
9969         (Layout::find_kept_object): Remove.
9970         * object.cc (Sized_relobj::include_section_group): Update use of
9971         Kept_section.  Rename secnum to shndx.  Only record
9972         Kept_comdat_section if sections are the same size.
9973         (Sized_relobj::include_linkonce_section): Update use of
9974         Kept_section.  Only record Kept_comdat_section if sections are the
9975         same size.  Set size of linkonce section.
9976         (Sized_relobj::map_to_kept_section): Update call to
9977         get_kept_comdat_section.
9978         * object.h (class Sized_relobj): Rename fields in
9979         Kept_comdat_section to drop trailing underscores; change object
9980         field to Relobj*.  Change Kept_comdat_section_table to store
9981         struct rather than pointer.
9982         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
9983         Add kept_object and kept_shndx parameters.  Change all callers.
9984         (Sized_relobj::get_kept_comdat_section): Change return type to
9985         bool.  Add kept_object and kept_shndx parameters.  Change all
9986         callers.
9987         * plugin.cc (Pluginobj::include_comdat_group): Update call to
9988         Layout::find_or_add_kept_section.
9989
9990 2009-07-09  Ian Lance Taylor  <iant@google.com>
9991
9992         * merge.cc (Object_merge_map::initialize_input_to_output_map):
9993         Reserve space in the hash table.
9994
9995 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
9996
9997         * fileread.cc (File_read::get_mtime): New method.
9998         * fileread.h (Timespec): New structure.
9999         (File_read::get_mtime): New method.
10000         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10001         Renamed from timestamp_nsec.
10002         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10003         Elf_Xword.
10004         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10005         timestamp_nsec.
10006         (Incremental_inputs::report_archive): Save mtime; style fix.
10007         (Incremental_inputs::report_obejct): Save mtime; style fix.
10008         (Incremental_inputs::report_script): Save mtime; style fix.
10009         (Incremental_inputs::finalize_inputs): Style fix.
10010         (Incremental_inputs::finalize): Style fix.
10011         (Incremental_inputs::create_input_section_data): Store inputs
10012         mtime.
10013         * incremental.h (Incremental_inputs::report_script): Add mtime
10014         argument.
10015         (Incremental_inputs::Input_info::Input_info): Intialize only one
10016         union member.
10017         (Incremental_inputs::Input_info::archive): Move to nameless
10018         union.
10019         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10020         (Incremental_inputs::Input_info::script): Move to nameless union.
10021         (Incremental_inputs::mtime): New field.
10022         * script.cc (read_input_script): Pass file mtime to
10023         Incremental_input.
10024         * script.h (Script_info::inputs): Style fix.
10025
10026 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10027
10028         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10029         instead of 32.
10030
10031 2009-06-24  Ian Lance Taylor  <iant@google.com>
10032
10033         PR 10156
10034         * layout.cc (Layout::choose_output_section): If we find an
10035         existing section, update the flags.
10036         (Layout::create_notes): New function, broken out of
10037         Layout::finalize.
10038         (Layout::finalize): Don't create note sections.
10039         (Layout::create_note): Don't crash if linker script discards
10040         section.
10041         (Layout::create_gold_note): Likewise.
10042         (Layout::create_build_id): Likewise.  Don't set
10043         after_input_sections on the section.
10044         (Layout::create_executable_stack_info): Remove target parameter.
10045         Change caller.
10046         * layout.h (class Layout): Declare create_notes.  Update
10047         declaration of create_executable_stack_info.
10048         * gold.cc (queue_middle_tasks): Call create_notes.
10049         * output.cc (Output_section::update_flags_for_input_section): Move
10050         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10051         invalid.
10052         * output.h (Output_data::mark_address_invalid): New function.
10053         (class Output_section): Only declare, not define,
10054         update_flags_for_input_section.  Remove set_flags.
10055
10056 2009-06-24  Ian Lance Taylor  <iant@google.com>
10057
10058         * script-sections.cc (Output_section_definition::
10059         set_section_addresses): Rename shadowing local load_address to
10060         laddr.
10061
10062 2009-06-24  Ian Lance Taylor  <iant@google.com>
10063
10064         PR 10244
10065         * reloc.cc (relocate_sections): Skip empty relocation sections.
10066
10067 2009-06-23  Ian Lance Taylor  <iant@google.com>
10068
10069         PR 10156
10070         * layout.cc (Layout::create_note): Use choose_output_section
10071         rather than make_output_section.
10072
10073 2009-06-23  Ian Lance Taylor  <iant@google.com>
10074
10075         PR 10237
10076         * options.cc (General_options::parse_V): Set printed_version_.
10077         (General_options::General_options): Initialize printed_version_.
10078         * options.h (class General_options): Add printed_version_ field.
10079         * gold.cc (queue_initial_tasks): If there are no input files,
10080         don't give a fatal error if we printed the version information.
10081         (queue_middle_tasks): If using -r with a shared object, give a
10082         fatal error rather than an ordinary error.
10083
10084 2009-06-23  Ian Lance Taylor  <iant@google.com>
10085
10086         PR 10219
10087         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10088         (Layout::make_output_section): Set have_stabstr_section_ if we see
10089         a .stab*str section.
10090         (Layout::finalize): Call link_stabs_sections.
10091         (Layout::link_stabs_sections): New file.
10092         * layout.h (class Layout): Add have_stabstr_section_ field.
10093         Declare link_stabs_sections.
10094
10095 2009-06-23  Doug Kwan  <dougkwan@google.com>
10096
10097         * Makefile.am (libgold_a_LIBADD): New.
10098         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10099         * Makefile.in: Regenerate.
10100         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10101         * configure: Regenerate.
10102         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10103         * fileread.cc: Include sys/state.h
10104         * gold.h: Declare memmem and strndup if found missing.
10105         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10106
10107 2009-06-23  Ian Lance Taylor  <iant@google.com>
10108
10109         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10110         * configure: Rebuild.
10111
10112 2009-06-23  Ian Lance Taylor  <iant@google.com>
10113
10114         PR 10147
10115         * object.cc (Object::section_contents): Don't try to get a view if
10116         the section has length zero.
10117         (Object::handle_gnu_warning_section): If the section is empty, use
10118         the name of the section as the warning.
10119
10120 2009-06-23  Ian Lance Taylor  <iant@google.com>
10121
10122         PR 10133
10123         * stringpool.h (class Stringpool_template): Add optimize_ field.
10124         (Stringpool_template::set_optimize): New function.
10125         * stringpool.cc (Stringpool_template::Stringpool_template):
10126         Initialize optimize_ field.
10127         (Stringpool_template::set_string_offsets): Test local optimize
10128         fild rather than parameter.
10129         * layout.cc (Layout::Layout): Call set_optimize on the section
10130         name stringpool.
10131
10132 2009-06-22  Ian Lance Taylor  <iant@google.com>
10133
10134         PR 10030
10135         * yyscript.y: Parse TARGET.
10136         * script.cc (script_set_target): New function.
10137         * script-c.h (script_set_target): Declare.
10138         * options.cc (General_options::string_to_object_format): Rename
10139         from string_to_object_format in anonymous namespace.  Change
10140         callers.
10141         * options.h (class General_options): Declare
10142         string_to_object_format.
10143
10144 2009-06-22  Ian Lance Taylor  <iant@google.com>
10145
10146         * script-sections.cc (Script_sections::create_segments): Don't put
10147         program headers in a PT_LOAD segment if -n or -N.
10148
10149 2009-06-22  Ian Lance Taylor  <iant@google.com>
10150
10151         PR 10141
10152         * options.h (class General_options): Add -z lazy and -z now.  Sort
10153         -z options into alphabetical order.
10154         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10155
10156 2009-06-21  Ian Lance Taylor  <iant@google.com>
10157
10158         * layout.cc (Layout::make_output_section): Call
10159         Target::new_output_section.
10160         (Layout::attach_allocated_section_to_segment): Put large section
10161         sections in a separate load segment with the large segment flag
10162         set.
10163         (Layout::segment_precedes): Sort large data segments after other
10164         load segments.
10165         (align_file_offset): New static function.
10166         (Layout::set_segment_offsets): Use align_file_offset.
10167         * output.h (class Output_section): Add is_small_section_ and
10168         is_large_section_ fields.
10169         (Output_section::is_small_section): New function.
10170         (Output_section::set_is_small_section):  New function.
10171         (Output_section::is_large_section): New function.
10172         (Output_section::set_is_large_section): New function.
10173         (Output_section::is_large_data_section): New function.
10174         (class Output_segment): Add is_large_data_segment_ field.
10175         (Output_segment::is_large_data_segment): New function.
10176         (Output_segment::set_is_large_data_segment): New function.
10177         * output.cc (Output_section::Output_section): Initialize new
10178         fields.
10179         (Output_segment::Output_segment): Likewise.
10180         (Output_segment::add_output_section): Add assertion that large
10181         data sections always go in large data segments.  Force small data
10182         sections to the end of the list of data sections.  Force small BSS
10183         sections to the start of the list of BSS sections.  For large BSS
10184         sections to the end of the list of BSS sections.
10185         * symtab.h (class Symbol): Declare is_common_shndx.
10186         (Symbol::is_defined): Check Symbol::is_common_shndx.
10187         (Symbol::is_common): Likewise.
10188         (class Symbol_table): Define enum Commons_section_type.  Update
10189         declarations.  Add small_commons_ and large_commons_ fields.
10190         * symtab.cc (Symbol::is_common_shndx): New function.
10191         (Symbol_table::Symbol_table): Initialize new fields.
10192         (Symbol_table::add_from_object): Put small and large common
10193         symbols in the right list.
10194         (Symbol_table::sized_finalized_symbol): Check
10195         Symbol::is_common_shndx.
10196         (Symbol_table::sized_write_globals): Likewise.
10197         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10198         common symbol lists.  Don't call do_allocate_commons_list if the
10199         list is empty.
10200         (Symbol_table::do_allocate_commons_list): Remove is_tls
10201         parameter.  Add comons_section_type parameter.  Change all
10202         callers.  Handle small and large common symbols.
10203         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10204         Symbol::is_common_shndx.
10205         * resolve.cc (symbol_to_bits): Likewise.
10206         * target.h (Target::small_common_shndx): New function.
10207         (Target::small_common_section_flags): New function.
10208         (Target::large_common_shndx): New function.
10209         (Target::large_common_section_flags): New function.
10210         (Target::new_output_section): New function.
10211         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10212         small_common_section_flags, and large_common_section_flags
10213         fields.
10214         (Target::do_new_output_section): New virtual function.
10215         * arm.cc (Target_arm::arm_info): Initialize new fields.
10216         * i386.cc (Target_i386::i386_info): Likewise.
10217         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10218         Likewise.
10219         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10220         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10221         (Target_x86_64::do_new_output_section): New function.
10222         * configure.ac: Define conditional MCMODEL_MEDIUM.
10223         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10224         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10225         (large_LDFLAGS): Define.
10226         * testsuite/large.c: New file.
10227         * testsuite/testfile.cc (Target_test::test_target_info):
10228         Initialize new fields.
10229         * configure, testsuite/Makefile.in: Rebuild.
10230
10231 2009-06-05  Doug Kwan  <dougkwan@google.com>
10232
10233         * Makefile.am (CCFILES): Add target.cc.
10234         * Makefile.in: Regenerate.
10235         * i386.cc (class Target_i386): Define new virtual method to
10236         override do_is_local_label_name in parent.
10237         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10238         local symbols if --discard-locals or -X is given.
10239         * options.h (class General_options): Declare new options
10240         '--discard-locals' and '-X' for discarding locals.
10241         * target.h (class Target): Define new methods is_local_label_name.
10242         Declare new virtual method do_is_local_label_name.
10243         * target.cc: New file.
10244         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10245         (check_SCRIPTS): Add discard_locals_test.sh.
10246         (check_DATA): Add discard_local_tests.syms.
10247         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10248         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10249         * testsuite/Makefile.in: Regenerate.
10250         * testsuite/discard_locals_test.c: New file.
10251         * testsuite/discard_locals_test.sh: Same.
10252
10253 2009-06-05  Doug Kwan  <dougkwan@google.com>
10254
10255         * object.cc (Sized_relobj::Sized_relobj): Initialize
10256         discarded_eh_frame_shndx_ to -1U.
10257         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10258         section.
10259         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10260         a discarded .eh_frame section.
10261         (Sized_relobj::do_finalize_local_symbols): Ditto.
10262         * object.h (class Sized_relobj): Declare new member
10263         discarded_eh_frame_shndx_.
10264         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10265         (local_labels_test.o, local_labels_test): New rules.
10266         * testsuite/Makefile.in: Regenerate.
10267
10268 2009-06-04  Doug Kwan  <dougkwan@google.com>
10269
10270         * layout.cc (Layout::section_name_mapping): Add mapping for
10271         special ARM sections.
10272
10273 2009-06-03  Doug Kwan  <dougkwan@google.com>
10274
10275         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10276         (utils::has_overflow): Same.
10277
10278 2009-06-03  Ian Lance Taylor  <iant@google.com>
10279
10280         * layout.cc (Layout::section_name_mapping): New array, replacing
10281         Layout::linkonce_mapping.
10282         (Layout::section_name_mapping_count): New variable, replacing
10283         Layout::linkonce_mapping_count.
10284         (Layout::linkonce_output_name): Remove.
10285         (Layout::output_section_name): Rewrite.
10286         * layout.h (class Layout): Rename Linkonce_mapping to
10287         Section_name_mapping, linkonce_mapping to section_name_mapping,
10288         linkonce_mapping_count to section_name_mapping_count.  Don't
10289         declare linkonce_output_name.
10290
10291 2009-06-03  Doug Kwan  <dougkwan@google.com>
10292
10293         * gold/arm.cc (namespace utils): New.
10294         (Target_arm::reloc_is_non_pic): Define new method.
10295         (class Arm_relocate_functions): New.
10296         (Target_arm::Relocate::relocate): Handle relocation types used by
10297         Android.
10298
10299 2009-06-03  Ian Lance Taylor  <iant@google.com>
10300
10301         * arm.cc (Target_arm::scan::global): Use || instead of |.
10302
10303 2009-06-02  Doug Kwan  <dougkwan@google.com>
10304
10305         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10306         issued_non_pic_error_.
10307         (class Target_arm::Scan): Declare new method check_non_pic.
10308         Define new method symbol_needs_plt_entry.
10309         Declare new data member issued_non_pic_error_.
10310         (class Target_arm::Relocate): Declare new method
10311         should_apply_static_reloc.
10312         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10313         (Target_arm::Scan::check_non_pic): Define new method.
10314         (Target_arm::Scan::local): Handle a small subset of reloc types used
10315         by Android.
10316         (Target_arm::Scan::local): Same.
10317         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10318
10319 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10320
10321         * incremental.cc (Incremental_inputs::report_command_line): Filter
10322         out --incremental-* options.
10323
10324 2009-05-29  Doug Kwan  <dougkwan@google.com>
10325
10326         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10327         template class.
10328         (class Target_arm): Update comment.
10329         (Target_arm::Target_arm): Initialize new data members GOT_,
10330         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10331         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10332         and Target_arm::rel_dyn_section.
10333         Declare new_enum Target_arm::Got_type.
10334         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10335         and DYNBSS_.
10336         Update commments for member do_dynsym_value.
10337         (Target_arm::got_size, Target_arm::plt_section,
10338         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10339         new methods inside class defintion.
10340         (Target_arm::got_section): Define new method.
10341         (Target_arm::rel_dyn_section): Same.
10342         (Output_data_plt_arm): New template class.
10343         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10344         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10345         (Output_data_plt_arm::add_entry): Same.
10346         (Output_data_plt_arm::first_plt_entry): Define new
10347         static data member for PLT instruction template.
10348         (Output_data_plt_arm::plt_entry): Same.
10349         (Output_data_plt_arm::do_write): Define new method.
10350         (Target_arm::make_plt_entry): Same.
10351         (Target_arm::do_finalize_sections): Same.
10352         (Target_arm::do_dynsym_value): Same.
10353
10354 2009-05-28  Doug Kwan  <dougkwan@google.com>
10355
10356         * Makefile.am (TARGETSOURCES): Add arm.cc.
10357         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10358         * Makefile.in: Regenerate.
10359         * arm.cc: New file.
10360         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10361
10362 2009-05-26  Doug Kwan  <dougkwan@google.com>
10363
10364         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10365         (General_options::check_excluded_libs): Strip off directories in
10366         archive name before matching like GNU ld does.
10367         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10368         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10369         (exclude_libs_test_LDFLAGS): Add linker option
10370         -Wl,--exclude-libs,libexclude_libs_test_3
10371         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10372         an explicit archive without using -l.
10373         (alt/libexclude_libs_test_3.a): New make rule.
10374         * testsuite/Makefile.in: Regenerate.
10375         * testsuite/exclude_libs_test.c : Declare lib3_default().
10376         (main): Call it.
10377         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10378         * exclude_libs_test_3.c: New file.
10379
10380 2009-05-26  Nick Clifton  <nickc@redhat.com>
10381
10382         * po/id.po: New Indonesian translation.
10383         * po/gold.pot: Updated template file.
10384
10385 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10386
10387         * testsuite/Makefile.am: Add -ffunction-sections to compile
10388         gc_comdat_test files.  Add -Wl,--gc-sections to build
10389         gc_comdat_test.
10390         * testsuite/Makefile.in: Regenerate.
10391         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10392
10393 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10394
10395         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10396         kept comdat section was garbage collected.
10397         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10398         * testsuite/Makefile.in: Regenerate.
10399         * testsuite/gc_comdat_test.sh: New file.
10400         * testsuite/gc_comdat_test_1.cc: New file.
10401         * testsuite/gc_comdat_test_2.cc: New file.
10402
10403 2009-05-19  Doug Kwan  <dougkwan@google.com>
10404
10405         * archive.cc (Archive::Archive): Move constructor from archive.h
10406         to here.  Initialize no_export_.
10407         (Archive::get_elf_object_for_member): Set no_export flag of object.
10408         * archive.h (Archive::Archive): Move constructor body to
10409         archive.cc.
10410         (Archive::no_export): New method.
10411         (Archive::no_export_): New field.
10412         * object.h (Object::Object): Initialize no_export_ to false.
10413         (Object::no_export, Object::set_no_export): New methods.
10414         (Object::no_export_): New field.
10415         * options.cc (General_options::parse_exclude_libs): New method.
10416         (General_options::check_excluded_libs) Same.
10417         * options.h (exclude_libs): New option.
10418         (General_options::check_excluded_libs): New method declaration.
10419         (General_options::excluded_libs_): New field.
10420         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10421         default or protected visibility if an object has no-export flag set.
10422         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10423         (check_SCRIPTS): Add exclude_libs_test.sh.
10424         (check_DATA): Add exclude_libs_test.syms.
10425         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10426         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10427         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10428         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10429         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10430         libexclude_libs_test_2.a): New rules.
10431         * testsuite/Makefile.in: Regenerate.
10432         * testsuite/exclude_libs_test.c: New file.
10433         * testsuite/exclude_libs_test.sh: Ditto.
10434         * testsuite/exclude_libs_test_1.c: Ditto.
10435         * testsuite/exclude_libs_test_2.c: Ditto.
10436
10437 2009-05-15  Ian Lance Taylor  <iant@google.com>
10438
10439         * configure.ac: Check for declarations for cases where libiberty.h
10440         checks HAVE_DECL_xxx.
10441         * configure, config.in: Rebuild.
10442
10443 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10444
10445         * gold.h (Incremental_argument_list): Remove (invalid) forward
10446         declaration.
10447         * incremental.cc (Incremental_inputs::report_achive): New method.
10448         (Incremental_inputs::report_object): New method.
10449         (Incremental_inputs::report_script): New method.
10450         (Incremental_inputs::finalize_inputs): New method.
10451         (Incremental_inputs::finalize): Call finalize_inputs().
10452         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10453         Create inputs entries.
10454         * incremental.h (Incremental_input_type): New enum.
10455         (Incremental_inputs::Incremental_input): Initialize new fields.
10456         (Incremental_inputs::report_inputs): New method.
10457         (Incremental_inputs::report_achive): New method.
10458         (Incremental_inputs::report_object): New method.
10459         (Incremental_inputs::report_script): New method.
10460         (Incremental_inputs::finalize_inputs): New method.
10461         (Incremental_inputs::Input_info): New struct.
10462         (Incremental_inputs::Input_info_map): New typedef.
10463         (Incremental_inputs::lock_): New field.
10464         (Incremental_inputs::Inputs_): New field.
10465         (Incremental_inputs::Inputs_map): New field.
10466         * main.cc (main): Call Incremental_input::report_inputs.
10467         * options.h (Input_argument_list): Typedef moved from
10468         Input_arguments.
10469         (Input_file_group::Files): Remove, use ::Input_argument_list.
10470         (Input_file_group::Input_argument_list): Remove, use
10471         ::Input_argument_list.
10472         * plugin.cc (Plugin_manager::add_input_file): Add error in
10473         incremental build.
10474         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
10475         functions.
10476         * script.cc (read_input_script): Call
10477         Incremental_input::report_script.
10478         * script.h (Script_info): New class.
10479
10480 2009-04-27  Ian Lance Taylor  <iant@google.com>
10481
10482         * x86_64.cc (do_adjust_output_section): Set entsize to
10483         plt_entry_size.
10484
10485 2009-04-23  Elliott Hughes  <enh@google.com>
10486
10487         * output.cc (Output_file::close): After short writes, continue
10488         writing from the correct offset in the buffer being written.
10489
10490 2009-04-23  Chris Demetriou  <cgd@google.com>
10491
10492         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
10493         * configure: Regenerate.
10494         * config.in: Regenerate.
10495         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
10496         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
10497
10498 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
10499
10500         * incremental.cc (Incremental_inputs_header_data): Renamed from
10501         Incremental_input_header_data.
10502         (Incremental_inputs_header_data::data_size): New field.
10503         (Incremental_inputs_header_data::put_input_file_count): Renamed
10504         from input_file_count.
10505         (Incremental_inputs_header_data::put_command_line_offset): Renamed
10506         from command_line_offset.
10507         (Incremental_inputs_header_data::put_reserved): Renamed from
10508         put_reserved.
10509         (Incremental_inputs_entry_data): Renamed from
10510         Incremental_input_entry_data.
10511         (Incremental_inputs_entry_data::data_size): New field.
10512         (Incremental_inputs::report_command_line): New method.
10513         (Incremental_inputs::finalize): New method.
10514         (Incremental_inputs::create_incremental_inputs_data): New method.
10515         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
10516         * incremental.h: New file.
10517         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
10518         (Layout::finalize): Create incremental inputs section in
10519         incremental builds.
10520         (Layout::create_incremental_info_sections): New method.
10521         * layout.h (Layout::incremental_inputs): New method.
10522         (Layout::create_incremental_info_sections): New method.
10523         (Layout::incremental_inputs_): New field.
10524         * main.cc (main): Notify Incremental_input of the command line.
10525
10526 2009-04-01  Ian Lance Taylor  <iant@google.com>
10527             Mikolaj Zalewski  <mikolajz@google.com>
10528
10529         * gold.h (reserve_unordered_map): Define, three versions, one for
10530         each version of Unordered_map.
10531         * layout.cc (Layout::Layout): Remove options parameter.  Add
10532         number_of_input_files parameter.  Don't initialize options_.
10533         Initialize number_of_input_files_ and resized_signatures_.  Move
10534         sections_are_attached_.
10535         (Layout::layout_group): Reserve space for group_signatures_.
10536         (Layout::find_or_add_kept_section): Change name parameter to be a
10537         reference.  Resize signatures_ map when it gets large enough.
10538         (Layout::layout_eh_frame): Use parameters->options() instead of
10539         this->options_.
10540         (Layout::make_output_section): Likewise.
10541         (Layout::attach_allocated_section_to_segment): Likewise.
10542         (Layout::finalize, Layout::create_executable_stack): Likewise.
10543         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
10544         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
10545         * layout.h (class Layout): Update declarations.  Remove options_
10546         field.  Add number_of_input_files_ and resized_signatures_
10547         fields.  Move sections_are_attached_ field.
10548         * main.cc (main): Pass number of input files to Layout
10549         constructor.  Don't pass options.
10550
10551 2009-03-30  Ian Lance Taylor  <iant@google.com>
10552
10553         * ffsll.c (ffsll): Correct implementation.
10554
10555 2009-03-27  Ian Lance Taylor  <iant@google.com>
10556
10557         * ffsll.c: New file.
10558         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
10559         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
10560         * ftruncate.c (ftruncate): Declare before definition.
10561         * mremap.c (mremap): Likewise.
10562         * pread.c (pread): Likewise.
10563         * configure, Makefile.in, config.in: Rebuild.
10564
10565         * mremap.c: New file.
10566         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
10567         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
10568         (mremap): Declare if HAVE_MREMAP is not defined.
10569         * configure, Makefile.in, config.in: Rebuild.
10570
10571 2009-03-27  Cary Coutant  <ccoutant@google.com>
10572
10573         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
10574         position independent.
10575         * sparc.cc (Target_sparc::check_non_pic): Likewise.
10576         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
10577
10578 2009-03-24  Cary Coutant  <ccoutant@google.com>
10579
10580         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
10581         an executable.
10582         (needs_dynamic_reloc): Likewise.
10583
10584 2009-03-24  Ian Lance Taylor  <iant@google.com>
10585
10586         * yyscript.y (file_cmd): Recognize EXTERN.
10587         (extern_name_list, extern_name_list_body): New nonterminals.
10588         * script.cc (script_add_extern): Define.
10589         * script-c.h (script_add_extern): Declare.
10590
10591 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
10592
10593         * object.cc (is_elf_object): Define.
10594         * object.h (is_elf_object): Declare.
10595         * archive.cc (Archive::get_elf_object_for_member): Call
10596         is_elf_object.
10597         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
10598
10599 2009-03-24  Elliott Hughes  <enh@google.com>
10600
10601         * output.cc (Output_file::map_anonymous): Define.
10602         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
10603         try an anonymous one.  Report the size if the mmap fails.
10604         * output.h (class Output_file): Declare map_anonymous.
10605
10606 2009-03-24  Ian Lance Taylor  <iant@google.com>
10607
10608         * target-select.cc (instantiate_target): Don't acquire the lock if
10609         the instantiated_target_ field has already been set.
10610
10611 2009-03-23  Ian Lance Taylor  <iant@google.com>
10612
10613         * gold-threads.h (class Initialize_lock): Define.
10614         * gold-threads.cc (class Initialize_lock_once): Define.
10615         (initialize_lock_control): New static variable.
10616         (initialize_lock_pointer): New static variable.
10617         (initialize_lock_once): New static function.
10618         (Initialize_lock::Initialize_lock): Define.
10619         (Initialize_lock::initialize): Define.
10620         * target-select.h: Include "gold-threads.h".
10621         (class Target_selector): Add lock_ and initialize_lock_ fields.
10622         Don't define instantiate_target, just declare it.
10623         * target-select.cc (Target_selector::Target_selector): Initialize
10624         new fields.
10625         (Target_selector::instantiate_target): Define.
10626         * descriptors.h: Include "gold-threads.h".
10627         (class Descriptors): Add initialize_lock_ field.
10628         * descriptors.cc (Descriptors::Descriptors): Initialize new
10629         field.
10630         (Descriptors::open): Use initialize_lock_ field
10631         * errors.h (class Errors): Add initialize_lock_ field.
10632         * errors.cc (Errors::Errors): Initialize new field.
10633         (Errors::initialize_lock): Use initialize_lock_ field.
10634         * powerpc.cc (class Target_selector_powerpc): Remove
10635         instantiated_target_ field.  In do_recognize call
10636         instantiate_target rather than do_instantiate_target.  In
10637         do_instantiate_target just allocate a new target.
10638         * sparc.cc (class Target_selector_sparc): Likewise.
10639
10640         * freebsd.h: New file.
10641         * i386.cc: Include "freebsd.h".
10642         (Target_i386): Derive from Target_freebsd rather than
10643         Sized_target.
10644         (Target_selector_i386): Derive from Target_selector_freebsd rather
10645         than Target_selector.
10646         * x86_64.cc: Include "freebsd.h".
10647         (Target_x86_64): Derive from Target_freebsd rather than
10648         Sized_target.
10649         (Target_selector_x86_64): Derive from Target_selector_freebsd
10650         rather than Target_selector.
10651         * target.h (class Target): Add adjust_elf_header and
10652         do_adjust_elf_header.
10653         * output.cc (Output_file_header:: do_sized_write): Call target
10654         adjust_elf_header routine.
10655         * configure.tgt: Set targ_osabi.
10656         * configure.ac: Define GOLD_DEFAULT_OSABI.
10657         * parameters.cc (Parameters::default_target): Pass
10658         GOLD_DEFAULT_OSABI to select_target.
10659         * target-select.h (class Target_selector): Make instantiate_target
10660         protected rather than private.
10661         * Makefile.am (HFILES): Add freebsd.h.
10662         * configure, Makefile.in, config.in: Rebuild.
10663
10664         * merge.cc (do_add_input_section): Correct pend value.  Change
10665         message about last entry not being null terminated from error to
10666         warning.
10667
10668 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
10669
10670         * incremental.cc: New file.
10671         * Makefile.am (CCFILES): Add incremental.cc.
10672         * Makefile.in: Rebuild.
10673
10674 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
10675
10676         * layout.cc (Layout::output_section_name): Preserve names
10677         of '.note.' sections.
10678
10679 2009-03-19  Ian Lance Taylor  <iant@google.com>
10680
10681         * descriptors.cc (Descriptors::open): Check that the options are
10682         valid before using them.
10683
10684 2009-03-18  Ian Lance Taylor  <iant@google.com>
10685
10686         * script-sections.h: Include <list>.
10687         (class Script_sections): Change Sections_elements from std::vector
10688         to std::list.  Typedef public Elements_iterator.  Add
10689         orphan_section_placement_, data_segment_align_start_, and
10690         saw_data_segment_align_ fields.  Remove data_segment_align_index_
10691         field.
10692         * script-sections.cc (class Orphan_section_placement): New class.
10693         (class Sections_element): Add virtual functions is_relro and
10694         orphan_section_init.  Remove virtual function place_orphan_here.
10695         (class Output_section_definition): Add is_relro and
10696         orphan_section_init.  Remove place_orphan_here.
10697         (class Orphan_output_section): Likewise.
10698         (Script_sections::Script_sections): Update for field changes.
10699         (Script_sections::data_segment_align): Set saw_data_segment_align_
10700         and data_segment_align_start_, not data_segment_align_index.
10701         (Script_sections::data_segment_relro_end): Check
10702         saw_data_segment_align_.  Use data_segment_align_start_ rather
10703         than data_segment_align_index_.
10704         (Script_sections::place_orphan): Rewrite to use
10705         Orphan_section_placement.
10706
10707 2009-03-17  Ian Lance Taylor  <iant@google.com>
10708
10709         * archive.cc (Archive::add_symbols): Check for a version attached
10710         to the symbol name in the archive map.
10711         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
10712         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
10713         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
10714         (ver_test_11.a): New target.
10715         * testsuite/Makefile.in: Rebuild.
10716
10717         * configure.ac: Check for chsize and posix_fallocate.  Replace
10718         ftruncate.
10719         * ftruncate.c: New file, from gnulib.
10720         * output.cc (posix_fallocate): Define dummy version if not
10721         HAVE_POSIX_FALLOCATE.
10722         (Output_file::map): Call posix_fallocate rather than lseek and
10723         write.
10724         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
10725         * configure, Makefile.in, config.in: Rebuild.
10726
10727 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
10728
10729         * layout.h (Layout::create_note): Add section_name parameter.
10730         * layout.cc (Layout::create_note): Likewise.
10731         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
10732
10733 2009-03-17  Ian Lance Taylor  <iant@google.com>
10734
10735         * descriptors.cc: Include "options.h".
10736         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
10737         (Descriptors::open): Always use O_CLOEXEC when opening a new
10738         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
10739         then set FD_CLOEXEC.
10740
10741         * sparc.cc (class Target_sparc): Add has_got_section.
10742         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
10743         make sure we have a GOT section.
10744
10745         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
10746         (Target_sparc::Scan::local): Likewise.
10747         (Target_sparc::Scan::global): Likewise.
10748         (Target_sparc::Relocate::relocate): Likewise.
10749         (Target_sparc::Relocate::relocate_tls): Likewise.
10750
10751         * symtab.cc (Symbol_table::define_default_version): New function,
10752         broken out of add_from_object.
10753         (Symbol_table::add_from_object): Call define_default_version.
10754         (Symbol_table::define_special_symbol): Add resolve_oldsym
10755         parameter.  Change all callers.  If the version for a symbol comes
10756         from a version script, resolve it with the symbol with the same
10757         name with no version.  Also add the symbol without a version if
10758         appropriate.
10759         (do_define_in_output_data): If resolving with oldsym, don't delete
10760         sym.
10761         (do_define_in_output_segment): Likewise.
10762         (do_define_as_constant): Likewise.
10763         * symtab.h (class Symbol_table): Update declarations.
10764
10765 2009-03-13  Ian Lance Taylor  <iant@google.com>
10766
10767         * readsyms.cc (Read_symbols::incompatible_warning): New function.
10768         (Read_symbols::requeue): New function.
10769         (Read_symbols::do_read_symbols): If make_elf_object fails because
10770         the target type is not configured, and the file was searched for,
10771         issue a warning and retry with the next directory.
10772         (Add_symbols::run): If the file has an incompatible format, and
10773         it was searched for, requeue the Read_symbols task.  On error,
10774         release the object.
10775         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
10776         dirindex parameter to constructor.  Change all callers.  Declare
10777         incompatible_warning and requeue.
10778         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
10779         input_argument_ and input_group_ fields.  Add them to
10780         constructor.  Change all callers.
10781         (class Read_script): Add dirindex_ field.  Add it to constructor.
10782         Change all callers.
10783         * archive.cc (Archive::setup): Remove input_objects parameter.
10784         Change all callers.
10785         (Archive::get_file_and_offset): Likewise.
10786         (Archive::read_all_symbols): Likewise.
10787         (Archive::read_symbols): Likewise.
10788         (Archive::get_elf_object_for_member): Remove input_objects
10789         parameter.  Add punconfigured parameter.  Change all callers.
10790         (Archive::add_symbols): Change return type to bool.  Check return
10791         value of include_member.
10792         (Archive::include_all_members): Likewise.
10793         (Archive::include_member): Change return type to bool.  Return
10794         false if first included object has incompatible target.  Set
10795         included_member_ field.
10796         (Add_archive_symbols::run): If add_symbols returns false, requeue
10797         Read_symbols task.
10798         * archive.h (class Archive): Add included_member_ field.
10799         Initialize it in constructor.  Add input_file and searched_for
10800         methods.  Update declarations.
10801         (class Add_archive_symbols): Add dirpath_, dirindex_, and
10802         input_argument_ fields.  Add them to constructor.  Change all
10803         callers.
10804         * script.cc: Include "target-select.h".
10805         (class Parser_closure): Add skip_on_incompatible_target_ and
10806         found_incompatible_target_ fields.  Add
10807         skip_on_incompatible_target parameter to constructor.  Change all
10808         callers.  Add methods skip_on_incompatible_target,
10809         clear_skip_on_incompatible_target, found_incompatible_target, and
10810         set_found_incompatible_target.
10811         (read_input_script): Add dirindex parameter.  Change all callers.
10812         If parser finds an incompatible target, requeue Read_symbols
10813         task.
10814         (script_set_symbol): Clear skip_on_incompatible_target in
10815         closure.
10816         (script_add_assertion, script_parse_option): Likewise.
10817         (script_start_sections, script_add_phdr): Likewise.
10818         (script_check_output_format): New function.
10819         * script.h (read_input_script): Update declaration.
10820         * script-c.h (script_check_output_format): Declare.
10821         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
10822         (ignore_cmd): Remove OUTPUT_FORMAT.
10823         * fileread.cc (Input_file::Input_file): Add explicit this.
10824         (Input_file::will_search_for): New function.
10825         (Input_file::open): Add pindex parameter.  Change all callers.
10826         * fileread.h (class Input_file): Add input_file_argument method.
10827         Declare will_search_for.  Update declarations.
10828         * object.cc (make_elf_object): Add punconfigured parameter.
10829         Change all callers.
10830         * object.h (class Object): Make input_file public.  Add
10831         searched_for method.
10832         (make_elf_object): Update declaration.
10833         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
10834         restart search.
10835         * dirsearch.h (class Dirsearch): Update declaration.
10836         * options.h (class General_options): Add --warn-search-mismatch.
10837         * parameters.cc (Parameters::is_compatible_target): New function.
10838         * parameters.h (class Parameters): Declare is_compatible_target.
10839         * workqueue.cc (Workqueue::add_blocker): New function.
10840         * workqueue.h (class Workqueue): Declare add_blocker.
10841
10842         * fileread.cc (Input_file::open): Remove options parameter.
10843         Change all callers.
10844         (Input_file::open_binary): Likewise.
10845         * script.cc (read_input_script): Likewise.
10846         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
10847         options parameter from constructor.  Change all callers.
10848         (class Read_script): Likewise.
10849         * fileread.h (class Input_file): Update declarations.
10850         * script.h (read_input_script): Update declaration.
10851
10852 2009-03-10  Nick Clifton  <nickc@redhat.com>
10853
10854         * po/es.po: New Spanish translation.
10855
10856 2009-03-06  Cary Coutant  <ccoutant@google.com>
10857
10858         * options.cc (parse_short_option): Keep dash_z from registering itself.
10859
10860 2009-03-03  Ian Lance Taylor  <iant@google.com>
10861
10862         PR 9918
10863         * target-reloc.h (relocate_section): Pass output_section to
10864         relocate.
10865         * i386.cc (Target_i386::should_apply_static_reloc): Add
10866         output_section parameter.  Change all callers.
10867         (Target_i386::Relocate::relocate): Add output_section parameter.
10868         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
10869         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
10870         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
10871         * testsuite/two_file_shared.sh: New script.
10872         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
10873         (check_DATA): Add two_file_shared.dbg.
10874         (two_file_shared.dbg): New target.
10875         * testsuite/Makefile.in: Rebuild.
10876
10877 2009-03-01  Ian Lance Taylor  <iant@google.com>
10878
10879         * configure.ac: Check for byteswap.h.
10880         * configure: Rebuild.
10881         * config.in: Rebuild.
10882
10883 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
10884
10885         * layout.cc (Layout::find_or_add_kept_section): New function.
10886         (Layout::add_comdat): Removed.
10887         * layout.h (struct Kept_section): Move out of class Layout.
10888         Remove trailing underscores from field names.  Add group_sections
10889         field.  Rename group_ field to is_group.  Change all uses.
10890         (class Layout): Declare find_or_add_kept_section, not add_comdat.
10891         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
10892         comdat_groups_ field.
10893         (Sized_relobj::include_section_group): Use
10894         find_or_add_kept_section and Kept_section::group_sections.
10895         (Sized_relobj::include_linkonce_section): Likewise.
10896         * object.cc (class Sized_relobj): Don't define Comdat_group or
10897         Comdat_group_table.  Remove find_comdat_group and
10898         add_comdat_group.  Remove comdat_groups_ field.
10899         * plugin.cc (include_comdat_group): Use
10900         Layout::find_or_add_kept_section.
10901
10902 2009-02-28  Ian Lance Taylor  <iant@google.com>
10903
10904         * README: --gc-sections and map files are now supported.  Document
10905         some build requirements.
10906
10907         PR 6992
10908         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
10909         relocatable link set the value of the section symbol to zero.
10910         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
10911         relocatable link don't include the section address in the local
10912         symbol value.
10913
10914 2009-02-27  Ian Lance Taylor  <iant@google.com>
10915
10916         PR 6811
10917         * options.h (class Search_directory): Add is_system_directory.
10918         (class General_options): Declare is_in_system_directory.
10919         * options.cc (get_relative_sysroot): Make static.
10920         (get_default_sysroot): Make static.
10921         (General_optoins::is_in_system_directory): New function.
10922         * fileread.cc (Input_file::is_in_system_directory): New function.
10923         * fileread.h (class Input_file): Declare is_in_system_directory.
10924         * object.h (class Object): Add is_in_system_directory.
10925         (class Input_objects): Remove system_library_directory_ field.
10926         * object.cc (Input_objects::add_object): Don't set
10927         system_library_directory_.
10928         (input_objects::found_in_system_library_directory): Remove.
10929         * symtab.cc (Symbol_table::write_globals): Remove input_objects
10930         parameter.  Change all callers.
10931         (Symbol_table::sized_write_globals): Likewise.
10932         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
10933         Call Object::is_in_system_directory.
10934         * symtab.h (class Symbol_table): Update declarations.
10935
10936         PR 5990
10937         * descriptors.h (Open_descriptor): Add is_on_stack field.
10938         * descriptors.cc (Descriptors::open): If the descriptor is on the
10939         top of the stack, remove it.  Initialize is_on_stack field.
10940         (Descriptors::release): Only add pod to stack if it is not on the
10941         stack already.
10942         (Descriptors::close_some_descriptor): Clear stack_next and
10943         is_on_stack fields.
10944
10945         PR 7091
10946         * output.cc (Output_section::find_starting_output_address): Rename
10947         from starting_output_address; add PADDR parameter; change return
10948         type.
10949         * output.h (class Output_section): Declare
10950         find_starting_output_address instead of starting_output_address.
10951         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
10952         section symbol for which we can't find a merge section.
10953
10954         PR 9836
10955         * symtab.cc (Symbol_table::add_from_object): If the visibility is
10956         hidden or internal, force the symbol to be local.
10957         * resolve.cc (Symbol::override_visibility): Define.
10958         (Symbol::override_base): Use override_visibility.
10959         (Symbol_table::resolve): Likewise.
10960         (Symbol::override_base_with_special): Likewise.
10961         (Symbol_table::override_with_special): If the visibility is hidden
10962         or internal, force the symbol to be local.
10963         * symtab.h (class Symbol): Add set_visibility and
10964         override_visibility.
10965         * testsuite/ver_test_1.sh: New file.
10966         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
10967         (check_DATA): Add ver_test_1.syms.
10968         (ver_test_1.syms): New target.
10969         * testsuite/Makefile.in: Rebuild.
10970
10971 2009-02-25  Cary Coutant  <ccoutant@google.com>
10972
10973         * layout.cc (Layout::choose_output_section): Don't rename sections
10974         when using a linker script that has a SECTIONS clause.
10975         * Makefile.in: Regenerate.
10976
10977         * testsuite/Makefile.am (script_test_5.sh): New test case.
10978         * testsuite/Makefile.in: Regenerate.
10979         * testsuite/script_test_5.cc: New file.
10980         * testsuite/script_test_5.sh: New file.
10981         * testsuite/script_test_5.t: New file.
10982
10983 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
10984
10985         * archive.cc (Archive::include_member): Update calls to add_symbols.
10986         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
10987         the Layout argument.
10988         * dynobj.h (do_add_symbols): Add the Layout argument.
10989         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
10990         Layout argument.
10991         * object.h (Object::add_symbols): Add the Layout argument.
10992         (Object::do_add_symbols): Add the Layout argument.
10993         (Sized_relobj::do_add_symbols): Add the Layout argument.
10994         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
10995         Unify the two versions.
10996         (Add_plugin_symbols): Remove.
10997         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
10998         (Sized_pluginobj::do_add_symbols): Unify the two versions.
10999         (Add_plugin_symbols): Remove.
11000         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11001         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11002         (Add_symbols::run): Make it work with Pulginobj.
11003
11004 2009-02-06  Ian Lance Taylor  <iant@google.com>
11005
11006         * object.cc (Sized_relobj::do_layout): Make info message start
11007         with lower case letter.
11008
11009 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11010
11011         * binary.cc: Fix file comment.
11012
11013         * options.h (enum Incremental_disposition): Define.
11014         (class General_options): Add new options: --incremental,
11015         --incremental_changed, --incremental_unchanged,
11016         --incremental_unknown.  Add incremental_disposition_ and
11017         implicit_incremental_ fields.
11018         (General_options::incremental_disposition): New function.
11019         (class Position_dependent_options): Add incremental_disposition
11020         option.
11021         (Position_dependent_options::copy_from_options): Set incremental
11022         dispositions.
11023         * options.cc (General_options::parse_incremental_changed): New
11024         function.
11025         (General_options::parse_incremental_unchanged): New function.
11026         (General_options::parse_incremental_unknown): New function.
11027         (General_options::General_options): Initialize new fields
11028         incremental_disposition_ and implicit_incremental_.
11029         (General_options::finalize): Check for uasge of --incremental-*
11030         without --incremental.
11031
11032 2009-02-06  Chris Demetriou  <cgd@google.com>
11033
11034         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11035         pointer and to report location as the file name associated with
11036         the symbol.
11037         (gold_undefined_symbol_at_location): New function to replace the
11038         old gold_undefined_symbol functionality.
11039         * target-reloc.h (relocate_section): Update to use
11040         gold_undefined_symbol_at_location.
11041         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11042         Call gold_undefined_symbol function rather than gold_error.
11043         * errors.h (Errors::undefined_symbol): Take location as a
11044         string, rather than calculating it from a relocation.
11045         * errors.cc (Errors::fatal): Print "fatal error:" before the
11046         formatted message.
11047         (Errors::error, Errors::error_at_location): Print "error: "
11048         before the formatted message.
11049         (Errors::undefined_symbol): Take location as a string, rather
11050         than calculating it from a relocation.
11051         (gold_undefined_symbol_at_location): New function akin to
11052         old gold_undefined_symbol, calculates location from relocation.
11053         (gold_undefined_symbol): Change to take only a Symbol pointer
11054         and to report location as the file name associated with the symbol.
11055         * testsuite/debug_msg.sh: Update for changed error messages.
11056         * testsuite/undef_symbol.sh: Likewise.
11057
11058 2009-02-04  Duncan Sands  <baldrick@free.fr>
11059
11060         PR 9812
11061         * reduced_debug_output.h
11062         (Output_reduced_debug_abbrev_section::failed): Use format for
11063         gold_warning.
11064         (Output_reduced_debug_info_section::faild): Likewise.
11065
11066 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11067
11068         * script.cc (Lazy_demangler): New class.
11069         (Version_script_info::get_symbol_version_helper): Demangle a
11070         symbol only once.
11071
11072 2009-01-29  Cary Coutant  <ccoutant@google.com>
11073
11074         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11075         to __tls_get_addr.
11076         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11077
11078 2009-01-28  Ian Lance Taylor  <iant@google.com>
11079
11080         * version.cc (version_string): Bump to 1.9.
11081
11082         * gold.h: Include <cstring> and <stdint.h>.
11083         * version.cc: Include <cstdio>.
11084         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11085         warning.
11086         * reduced_debug_output.cc (insert_into_vector): Rename from
11087         Insert_into_vector; change all callers.  Use Swap_unaligned to
11088         avoid aliasing issue; remove union since it is unnecessary.
11089
11090 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11091
11092         * Makefile.am (CCFILES): Add gc.cc.
11093         (HFILES): Add gc.h.
11094         * Makefile.in: Regenerate.
11095         * gold.cc (Gc_runner): New class.
11096         (queue_initial_tasks): Call garbage collection related tasks
11097         when corresponding options are invoked.
11098         (queue_middle_gc_tasks): New function.
11099         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11100         processed early before laying out sections during garbage collection.
11101         * gold.h (queue_middle_gc_tasks): New function.
11102         (is_prefix_of): Move from "layout.cc".
11103         * i386.cc (Target_i386::gc_process_relocs): New function.
11104         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11105         * main.cc (main): Create object of class "Garbage_collection".
11106         * object.cc (Relobj::copy_symbols_data): New function.
11107         (Relobj::is_section_name_included): New function.
11108         (Sized_relobj::do_layout): Allow this function to be called twice
11109         during garbage collection and defer layout of section during the
11110         first call.
11111         * object.h (Relobj::get_symbols_data): New function.
11112         (Relobj::is_section_name_included): New function.
11113         (Relobj::copy_symbols_data): New function.
11114         (Relobj::set_symbols_data): New function.
11115         (Relobj::get_relocs_data): New function.
11116         (Relobj::set_relocs_data): New function.
11117         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11118         (Relobj::gc_process_relocs): New function.
11119         (Relobj::do_gc_process_relocs): New pure virtual function.
11120         (Relobj::sd_): New data member.
11121         (Sized_relobj::is_output_section_offset_invalid): New function.
11122         (Sized_relobj::do_gc_process_relocs): New function.
11123         * options.h (General_options::gc_sections): Modify to not be a no-op.
11124         (General_options::print_gc_sections): New option.
11125         * plugin.cc (Plugin_finish::run): Remove function call to
11126         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11127         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11128         * reloc.cc (Read_relocs::run): Add task to process relocs and
11129         determine unreferenced sections when doing garbage collection.
11130         (Gc_process_relocs): New class.
11131         (Sized_relobj::do_gc_process_relocs): New function.
11132         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11133         sections that are garbage collected.
11134         * reloc.h (Gc_process_relocs): New class.
11135         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11136         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11137         symbols whose corresponding sections are garbage collected.
11138         (Symbol_table::Symbol_table): Add new parameter for the garbage
11139         collection object.
11140         (Symbol_table::gc_mark_undef_symbols): New function.
11141         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11142         (Symbol_table::gc_mark_dyn_syms): New function.
11143         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11144         as garbage.
11145         (Symbol_table::add_from_object): Likewise.
11146         (Symbol_table::add_from_relobj): When building shared objects, do not
11147         treat externally visible symbols as garbage.
11148         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11149         table information for static and relocatable links.
11150         * symtab.h (Symbol_table::set_gc): New function.
11151         (Symbol_table::gc): New function.
11152         (Symbol_table::gc_mark_undef_symbols): New function.
11153         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11154         (Symbol_table::gc_mark_dyn_syms): New function.
11155         (Symbol_table::gc_): New data member.
11156         * target.h (Sized_target::gc_process_relocs): New pure virtual
11157         function.
11158         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11159         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11160
11161 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11162
11163         * options.h (General_options::gc_sections): Define as a no-op for now.
11164         (General_options::no_keep_memory): Ditto.
11165         (General_options::Bshareable): Define.
11166         * options.cc (General_options::finalize): Honor -Bshareable.
11167
11168 2009-01-20  Andreas Schwab  <schwab@suse.de>
11169
11170         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11171         read the value in the contents, since we don't use it.  Use the
11172         template endianness when writing.
11173         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11174
11175 2009-01-19  Andreas Schwab  <schwab@suse.de>
11176
11177         * configure.tgt (powerpc64-*): Fix targ_obj.
11178
11179 2009-01-15  Ian Lance Taylor  <iant@google.com>
11180
11181         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11182         local symbols when stripping all symbols.
11183
11184 2009-01-14  Cary Coutant  <ccoutant@google.com>
11185
11186         * output.cc (Output_reloc): Add explicit instantiations.
11187
11188 2009-01-14  Cary Coutant  <ccoutant@google.com>
11189
11190         * archive.cc (Archive::get_elf_object_for_member): Remove call
11191         to File_read::claim_for_plugin.
11192         * descriptors.cc (Descriptors::open): Remove reference to
11193         is_claimed.
11194         (Descriptors::claim_for_plugin): Remove.
11195         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11196         (Descriptors::is_claimed): Remove.
11197         (claim_descriptor_for_plugin): Remove.
11198         * fileread.cc (File_read::claim_for_plugin): Remove.
11199         * fileread.h (File_read::claim_for_plugin): Remove.
11200         (File_read::descriptor): Reopen descriptor if necessary.
11201         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11202         (Plugin_manager::all_symbols_read): Add task parameter. Change
11203         all callers.
11204         (Plugin_manager::get_input_file): New function.
11205         (Plugin_manager::release_input_file): New function.
11206         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11207         corresponding data member.
11208         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11209         and pass to base constructor. Change all callers.
11210         (get_input_file, release_input_file): New functions.
11211         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11212         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11213         (Plugin_manager::all_symbols_read): Add task parameter.
11214         (Plugin_manager::get_input_file): New function.
11215         (Plugin_manager::release_input_file): New function.
11216         (Plugin_manager::task_): New data member.
11217         (Pluginobj::Pluginobj): Add filesize parameter.
11218         (Pluginobj::filename): New function.
11219         (Pluginobj::descriptor): New function.
11220         (Pluginobj::filesize): New function.
11221         (Pluginobj::filesize_): New data member.
11222         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11223         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11224         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11225
11226         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11227         with archive libraries.
11228         * testsuite/Makefile.in: Regenerate.
11229         * testsuite/plugin_test.c (struct sym_info): New type.
11230         (get_input_file, release_input_file): New static variables.
11231         (onload): Capture new transfer vector entries.
11232         (claim_file_hook): Stop reading at end of file according to filesize.
11233         Factor out parsing of readelf output into separate function.
11234         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11235         APIs and get the source file name from the symbol table.  Convert
11236         source file name to corresponding object file name.  Print info
11237         message when adding new input files.
11238         (parse_readelf_line): New function.
11239         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11240         * testsuite/plugin_test_2.sh: Likewise.
11241         * testsuite/plugin_test_3.sh: Likewise.
11242         * testsuite/plugin_test_4.sh: New test case.
11243
11244 2009-01-07  Ian Lance Taylor  <iant@google.com>
11245
11246         * version.cc (version_string): Bump to 1.8.
11247
11248 2008-12-23  Cary Coutant  <ccoutant@google.com>
11249
11250         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11251         * plugin.cc (Plugin_manager::finish): Rename as
11252         layout_deferred_objects.  Move cleanup to separate function.
11253         (Plugin_manager::cleanup): New function.
11254         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11255         separately.
11256         * plugin.h (Plugin_manager::finish): Rename as
11257         layout_deferred_objects.
11258         (Plugin_manager::cleanup): New function.
11259         (Plugin_manager::cleanup_done): New field.
11260
11261 2008-12-23  Cary Coutant  <ccoutant@google.com>
11262
11263         * plugin.cc (is_visible_from_outside): New function.
11264         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11265         so we don't return "IR only" status for exported symbols or -r links.
11266
11267         * testsuite/Makefile.am (plugin_test_3): New test case.
11268         * testsuite/Makefile.in: Regenerate.
11269         * testsuite/plugin_test_3.sh: New file.
11270
11271 2008-12-22  Cary Coutant  <ccoutant@google.com>
11272
11273         * object.cc (Sized_relobj::layout_section): New function.
11274         (Sized_relobj::do_layout): Defer layout of input sections until after
11275         plugin has provided replacement files.
11276         (Sized_relobj::do_layout_deferred_sections): New function.
11277         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11278         (Relobj::layout_deferred_sections): New function.
11279         (Relobj::do_layout_deferred_sections): New function.
11280         (Sized_relobj::do_layout_deferred_sections): New function.
11281         (Sized_relobj::layout_section): New function.
11282         (Sized_relobj::Deferred_layout): New structure.
11283         (Sized_relobj::deferred_layout_): New field.
11284         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11285         Change all callers.  Layout deferred sections.
11286         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11287         references.
11288         (Plugin_hook::run): Move code from do_plugin_hook inline.
11289         (Plugin_hook::do_plugin_hook): Remove.
11290         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11291         (Plugin_manager::finish): Renamed, was cleanup.
11292         (Plugin_manager::should_defer_layout): New function.
11293         (Plugin_manager::add_deferred_layout_object): New function.
11294         (Plugin_manager::Deferred_layout_list): New type.
11295         (Plugin_manager::deferred_layout_objects_): New field.
11296         (Plugin_hook::do_plugin_hook): Remove.
11297
11298 2008-12-17  Ian Lance Taylor  <iant@google.com>
11299
11300         * options.h (class General_options): Add --no case for
11301         --export-dynamic.
11302
11303 2008-12-16  Cary Coutant  <ccoutant@google.com>
11304
11305         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11306         vector.
11307         (Plugin_manager::claim_file): Create plugin object even if
11308         plugin did not call the add_symbols callback.
11309         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11310         asking for more symbols than were added.
11311         * testsuite/Makefile.am (plugin_test_1): Add test case with
11312         no global symbols.
11313         (empty.syms): New target.
11314         * testsuite/Makefile.in: Regenerate.
11315         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11316         message. Don't call add_symbols if no globals.
11317         (all_symbols_read_hook): Don't provide replacement for empty
11318         claimed file.
11319
11320 2008-12-12  Ian Lance Taylor  <iant@google.com>
11321
11322         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11323         r_type == 0 for a local symbol with r_sym == 0.
11324         (scan_relocatable_relocs): Pass r_sym to
11325         local_non_section_strategy.
11326         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11327         r_sym parameter.
11328
11329         * configure.ac: Update test for TLS descriptors: they are
11330         supported as of glibc 2.9.
11331         * configure: Rebuild.
11332
11333 2008-12-11  Ian Lance Taylor  <iant@google.com>
11334
11335         PR 7091
11336         * target-reloc.h (Default_scan_relocatable_relocs): For each
11337         function, map r_type == 0 to RELOC_DISCARD.
11338
11339 2008-12-10  Cary Coutant  <ccoutant@google.com>
11340
11341         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11342         object to override a kept COMDAT group from a plugin object.
11343
11344 2008-12-09  Ian Lance Taylor  <iant@google.com>
11345
11346         PR 7088
11347         * yyscript.y (file_cmd): Handle INPUT.
11348
11349         * testsuite/initpri1.c: Change all declarations to be full
11350         prototypes by adding void, to avoid compiler warnings.
11351
11352 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11353
11354         * options.cc (General_options::parse_plugin_opt): New.
11355         (General_options::add_plugin): The argument now is just the filename.
11356         (General_options::add_plugin_option): New.
11357         * options.h (plugin_opt): New.
11358         (add_plugin): Change argument name.
11359         (add_plugin_option): New.
11360         * plugin.cc (Plugin::load): Don't parse the plugin option.
11361         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11362         (Plugin::add_option): New.
11363         (Plugin::args_): Change type.
11364         (Plugin::filename_): New.
11365         (Plugin_manager::add_plugin_option): New.
11366         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11367         * testsuite/Makefile.in: Regenerate.
11368
11369 2008-12-05  Cary Coutant  <ccoutant@google.com>
11370
11371         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11372         Handle --strip-lto-sections option.
11373         * options.h (strip_lto_sections): New option.
11374
11375 2008-12-01  Cary Coutant  <ccoutant@google.com>
11376
11377         * plugin.cc (ld_plugin_message): Change format parameter to const.
11378         Fix mismatch between new[] and delete.
11379
11380 2008-11-14  Cary Coutant  <ccoutant@google.com>
11381
11382         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11383         instead of -1U.
11384
11385 2008-11-05  Craig Silverstein  <csilvers@google.com>
11386
11387         * options.cc (General_options::parse_dynamic_list): New function.
11388         * options.h (General_options): New flags dynamic_list,
11389         dynamic_list_data, dynamic_list_cpp_new, and
11390         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11391         (General_options::in_dynamic_list): New function.
11392         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11393         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11394         (Lex::can_continue_name): Likewise.
11395         (yylex): Likewise.
11396         (read_script_file): New parameter script_options.
11397         (read_dynamic_list): New function.
11398         (Script_options::define_dynamic_list): New function.
11399         (dynamic_list_keyword_parsecodes): New variable.
11400         (dynamic_list_keywords): New variable.
11401         * script.h (Script_options::define_dynamic_list): New function
11402         prototype.
11403         (read_dynamic_list): New function prototype.
11404         * symtab.cc (strprefix): New macro.
11405         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11406         dynamic_list_data, dynamic_list_cpp_new, and
11407         dynamic_list_cpp_typeinfo.
11408         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11409         (dynamic_list_expr): New rule.
11410         (dynamic_list_nodes): Likewise.
11411         (dynamic_list_node): Likewise.
11412         * testsuite/Makefile.am (dynamic_list): New test.
11413         * testsuite/Makefile.in: Regenerated.
11414         * testsuite/dynamic_list.t: New file.
11415         * testsuite/dynamic_list.sh: New file.
11416
11417 2008-11-05  Craig Silverstein  <csilvers@google.com>
11418
11419         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11420         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11421         (t11_last): Likewise.
11422         * testsuite/ver_test_6.c (main): Likewise.
11423
11424 2008-10-07  Cary Coutant  <ccoutant@google.com>
11425
11426         * options.c (General_options::finalize): Add check for -static and
11427         -shared.
11428         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11429         is not empty.
11430
11431 2008-10-02  Cary Coutant  <ccoutant@google.com>
11432
11433         * plugin.cc (make_sized_plugin_object): Fix conditional
11434         compilation to work when not all targets are enabled.
11435
11436 2008-09-29  Cary Coutant  <ccoutant@google.com>
11437
11438         * archive.cc (Archive::get_file_and_offset): Use filename instead
11439         of name to get library path.
11440         (Archive::include_member): Unlock external member of a thin archive.
11441
11442         * testsuite/Makefile.am (TEST_AR): New variable.
11443         (thin_archive_test_1): New test.
11444         (thin_archive_test_2): New test.
11445         * testsuite/Makefile.in: Regenerate.
11446         * testsuite/thin_archive_main.cc: New file.
11447         * testsuite/thin_archive_test_1.cc: New file.
11448         * testsuite/thin_archive_test_2.cc: New file.
11449         * testsuite/thin_archive_test_3.cc: New file.
11450         * testsuite/thin_archive_test_4.cc: New file.
11451
11452 2008-09-29  Cary Coutant  <ccoutant@google.com>
11453
11454         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11455         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11456         instead of -1U.
11457         (Sized_relobj::do_finalize_local_symbols): Likewise.
11458         (Sized_relobj::map_to_kept_section): Likewise.
11459         * object.h (Sized_relobj::invalid_address): New constant.
11460         (Sized_relobj::do_output_section_offset): Check for invalid_address
11461         and return -1ULL.
11462         * output.cc (Output_reloc::local_section_offset): Use constant
11463         invalid_address instead of -1U.
11464         (Output_reloc::get_address): Likewise.
11465         (Output_section::output_address): Change -1U to -1ULL.
11466         * output.h (Output_reloc::invalid_address): New constant.
11467         * reloc.cc (Sized_relobj::write_sections): Use constant
11468         invalid_address instead of -1U.
11469         (Sized_relobj::relocate_sections): Likewise.
11470         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11471         values for merge sections.
11472         * target-reloc.h (relocate_for_relocatable): Use constant
11473         invalid_address instead of -1U.
11474
11475 2008-09-19  Cary Coutant  <ccoutant@google.com>
11476
11477         Add plugin functionality for link-time optimization (LTO).
11478         * configure.ac (plugins): Add --enable-plugins option.
11479         * configure: Regenerate.
11480         * config.in: Regenerate.
11481         * Makefile.am (LIBDL): New variable.
11482         (CCFILES): Add plugin.cc.
11483         (HFILES): Add plugin.h.
11484         (ldadd_var): Add LIBDL.
11485         * Makefile.in: Regenerate.
11486
11487         * archive.cc: Include "plugin.h".
11488         (Archive::setup): Don't preread archive symbols when using a plugin.
11489         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
11490         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
11491         files.
11492         (Archive::include_member): Add symbols from plugin objects.
11493         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
11494         * descriptors.cc (Descriptors::open): Check for file descriptors
11495         abandoned by plugins.
11496         (Descriptors::claim_for_plugin): New function.
11497         * descriptors.h (Descriptors::claim_for_plugin): New function.
11498         (Open_descriptor::is_claimed): New field.
11499         (claim_descriptor_for_plugin): New function.
11500         * fileread.cc (File_read::claim_for_plugin): New function.
11501         * fileread.h (File_read::claim_for_plugin): New function.
11502         (File_read::descriptor): New function.
11503         * gold.cc: Include "plugin.h".
11504         (queue_initial_tasks): Add task to call plugin hooks for generating
11505         new object files.
11506         * main.cc: Include "plugin.h".
11507         (main): Load plugin libraries.
11508         * object.h (Pluginobj): Declare.
11509         (Object::pluginobj): New function.
11510         (Object::do_pluginobj): New function.
11511         (Object::set_target): New function.
11512         * options.cc: Include "plugin.h".
11513         (General_options::parse_plugin): New function.
11514         (General_options::General_options): Initialize plugins_ field.
11515         (General_options::add_plugin): New function.
11516         * options.h (Plugin_manager): Declare.
11517         (General_options): Add --plugin option.
11518         (General_options::has_plugins): New function.
11519         (General_options::plugins): New function.
11520         (General_options::add_plugin): New function.
11521         (General_options::plugins_): New field.
11522         * plugin.cc: New file.
11523         * plugin.h: New file.
11524         * readsyms.cc: Include "plugin.h".
11525         (Read_symbols::do_read_symbols): Check for archive before checking
11526         for ELF file.  Call plugin hooks to claim files.
11527         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
11528         from a real object file; force override when processing replacement
11529         files.
11530         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
11531         (Symbol::init_base_object): Likewise.
11532         (Symbol::init_base_output_data): Likewise.
11533         (Symbol::init_base_output_segment): Likewise.
11534         (Symbol::init_base_constant): Likewise.
11535         (Symbol::init_base_undefined): Likewise.
11536         (Symbol::output_section): Assert that object is not a plugin.
11537         (Symbol_table::add_from_pluginobj): New function.
11538         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
11539         undefined.
11540         (Symbol_table::sized_write_globals): Likewise.
11541         (Symbol_table::add_from_pluginobj): Instantiate template.
11542         * symtab.h (Sized_pluginobj): Declare.
11543         (Symbol::in_real_elf): New function.
11544         (Symbol::set_in_real_elf): New function.
11545         (Symbol::in_real_elf_): New field.
11546         (Symbol_table::add_from_pluginobj): New function.
11547
11548         * testsuite/Makefile.am (AM_CFLAGS): New variable.
11549         (LIBDL): New variable.
11550         (LDADD): Add LIBDL.
11551         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
11552         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
11553         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
11554         (MOSTLYCLEANFILES): Likewise.
11555         * testsuite/Makefile.in: Regenerate.
11556         * testsuite/plugin_test.c: New file.
11557         * testsuite/plugin_test_1.sh: New file.
11558         * testsuite/plugin_test_2.sh: New file.
11559
11560 2008-09-16  Ian Lance Taylor  <iant@google.com>
11561
11562         * target-reloc.h (relocate_section): Check whether a symbol is
11563         defined by the ABI before reporting an undefined symbol error.
11564         * target.h (Target::is_defined_by_abi): Make parameter const.
11565         (Target::do_is_defined_by_abi): Likewise.
11566         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
11567         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
11568         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
11569         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
11570         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
11571         * testsuite/Makefile.in: Rebuild.
11572
11573         * fileread.cc (make_view): Add casts to avoid warning.
11574
11575 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11576
11577         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
11578         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11579
11580 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
11581
11582         * options.h (General_options::output_is_executable): New.
11583         (General_options::output_is_pie): New.
11584         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
11585         for shared libraries.
11586         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
11587
11588 2008-09-11  Chris Demetriou  <cgd@google.com>
11589
11590         * options.h (origin): New -z option.
11591         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
11592         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
11593         in DT_FLAGS_1.
11594
11595 2008-09-05  Cary Coutant  <ccoutant@google.com>
11596
11597         * fileread.cc (File_read::make_view): Add check for attempt to map
11598         beyond end of file.
11599
11600 2008-09-05  Cary Coutant  <ccoutant@google.com>
11601
11602         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
11603         explicit instantiations.
11604
11605 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
11606
11607         PR gold/6858
11608         * options.cc (General_options::finalize): Allow undefined symbols
11609         in shlibs if linking -shared.
11610
11611         PR gold/6859
11612         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
11613         symbols as not needing a dynsym entry.
11614
11615 2008-08-20  Craig Silverstein  <csilvers@google.com>
11616
11617         * fileread.cc (File_read::open): Do not lock the file unless it
11618         was successfully opened.
11619
11620 2008-08-14  Cary Coutant  <ccoutant@google.com>
11621
11622         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
11623         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
11624         * testsuite/tls_test.cc (struct int128): 128-bit struct
11625         for testing TLS relocs with non-zero addend.
11626         (v12): New TLS variable.
11627         (t12): New test.
11628         (t_last): Add check for v12.
11629         * testsuite/tls_test.h (t12): New function.
11630         * testsuite/tls_test_main.cc (thread_routine): Call new test.
11631
11632 2008-08-13  Ian Lance Taylor  <iant@google.com>
11633
11634         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
11635         set tls_segment_ or relro_segment_.
11636         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
11637         when appropriate.
11638         * output.h (Output_section::clear_is_relro): New function.
11639         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
11640         sections specially even when output_data_ is empty.
11641         (Output_segment::maximum_alignment): When first section is relro,
11642         only force alignment for PT_LOAD segments.
11643         * script.cc (script_data_segment_align): New function.
11644         (script_data_segment_relro_end): New function.
11645         * script-c.h (script_data_segment_align): Declare.
11646         (script_data_segment_relro_end): Declare.
11647         * script-sections.h (class Script_sections): Declare
11648         data_segment_align and data_segment_relro_end.  Add fields
11649         segment_align_index_ and saw_relro_end_.
11650         * script-sections.cc (class Sections_element): Add set_is_relro
11651         virtual function.  Add new bool* parameter to place_orphan_here.
11652         Add get_output_section virtual function.
11653         (class Output_section_definition): Add set_is_relro.  Add new
11654         bool* parameter to place_orphan_here.  Add get_output_section.
11655         Add is_relro_ field.
11656         (Output_section_definition::Output_section_definition): Initialize
11657         evaluated_address_, evaluated_load_address, evaluated_addralign_,
11658         and is_relro_ fields.
11659         (Output_section_definition::place_orphan_here): Add is_relro
11660         parameter.
11661         (Output_section_definition::set_section_addresses): Set relro for
11662         output section.
11663         (Output_section_definition::alternate_constraint): Likewise.
11664         (class Orphan_output_section): Add new bool* parameter to
11665         place_orphan_here.  Add get_output_section.
11666         (Orphan_output_section::place_orphan_here): Add is_relro
11667         parameter.
11668         (Script_sections::Script_sections): Initialize
11669         data_segment_align_index_ and saw_relro_end_.
11670         (Script_sections::data_segment_align): New function.
11671         (Script_sections::data_segment_relro_end): New function.
11672         (Script_sections::place_orphan): Set or clear is_relro.
11673         (Script_sections::set_section_addresses): Force alignment of first
11674         TLS section.
11675         * yyscript.y (exp): Call script_data_segment_align and
11676         script_data_segment_relro_end.
11677         * testsuite/relro_script_test.t: New file.
11678         * testsuite/relro_test.cc (using_script): Declare.
11679         (t1, t2): Test using_script.
11680         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
11681         (relro_script_test_SOURCES): Define.
11682         (relro_script_test_DEPENDENCIES): Define.
11683         (relro_script_test_LDFLAGS): Define.
11684         (relro_script_test_LDADD): Define.
11685         (relro_script_test.so): New target.
11686         * testsuite/Makefile.in: Rebuild.
11687
11688 2008-08-06  Cary Coutant <ccoutant@google.com>
11689
11690         * archive.cc (Archive::total_archives, Archive::total_members)
11691         (Archive::total_members_loaded): New variables.
11692         (Archive::setup): Add parameter.  Add option to preread
11693         archive symbols.
11694         (Archive::read_armap): Add counter.
11695         (Archive::get_file_and_offset): New function.
11696         (Archive::get_elf_object_for_member): New function.
11697         (Archive::read_all_symbols): New function.
11698         (Archive::read_symbols): New function.
11699         (Archive::add_symbols): Add counters.
11700         (Archive::include_all_members): Use armap to find members if it's
11701         already built.
11702         (Archive::include_member): Skip reading symbols if already read.
11703         Factored code into Archive::get_file_and_offset and
11704         Archive::get_elf_object_for_member.  Changed call to
11705         Mapfile::report_include_archive_member.
11706         (Archive::print_stats): New function.
11707         * archive.h: Declare Object and Read_symbols_data classes.
11708         (Archive::Archive): Add initializers for new members.
11709         (Archive::setup): Add parameter.
11710         (Archive::print_stats): New function.
11711         (Archive::total_archives, Archive::total_members)
11712         (Archive::total_members_loaded): New variables.
11713         (Archive::get_file_and_offset): New function.
11714         (Archive::get_elf_object_for_member): New function.
11715         (Archive::read_all_symbols): New function.
11716         (Archive::read_symbols): New function.
11717         (Archive::Archive_member): New class.
11718         (Archive::members_): New member.
11719         (Archive::num_members_): New member.
11720         * main.cc: Include archive.h.
11721         (main): Call Archive::print_stats.
11722         * mapfile.cc (Mapfile::report_include_archive_member): Delete
11723         archive parameter; member_name is now the fully-decorated name.
11724         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
11725         * options.h: (General_options): Add --preread-archive-symbols option.
11726         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
11727         Archive::setup.
11728
11729 2008-08-04  Ian Lance Taylor  <iant@google.com>
11730
11731         * symtab.h (Symbol::use_plt_offset): New function.
11732         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
11733         * powerpc.cc (Relocate::relocate): Likewise.
11734         * sparc.cc (Relocate::relocate): Likewise.
11735         * x86_64.cc (Relocate::relocate): Likewise.
11736         * testsuite/weak_plt.sh: New test.
11737         * testsuite/weak_plt_main.cc: New test.
11738         * testsuite/weak_plt_shared.cc: New test.
11739         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
11740         (check_PROGRAMS): Add weak_plt.
11741         (check_DATA): Add weak_plt_shared.so.
11742         (weak_plt_main_pic.o, weak_plt): New targets.
11743         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
11744         * testsuite/Makefile.in: Rebuild.
11745
11746         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
11747         gcctestdir/ld.
11748         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
11749         * testsuite/Makefile.in: Rebuild.
11750
11751 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
11752
11753         * Makefile.am (POTFILES.in): Set LC_ALL=C.
11754         * Makefile.in: Regenerate.
11755         * po/POTFILES.in: Regenerate.
11756
11757 2008-07-29  Ian Lance Taylor  <iant@google.com>
11758
11759         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
11760         symbols before other symbols.
11761         * testsuite/script_test_2.cc (test_addr): Declare.
11762         (test_addr_alias): Declare.
11763         (main): Check that test_addr and test_addr_alias have the right
11764         values.
11765         * testsuite/script_test_2.t: Define test_addr_alias and
11766         test_addr.
11767
11768 2008-07-24  Ian Lance Taylor  <iant@google.com>
11769
11770         PR 5990
11771         * descriptors.cc: New file.
11772         * descriptors.h: New file.
11773         * gold-threads.h (class Hold_optional_lock): New class.
11774         * fileread.cc: Include "descriptors.h".
11775         (File_read::~File_read): Release descriptor rather than closing
11776         it.
11777         (File_read::open) [file]: Call open_descriptor rather than open.
11778         Set is_descriptor_opened_.
11779         (File_read::open) [memory]: Assert that descriptor is not open.
11780         (File_read::reopen_descriptor): New function.
11781         (File_read::release): Release descriptor.
11782         (File_read::do_read): Make non-const.  Reopen descriptor.
11783         (File_read::read): Make non-const.
11784         (File_read::make_view): Reopen descriptor.
11785         (File_read::do_readv): Likewise.
11786         * fileread.h (class File_read): Add is_descriptor_opened_ field.
11787         Update declarations.
11788         * layout.cc: Include "descriptors.h".
11789         (Layout::create_build_id): Use open_descriptor rather than open.
11790         * output.cc: Include "descriptors.h".
11791         (Output_file::open): Use open_descriptor rather than open.
11792         * archive.cc (Archive::const_iterator): Change Archive to be
11793         non-const.
11794         (Archive::begin, Archive::end): Make non-const.
11795         (Archive::count_members): Likewise.
11796         * archive.h (class Archive): Update declarations.
11797         * object.h (Object::read): Make non-const.
11798         * Makefile.am (CCFILES): Add descriptors.cc.
11799         (HFILES): Add descriptors.h.
11800         * Makefile.in: Rebuild.
11801
11802         PR 6716
11803         * gold.h: Always include <clocale>.  Add Solaris workarounds
11804         following code in binutils/sysdep.h.
11805
11806         PR 6048
11807         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
11808         this->eh_frame_hdr_ is NULL before using it.
11809
11810         * dynobj.cc (Versions::Versions): Update comment.
11811
11812         * dynobj.cc (Versions::Versions): If there is an soname, use it as
11813         the base version name.
11814
11815         * stringpool.cc (Stringpool_template::add_with_length): Set key to
11816         array size plus one.
11817         (Stringpool_template::set_string_offsets): Subtract one from key
11818         before using it as an array index.
11819         (Stringpool_template::get_offset_with_length): Likewise.
11820         (Stringpool_template::write_to_buffer): Likewise.
11821         * stringpool.h (Stringpool_template::get_offset_from_key):
11822         Likewise.
11823
11824 2008-07-23  Ian Lance Taylor  <iant@google.com>
11825
11826         PR 6658
11827         * object.h (Merged_symbol_value::value): Do our best to handle a
11828         negative addend.
11829
11830         PR 6647
11831         * script.cc (Version_script_info::get_versions): Don't add empty
11832         version tag to return value.
11833         (Version_script_info::get_symbol_version_helper): Change return
11834         type to bool.  Add pversion parameter.  Change all callers.
11835         (script_register_vers_node): Don't require a non-NULL tag.
11836         * script.h (class Version_script_info): Update declarations.
11837         (Version_script_info::get_symbol_version): Change return type to
11838         bool.  Add version parameter.  Change all callers.
11839         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
11840         handling.  Handle an empty version from a version script.
11841         (Symbol_table::define_special_symbol): Likewise.
11842         * testsuite/ver_test_10.script: New file.
11843         * testsuite/ver_test_10.sh: New file.
11844         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
11845         (check_DATA): Add ver_test_10.syms.
11846         (ver_test_10.syms, ver_test_10.so): New target.
11847         * testsuite/Makefile.in: Rebuild.
11848
11849 2008-07-23  Simon Baldwin  <simonb@google.com>
11850
11851         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
11852         to zero for undefined symbols from dynamic libraries.
11853
11854 2008-07-23  Ian Lance Taylor  <iant@google.com>
11855
11856         * symtab.cc (Symbol_table::resolve): Remove version parameter.
11857         Change all callers.
11858         * symtab.h (class Symbol_table): Update declaration.
11859         * testsuite/ver_test_9.cc: New file.
11860         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
11861         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
11862         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
11863         (ver_test_9.so, ver_test_9.o): New targets.
11864         * testsuite/Makefile.in: Rebuild.
11865
11866 2008-07-22  Ian Lance Taylor  <iant@google.com>
11867
11868         * options.h (class General_options): Define --check-sections.
11869         * layout.cc (Layout::set_segment_offsets): Handle
11870         --check-sections.
11871
11872         * options.h (class General_options): Define -n/--nmagic and
11873         -N/--omagic.
11874         * options.cc (General_options::finalize): For -n/--nmagic or
11875         -N/--omagic, set -static.
11876         * layout.cc (Layout::attach_allocated_section_to_segment): If
11877         -N/--omagic, don't put read-only and read-write sections in
11878         different segments.
11879         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
11880         finding a read-only segment.
11881         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
11882         don't set the minimum segment alignment to the common page size,
11883         and don't set the file offset to the address modulo the page size.
11884         * script-sections.cc (Script_sections::create_segments): If
11885         -n/--omagic, don't put read-only and read-write sections in
11886         different segments.
11887
11888         * cref.cc: New file.
11889         * cref.h: New file.
11890         * options.h (class General_options): Add --print-symbol-counts.
11891         * main.cc (main): Issue defined symbol report if requested.
11892         * archive.cc (Archive::interpret_header): Make into a const member
11893         function.
11894         (Archive::add_symbols): Call Input_objects::archive_start and
11895         archive_stop.
11896         (Archive::const_iterator): Define new class.
11897         (Archive::begin, Archive::end): New functions.
11898         (Archive::include_all_members): Rewrite to use iterator.
11899         (Archive::count_members): New function.
11900         * archive.h (class Archive): Update declarations.
11901         (Archive::filename): New function.
11902         * object.cc: Include "cref.h".
11903         (Sized_relobj::Sized_relobj): Initialize defined_count_.
11904         (Sized_relobj::do_get_global_symbol_counts): New function.
11905         (Input_objects::add_object): Add object to cross-referencer.
11906         (Input_objects::archive_start): New function.
11907         (Input_objects::archive_stop): New function.
11908         (Input_objects::print_symbol_counts): New function.
11909         * object.h: Declare Cref and Archive.
11910         (Object::get_global_symbol_counts): New function.
11911         (Object::do_get_global_symbol_counts): New pure virtual function.
11912         (class Sized_relobj): Add defined_count_ field.  Update
11913         declarations.
11914         (class Input_objects): Add cref_ field.  Update constructor.
11915         Update declarations.
11916         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
11917         defined_count_.
11918         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
11919         symbol counts.
11920         (Sized_dynobj::do_get_global_symbol_counts): New function.
11921         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
11922         defined_count_.  Update declarations.  Define Symbols typedef.
11923         * symtab.cc (Symbol_table::add_from_relobj): Add defined
11924         parameter.  Change all callers.
11925         (Symbol_table::add_from_dynobj): Add sympointers and defined
11926         parameters.  Change all callers.
11927         * symtab.h (class Symbol_table): Update declarations.
11928         * Makefile.am (CCFILES): Add cref.cc.
11929         (HFILES): Add cref.h.
11930         * Makefile.in: Rebuild.
11931
11932 2008-07-22  Simon Baldwin  <simonb@google.com>
11933
11934         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
11935         to zero when writing undefined symbols.
11936
11937 2008-07-22  Ian Lance Taylor  <iant@google.com>
11938
11939         * output.cc (Output_section::add_input_section): Don't try to
11940         merge empty merge sections.
11941
11942 2008-07-21  Craig Silverstein  <csilvers@google.com>
11943
11944         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11945         Include symbol version in error message.
11946
11947 2008-07-20  Chris Demetriou  <cgd@google.com>
11948
11949         * configure.ac (gold_cv_c_random_seed): New configured variable.
11950         (RANDOM_SEED_CFLAGS): New substituted variable.
11951         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
11952         * configure: Rebuild.
11953         * Makefile.in: Likewise.
11954         * testsuite/Makefile.in: Likewise.
11955
11956 2008-07-18  Ian Lance Taylor  <iant@google.com>
11957
11958         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
11959         where we see NAME/NULL and NAME/VERSION  as separate symbols.
11960         * testsuite/ver_test_main.cc (main): Call t4.
11961         (t4, t4_2a): Define.
11962         * testsuite/ver_test_2.cc (t4_2): Define.
11963         * testsuite/ver_test_2.script: Put t4_2a in VER2.
11964         * testsuite/ver_test_4.cc (t4_2a): Define.
11965         * testsuite/ver_test_4.script: Put t4_2a in VER2.
11966         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
11967
11968 2008-07-17  Ian Lance Taylor  <iant@google.com>
11969
11970         * dynobj.cc (Versions::add_def): If we give an error about a
11971         missing version, go ahead and create the version anyhow.
11972
11973 2008-07-10  Ian Lance Taylor  <iant@google.com>
11974
11975         Handle output sections with more than 0x7fffffff bytes.
11976         * object.h (class Relobj): Change map_to_output_ to
11977         output_sections_, and just keep a section pointer.  Change all
11978         uses.  Move comdat group support to Sized_relobj.
11979         (Relobj::is_section_specially_mapped): Remove.
11980         (Relobj::output_section): Remove poff parameter.  Change all
11981         callers.
11982         (Relobj::output_section_offset): New function.
11983         (Relobj::set_section_offset): Rewrite.
11984         (Relobj::map_to_output): Remove.
11985         (Relobj::output_sections): New function.
11986         (Relobj::do_output_section_offset): New pure virtual function.
11987         (Relobj::do_set_section_offset): Likewise.
11988         (class Sized_relobj): Add section_offsets_ field.  Add comdat
11989         group support from Relobj.  Update declarations.
11990         (Sized_relobj::get_output_section_offset): New function.
11991         (Sized_relobj::do_output_section_offset): New function.
11992         (Sized_relobj::do_set_section_offset): New function.
11993         * object.cc (Relobj::output_section_address): Remove.
11994         (Sized_relobj::Sized_relobj): Initialize new fields.
11995         (Sized_relobj::include_section_group): Cast find_kept_object to
11996         Sized_relobj.
11997         (Sized_relobj::include_linkonce_section): Likewise.
11998         (Sized_relobj::do_layout): Use separate arrays for output section
11999         and output offset.
12000         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12001         output_sections.
12002         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12003         output_sections and section_offsets.
12004         (Sized_relobj::write_local_symbols): Likewise.
12005         (map_to_kept_section): Compute output address directly.
12006         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12007         output_sections and section_offsets.
12008         (Sized_relobj::write_sections): Likewise.
12009         (Sized_relobj::relocate_sections): Likewise.
12010         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12011         * output.h (class Output_reloc): Update declarations.  Change
12012         u2_.relobj to Sized_relobj*.
12013         (class Output_data_reloc): Change add functions to use
12014         Sized_relobj*.
12015         * output.cc (Output_reloc::Output_reloc): Change relobj to
12016         Sized_relobj*.
12017         (Output_reloc::local_section_offset): Change return type to
12018         Elf_Addr.  Use get_output_section_offset.
12019         (Output_reloc::get_address): Likewise.
12020         (Output_section::is_input_address_mapped): Don't call
12021         is_section_specially_mapped.
12022         (Output_section::output_offset): Likewise.
12023         (Output_section::output_address): Likewise.
12024         (Output_section::starting_output_address): Likewise.
12025         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12026         parameter to Sized_relobj*.
12027         (Copy_relocs::need_copy_reloc): Likewise.
12028         (Copy_relocs::save): Likewise.
12029         * copy-relocs.h (class Copy_relocs): Update declarations.
12030         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12031         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12032         * target-reloc.h (relocate_for_relocatable): Change
12033         offset_in_output_section type to Elf_Addr.  Change code that uses
12034         it as well.
12035         * layout.cc (Layout::layout): Always set *off.
12036         * mapfile.cc (Mapfile::print_input_section): Use
12037         output_section_offset.
12038         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12039         Sized_relobj*.
12040         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12041         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12042         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12043
12044 2008-07-03  Ian Lance Taylor  <iant@google.com>
12045
12046         * layout.cc (Layout::include_section): Do not discard unrecognized
12047         SHT_STRTAB sections.
12048
12049 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12050
12051         * script.cc (Lex::can_continue_name): Make '?' allowable in
12052         version-script names.
12053         * testsuite/version_script.map: Change glob pattern to use '?'
12054
12055 2008-06-30  Manish Singh  <yosh@gimp.org>
12056
12057         PR 6585
12058         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12059         Correct typo.
12060
12061 2008-06-30  Ian Lance Taylor  <iant@google.com>
12062
12063         PR 6660
12064         PR 6682
12065         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12066         versions]: Don't try to read the value in the contents, since we
12067         don't use it.  Use the template endianness when writing.
12068
12069 2008-06-25  Cary Coutant  <ccoutant@google.com>
12070
12071         * fileread.cc (File_read::make_view): Assert on zero-length view.
12072         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12073         symbol table when there are no symbols to read.
12074
12075 2008-06-23  Craig Silverstein  <csilvers@google.com>
12076
12077         * version.cc (version_string): Bump to 1.7
12078
12079 2008-06-18  Craig Silverstein  <csilvers@google.com>
12080
12081         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12082         constant 0xFFFF to type Valtype.
12083         (Powerpc_relocate_functions::rel16_ha): Likewise.
12084
12085 2008-06-17  Ian Lance Taylor  <iant@google.com>
12086
12087         * output.h (Output_section::Input_section): Initialize p2align_ to
12088         zero for Output_section_data constructors.
12089         (Output_section::Input_section::addralign): If not an input
12090         section, return the alignment of the Output_section_data.
12091         * testsuite/copy_test.cc: New file.
12092         * testsuite/copy_test_1.cc: New file.
12093         * testsuite/copy_test_2.cc: New file.
12094         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12095         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12096         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12097         (copy_test_1_pic.o, copy_test_1.so): New targets.
12098         (copy_test_2_pic.o, copy_test_2.so): New targets.
12099         * testsuite/Makefile.in: Rebuild.
12100
12101         * script-sections.cc (Script_sections::place_orphan): Initialize
12102         local variable exact.
12103
12104 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12105
12106         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12107
12108 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12109             David S. Miller  <davem@davemloft.net>
12110
12111         * powerpc.cc: New file.
12112         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12113         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12114         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12115         * Makefile.in: Rebuild.
12116
12117 2008-06-09  Ian Lance Taylor  <iant@google.com>
12118
12119         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12120         <exception>.
12121         (throwing, orig_terminate): New static variables.
12122         (terminate_handler): New static function.
12123         (t2): Set terminate handler.
12124
12125 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12126
12127         PR 6584
12128         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12129         alignment.
12130
12131 2008-05-30  Cary Coutant  <ccoutant@google.com>
12132
12133         * archive.cc (Archive::include_all_members) Correct to step
12134         over symbol table and extended name table in thin archives.
12135
12136 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12137
12138         PR 6407
12139         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12140         calculation.
12141
12142 2008-05-28  Caleb Howe  <cshowe@google.com>
12143
12144         * reduced_debug_output.cc: New file.
12145         * reduced_debug_output.h: New file.
12146         * options.h (class General_options): Add --strip-debug-non-line.
12147         * options.cc (General_options::finalize): Add strip_debug_non_line
12148         to the strip heirarchy.
12149         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12150         fields.
12151         * layout.cc: Include "reduced_debug_output.h".
12152         (Layout::Layout): Initialize new fields.
12153         (line_only_debug_sections): New static array.
12154         (is_lines_only_debug_sections): New static inline function.
12155         (Layout::include_section): Handle --strip-debug-non-line.
12156         (Layout::make_output_section): If --strip-debug-non-line, build
12157         new output sections for .debug_abbrev and .debug_info.
12158         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12159         gold.  Warn about possible overflow.
12160         (read_signed_LEB_128): Likewise.
12161         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12162         (read_signed_LEB_128): Declare.
12163         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12164         (HFILES): Add reduced_debug_output.h.
12165         * Makefile.in: Rebuild.
12166
12167 2008-05-21  Ian Lance Taylor  <iant@google.com>
12168
12169         * mapfile.cc: New file.
12170         * mapfile.h: New file.
12171         * options.h (class General_options): Add -M/--print-map and -Map.
12172         * options.cc (General_options::finalize): Make -M equivalent to
12173         -Map -.
12174         * main.cc: Include <cstdio> and "mapfile.h".
12175         (main): Open mapfile if requested.
12176         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12177         constructor.  Change caller.
12178         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12179         (queue_middle_tasks): Likewise.
12180         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12181         declarations.
12182         * archive.cc: Include "mapfile.h".
12183         (Archive::add_symbols): Add mapfile parameter.  Change all
12184         callers.  Pass mapfile, symbol, and reason to include_member.
12185         (Archive::include_all_members): Add mapfile parameter.  Change all
12186         callers.
12187         (Archive::include_member): Add mapfile, sym, and why parameters.
12188         Change all callers.  Report inclusion to map file.
12189         * archive.h: Include "fileread.h".
12190         (class Archive): Update declarations.
12191         (Archive::file): New const method.
12192         (class Add_archive_symbols): Add mapfile_ field.  Update
12193         constructor.  Change all callers.
12194         * readsyms.h (class Read_symbols): Likewise.
12195         (class Finish_group): Likewise.
12196         (class Read_script): Likewise.
12197         * common.cc: Include "mapfile.h".
12198         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12199         all callers.
12200         (Symbol_table::do_allocate_commons): Likewise.
12201         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12202         symbol allocation to mapfile.
12203         * common.h (class Allocate_commons_task): Add mapfile_ field.
12204         Update constructor.  Change all callers.
12205         * symtab.h (class Symbol_table): Update declarations.
12206         * layout.cc: Include "mapfile.h".
12207         (Layout_task_runner::run): Print information to mapfile.
12208         (Layout::create_gold_note): Change Output_data_fixed_space to
12209         Output_data_zero_fill.
12210         (Layout::create_build_id): Likewise.
12211         (Layout::print_to_mapfile): New function.
12212         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12213         constructor.  Change caller.
12214         (class Layout): Declare print_to_mapfile.
12215         * output.cc (Output_section::Input_section::print_to_mapfile): New
12216         function.
12217         (Output_section::add_input_section): If producing a map, always
12218         add to input_sections_ list.
12219         (Output_section::do_print_to_mapfile): New function.
12220         (Output_segment::print_sections_to_mapfile): New function.
12221         (Output_segment::print_section_list_to_mapfile): New function.
12222         * output.h: Include "mapfile.h".
12223         (Output_data::print_to_mapfile): New function.
12224         (Output_data::do_print_to_mapfile): New virtual function.
12225         (Output_segment_headers::do_print_to_mapfile): New function.
12226         (Output_file_header::do_print_to_mapfile): New function.
12227         (Output_data_const::do_print_to_mapfile): New function.
12228         (class Output_data_const_buffer): Add map_name_ field.  Update
12229         constructor.  Change all callers.  Add do_print_to_mapfile
12230         function.
12231         (class Output_data_fixed_space): Likewise.
12232         (class Output_data_space): Likewise.
12233         (class Output_data_zero_fill): New class.
12234         (Output_data_strtab::do_print_to_mapfile): New function.
12235         (Output_data_reloc_base::do_print_to_mapfile): New function.
12236         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12237         (Output_data_group::do_print_to_mapfile): New function.
12238         (Output_data_got::do_print_to_mapfile): New function.
12239         (Output_data_dynamic::do_print_to_mapfile): New function.
12240         (Output_symtab_xindex::do_print_to_mapfile): New function.
12241         (class Output_section): Declare do_print_to_mapflie.  Declare
12242         print_to_mapfile in Input_section.
12243         (class Output_segment): Declare new functions.
12244         * object.h (Sized_relobj::symbol_count): New function.
12245         * script-sections.cc
12246         (Output_section_element_dot_assignment::set_section_addresses):
12247         Change Output_data_fixed_space to Output_data_zero_fill.
12248         (Output_data_expression::do_print_to_mapfile): New function.
12249         * script.cc (read_input_script): Add mapfile parameter.  Change
12250         all callers.
12251         * script.h (read_input_script): Update declaration.
12252         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12253         (Eh_frame::do_print_to_mapfile): New function.
12254         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12255         (Output_merge_string::do_print_to_mapfile): New function.
12256         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12257         function.
12258         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12259         function.
12260         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12261         function.
12262         * Makefile.am (CCFILES): Add mapfile.cc.
12263         (HFILES): Add mapfile.h.
12264         * Makefile.in: Rebuild.
12265
12266 2008-05-19  Ian Lance Taylor  <iant@google.com>
12267
12268         * options.h (class General_options): Add -z relro.
12269         * layout.cc (Layout::Layout): Initialize relro_segment_.
12270         (Layout::add_output_section_data): Return the output section.
12271         (Layout::make_output_section): Rcognize relro sections and mark
12272         them appropriately.
12273         (Layout::attach_allocated_section_to_segment): Put relro sections
12274         in a PT_GNU_RELRO segment.
12275         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12276         section as relro.
12277         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12278         PT_TLS segments.
12279         (Layout::linkonce_mapping): Map d.rel.ro.local to
12280         .data.rel.ro.local.
12281         (Layout::output_section_name): Us .data.rel.ro.local for any
12282         section which begins with that.
12283         * layout.h (class Layout): Update add_output_section_data
12284         declaration.  Add relro_segment_ field.
12285         * output.cc (Output_section::Output_section): Initialize is_relro_
12286         and is_relro_local_ fields.
12287         (Output_segment::add_output_section): Group relro sections.
12288         (Output_segment::is_first_section_relro): New function.
12289         (Output_segment::maximum_alignment): If there is a relro section,
12290         align the segment to the common page size.
12291         (Output_segment::set_section_addresses): Track whether we are
12292         looking at relro sections.  If the last section is a relro
12293         section, align to the common page size.
12294         (Output_segment::set_section_list_addresses): Add in_relro
12295         parameter.  Change all callers.  Align to the page size when
12296         moving from relro to non-relro section.
12297         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12298         segment.
12299         * output.h (class Output_section): Add is_relro_ and
12300         is_relro_local_ fields.
12301         (Output_section::is_relro): New function.
12302         (Output_section::set_is_relro): New function.
12303         (Output_section::is_relro_local): New function.
12304         (Output_section::set_is_relro_local): New function.
12305         (class Output_segment): Update declarations.
12306         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12307         * sparc.cc (Target_sparc::got_section): Likewise.
12308         * x86_64.cc (Target_x86_64::got_section): Likewise.
12309         * testsuite/relro_test_main.cc: New file.
12310         * testsuite/relro_test.cc: New file.
12311         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12312         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12313         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12314         (relro_test.so, relro_test_pic.o): New targets.
12315         * testsuite/Makefile.in: Rebuild.
12316
12317 2008-05-16  Ian Lance Taylor  <iant@google.com>
12318
12319         * output.cc (Output_segment::add_output_section): Remove front
12320         parameter.
12321         * output.h (class Output_segment): Remove
12322         add_initial_output_section and overloaded add_output_section.
12323         Update declaration of remaining add_output_section.
12324         * layout.cc (Layout::create_interp): Call add_output_section
12325         rather than add_initial_output_section.
12326         (Layout::finish_dynamic_section): Likewise.
12327
12328         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12329         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12330         know the dynamic type.
12331         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12332         field.  Initialize it in constructor.
12333         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12334         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12335         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12336         reloc.
12337
12338         * output.cc (Output_reloc::get_address): Change return type to
12339         Elf_Addr.
12340         * output.h (class Output_reloc): Update get_address declaration.
12341         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12342         for section addresses.
12343
12344 2008-05-09  Ian Lance Taylor  <iant@google.com>
12345
12346         PR 6493
12347         * gold.cc (gold_nomem): Use return value of write.
12348
12349 2008-05-08  Ian Lance Taylor  <iant@google.com>
12350
12351         * symtab.c (Symbol::init_base_output_data): Add version
12352         parameter.  Change all callers.
12353         (Symbol::init_base_output_segment): Likewise.
12354         (Symbol::init_base_constant): Likewise.
12355         (Symbol::init_base_undefined): Likewise.
12356         (Sized_symbol::init_output_data): Likewise.
12357         (Sized_symbol::init_output_segment): Likewise.
12358         (Sized_symbol::init_constant): Likewise.
12359         (Sized_symbol::init_undefined): Likewise.
12360         (Symbol_table::do_define_in_output_data): If the new symbol has a
12361         version, mark it as the default.
12362         (Symbol_table::do_define_in_output_segment): Likewise.
12363         (Symbol_table::do_define_as_constant): Likewise.
12364         * symtab.h (class Symbol): Update declarations.
12365         (class Sized_symbol): Likewise.
12366         * resolve.cc (Symbol::override_version): New function.
12367         (Symbol::override_base): Call override_version.
12368         (Symbol::override_base_with_special): Likewise.
12369         * testsuite/ver_script_8.script: New file.
12370         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12371         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12372         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12373         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12374
12375 2008-05-06  Ian Lance Taylor  <iant@google.com>
12376
12377         PR 6049
12378         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12379         functions.
12380         (class General_options): Remove existing --undefined, and add
12381         --no-undefined instead.  Add new --undefined as synonym for -u.
12382         * archive.cc (Archive::add_symbols): Check whether symbol was
12383         named with -u.
12384         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12385         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12386         all uses.  Add IS_UNDEFINED.  Update declarations to split
12387         different versions of init_base.  Declare init_base_undefined.
12388         (Symbol::is_defined): Handle IS_UNDEFINED.
12389         (Symbol::is_undefined): Likewise.
12390         (Symbol::is_weak_undefined): Call is_undefined.
12391         (Symbol::is_absolute): Handle IS_CONSTANT.
12392         (class Sized_symbol): Update declarations to split different
12393         versions of init.  Declare init_undefined.
12394         (class Symbol_table): Declare new functions.
12395         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12396         Change all callers.
12397         (Symbol::init_base_output_data): Likewise.
12398         (Symbol::init_base_output_segment): Likewise.
12399         (Symbol::init_base_constant): Likewise.
12400         (Symbol::init_base_undefined): New function.
12401         (Sized_symbol::init_object): Rename from init.  Change all
12402         callers.
12403         (Sized_symbol::init_output_data): Likewise.
12404         (Sized_symbol::init_output_segment): Likewise.
12405         (Sized_symbol::init_constant): Likewise.
12406         (Sized_symbol::init_undefined): New function.
12407         (Symbol_table::add_undefined_symbols_from_command_line): New
12408         function.
12409         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12410         function.
12411         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12412         (Symbol::output_section): Likewise.
12413         (Symbol::set_output_section): Likewise.
12414         (Symbol_table::sized_finalize_symbol): Likewise.
12415         (Symbol_table::sized_write_globals): Likewise.
12416         * resolve.cc (Symbol_table::should_override): Likewise.
12417         (Symbol::override_base_with_special): Likewise.
12418
12419         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12420         symbol, change it to have default visibility.
12421         * testsuite/protected_1.cc: New file.
12422         * testsuite/protected_2.cc: New file.
12423         * testsuite/protected_3.cc: New file.
12424         * testsuite/protected_main_1.cc: New file.
12425         * testsuite/protected_main_2.cc: New file.
12426         * testsuite/protected_main_3.cc: New file.
12427         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12428         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12429         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12430         (protected_1.so): New target.
12431         (protected_1_pic.o, protected_2_pic.o): New targets.
12432         (protected_3_pic.o): New target.
12433         (check_PROGRAMS): Add protected_2.
12434         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12435         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12436         * testsuite/Makefile.in: Rebuild.
12437
12438         * options.h (DEFINE_var): Add set_user_set_##varname__.
12439         (DEFINE_bool_alias): New macro.
12440         (class General_options): Define -Bstatic using DEFINE_bool_alias
12441         rather than DEFINE_special.  Add --undefined as an alias for -z
12442         defs.
12443         * options.cc (General_options::parse_Bstatic): Remove.
12444
12445         * options.h (class General_options): Add --fatal-warnings.
12446         * main.cc (main): Implement --fatal-warnings.
12447         * errors.h (Errors::warning_count): New function.
12448
12449         * options.h (class General_options): Add -Bsymbolic-functions.
12450         * symtab.h (Symbol::is_preemptible): Check for
12451         -Bsymbolic-functions.
12452
12453 2008-05-05  Ian Lance Taylor  <iant@google.com>
12454
12455         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12456         as noVARNAME rather than no-VARNAME.
12457         (class General_options): Add option -z combreloc.
12458         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12459         get_address.
12460         (Output_reloc::sort_before) [SHT_REL]: New function.
12461         (Output_reloc::sort_before) [SHT_RELA]: New function.
12462         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12463         Sort_relocs_comparison.
12464         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12465         parameter.  Change all callers.
12466         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12467         sort_relocs parameter.  Change all callers.
12468         * output.cc (Output_reloc::get_address): New function, broken out
12469         of write_rel.
12470         (Output_reloc::write_rel): Call it.
12471         (Output_reloc::compare): New function.
12472         (Output_data_reloc_base::do_write): Optionally sort relocs.
12473
12474         * configure.ac: If targ_extra_obj is set, link it in.
12475         * configure.tgt: Initialize all variables.
12476         (x86_64*): Set targ_extra_obj and targ_extra_size.
12477         * configure: Rebuild.
12478
12479         * object.cc (Sized_relobj::include_section_group): Adjust section
12480         indexes read from group data.  Build vector to pass to
12481         layout_group.
12482         * layout.cc (Layout::layout_group): Add flags and shndxes
12483         parameters.  Remove contents parameter.  Change caller.  Update
12484         explicit instantiations.
12485         * layout.h (class Layout): Update layout_group declaration.
12486         * output.cc (Output_data_group::Output_data_group): Add flags and
12487         input_shndxes parameters.  Remove contents parameter.  Change
12488         caller.
12489         (Output_data_group::do_write): Change input_sections_ to
12490         input_shndxes_.
12491         * output.h (class Output_data_group): Update constructor
12492         declaration.  Rename input_sections_ to input_shndxes_.
12493         * testsuite/many_sections_test.cc: Add template.
12494
12495 2008-04-30  Cary Coutant  <ccoutant@google.com>
12496
12497         * target-reloc.h (relocate_section): Fix dead-pointer bug.
12498
12499         * layout.cc (Layout::include_section): Refactored check for debug
12500         info section.
12501         (Layout::add_comdat): Add new parameters.  Change type
12502         of signature parameter.  Add object and shndx to signatures table.
12503         (Layout::find_kept_object): New function.
12504         * layout.h: Include <cstring>.
12505         (Layout::is_debug_info_section): New function.
12506         (Layout::add_comdat): Add new parameters.
12507         (Layout::find_kept_object): New function.
12508         (Layout::Kept_section): New struct.
12509         (Layout::Signatures): Change type of map range.
12510         * object.cc (Relobj::output_section_address): New function.
12511         (Sized_relobj::include_section_group): Add new parameters.  Change
12512         calls to Layout::add_comdat.  Change to build table of kept comdat
12513         groups and table mapping discarded sections to kept sections.
12514         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
12515         (Sized_relobj::do_layout): Change calls to include_section_group and
12516         include_linkonce_section.
12517         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
12518         value to zero when section is discarded.
12519         (Sized_relobj::map_to_kept_section): New function.
12520         * object.h (Relobj::output_section_address): New function.
12521         (Relobj::Comdat_group): New type.
12522         (Relobj::find_comdat_group): New function.
12523         (Relobj::Comdat_group_table): New type.
12524         (Relobj::Kept_comdat_section): New type.
12525         (Relobj::Kept_comdat_section_table): New type.
12526         (Relobj::add_comdat_group): New function.
12527         (Relobj::set_kept_comdat_section): New function.
12528         (Relobj::get_kept_comdat_section): New function.
12529         (Relobj::comdat_groups_): New field.
12530         (Relobj::kept_comdat_sections_): New field.
12531         (Symbol_value::input_value): Update comment.
12532         (Sized_relobj::map_to_kept_section) New function.
12533         (Sized_relobj::include_linkonce_section): Add new parameter.
12534         * target-reloc.h (Comdat_behavior): New type.
12535         (get_comdat_behavior): New function.
12536         (relocate_section): Add code to map a discarded section to the
12537         corresponding kept section when applying a relocation.
12538
12539 2008-04-30  Craig Silverstein  <csilvers@google.com>
12540
12541         * dwarf_reader.cc (next_generation_count): New static var.
12542         (Addr2line_cache_entry): New struct.
12543         (addr2line_cache): New static var.
12544         (Dwarf_line_info::one_addr2line): Added caching.
12545         (Dwarf_line_info::clear_addr2line_cache): New function.
12546         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
12547         cache-size parameter.
12548         (Dwarf_line_info::one_addr2line_cache): New function.
12549         * symtab.cc (Symbol_table::detect_odr_violations): Pass
12550         new cache-size argument to one_addr2line(), and clear cache.
12551
12552 2008-04-28  Cary Coutant  <ccoutant@google.com>
12553
12554         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
12555         R_386_PC8 relocations.
12556
12557 2008-04-23  Ian Lance Taylor  <iant@google.com>
12558
12559         * object.cc (Sized_relobj::include_section_group): Check for
12560         invalid section group.
12561
12562         * object.cc (make_elf_object): Correct test for 64-bit ELF file
12563         header size.
12564
12565         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
12566         than read for file header.
12567         * archive.cc (Archive::include_member): Likewise.
12568
12569 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
12570
12571         * aclocal.m4: Regenerate.
12572         * configure: Regenerate.
12573
12574 2008-04-19  Ian Lance Taylor  <iant@google.com>
12575
12576         * version.cc (version_string): Bump to 1.6.
12577
12578         * testsuite/Makefile.am (many_sections_r_test): New target.
12579         (many_sections_r_test_SOURCES): Remove.
12580         (many_sections_r_test_DEPENDENCIES): Remove.
12581         (many_sections_r_test_LDFLAGS): Remove.
12582         (many_sections_r_test_LDADD): Remove.
12583
12584         * object.cc (Sized_relobj::do_add_symbols): Always pass
12585         local_symbol_count_ to add_from_relobj.
12586
12587         * testsuite/Makefile.am (many_sections_check.h): Only check one in
12588         every thousand variables.
12589         * testsuite/Makefile.in: Rebuild.
12590
12591         * object.cc (Xindex::initialize_symtab_xindex): New function.
12592         (Xindex::read_symtab_xindex): New function.
12593         (Xindex::sym_xindex_to_shndx): New function.
12594         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
12595         available.
12596         (Sized_relobj::do_initialize_xindex): New function.
12597         (Sized_relobj::do_read_symbols): Adjust section links.
12598         (Sized_relobj::symbol_section_and_value): Add is_ordinary
12599         parameter.  Change all callers.
12600         (Sized_relobj::include_section_group): Adjust section links and
12601         symbol section indexes.
12602         (Sized_relobj::do_layout): Adjust section links.
12603         (Sized_relobj::do_count_local_symbols): Adjust section links and
12604         symbol section indexes.
12605         (Sized_relobj::do_finalize_local_symbols): Distinguish between
12606         ordinary and special symbols.
12607         (Sized_relobj::write_local_symbols): Add symtab_xindex and
12608         dynsym_xindex parameters.  Change all callers.  Adjust section
12609         links.  Use SHN_XINDEX when needed.
12610         (Sized_relobj::get_symbol_location_info): Adjust section links.
12611         Don't get fooled by special symbols.
12612         * object.h (class Xindex): Define.
12613         (class Object): Add xindex_ parameter.  Declare virtual functoin
12614         do_initialize_xindex.
12615         (Object::adjust_sym_shndx): New function.
12616         (Object::set_xindex): New protected function.
12617         (class Symbol_value): Add is_ordinary_shndx_ field.
12618         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
12619         (Symbol_value::value): Assert ordinary section.
12620         (Symbol_value::initialize_input_to_output_map): Likewise.
12621         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
12622         Change all callers.
12623         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
12624         all callers.
12625         (class Sized_relobj): Update declarations.
12626         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
12627         parameter.  Change all callers.
12628         (Sized_relobj::adjust_shndx): New function.
12629         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
12630         field.
12631         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
12632         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
12633         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
12634         (Sized_dynobj::read_dynsym_section): Adjust section links.
12635         (Sized_dynobj::read_dynamic): Likewise.
12636         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
12637         section links.
12638         (Sized_dynobj::do_initialize_xindex): New function.
12639         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
12640         do_initialize_xindex.
12641         (Sized_dynobj::adjust_shndx): New function.
12642         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
12643         dynsym_xindex_ fields.
12644         (Layout::finalize): Add a call to set_section_indexes before
12645         creating the symtab sections.
12646         (Layout::set_section_indexes): Don't do anything if the section
12647         already has a section index.
12648         (Layout::create_symtab_sections): Add shnum parameter.  Change
12649         caller.  Create .symtab_shndx section if needed.
12650         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
12651         caller.
12652         (Layout::allocated_output_section_count): New function.
12653         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
12654         needed.
12655         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
12656         fields.  Update declarations.
12657         (Layout::symtab_xindex): New function.
12658         (Layout::dynsym_xindex): New function.
12659         (class Write_symbols_task): Add layout_ field.
12660         (Write_symbols_task::Write_symbols_task): Add layout parameter.
12661         Change caller.
12662         * output.cc (Output_section_headers::Output_section_headers): Add
12663         shstrtab_section parameter.  Change all callers.
12664         (Output_section_headers::do_sized_write): Store overflow values
12665         for section count and section string table section index in
12666         section header zero.
12667         (Output_file_header::do_sized_write): Check for overflow of
12668         section count and section string table section index.
12669         (Output_symtab_xindex::do_write): New function.
12670         (Output_symtab_xindex::endian_do_write): New function.
12671         * output.h (class Output_section_headers): Add shstrtab_section_.
12672         Update declarations.
12673         (class Output_symtab_xindex): Define.
12674         (Output_section::has_out_shndx): New function.
12675         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
12676         field.
12677         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
12678         Change all callers.
12679         (Sized_symbol::init): Likewise.
12680         (Symbol::output_section): Check for ordinary symbol.
12681         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
12682         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
12683         callers.
12684         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
12685         Change all callers.  Simplify handling of symbols from sections
12686         not included in the link.
12687         (Symbol_table::add_from_dynobj): Handle ordinary symbol
12688         distinction.
12689         (Weak_alias_sorter::operator()): Assert that symbols are
12690         ordinary.
12691         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
12692         distinction.
12693         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
12694         parameters.  Change all callers.
12695         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
12696         symbol distinction.  Use SHN_XINDEX when needed.
12697         (Symbol_table::write_section_symbol): Add symtab_xindex
12698         parameter.  Change all callers.
12699         (Symbol_table::sized_write_section_symbol): Likewise.  Use
12700         SHN_XINDEX when needed.
12701         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
12702         declarations.
12703         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
12704         (Symbol::is_defined): Check is_ordinary.
12705         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
12706         (Symbol::is_absolute, Symbol::is_common): Likewise.
12707         (class Sized_symbol): Update declarations.
12708         (class Symbol_table): Update declarations.
12709         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
12710         parameters.  Change all callers.
12711         (Sized_symbol::override): Likewise.
12712         (Symbol_table::override): Likewise.
12713         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
12714         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
12715         is_ordinary, and orig_st_shndx parameters.  Change all callers.
12716         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
12717         to be in an ordinary section.
12718         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
12719         object and is_ordinary parameters.  Change all callers.
12720         (Sized_dwarf_line_info::read_relocs): Add object parameter.
12721         Change all callers.  Don't add undefined or non-ordinary symbols
12722         to reloc_map_.
12723         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
12724         Change all callers.
12725         * dwarf_reader.h (class Sized_dwarf_line_info): Update
12726         declarations.
12727         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
12728         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
12729         (Sized_relobj::relocate_sections): Likewise.
12730         * target-reloc.h (scan_relocs): Adjust section symbol index.
12731         (scan_relocatable_relocs): Likewise.
12732         * i386.cc (Scan::local): Check for ordinary symbols.
12733         * sparc.cc (Scan::local): Likewise.
12734         * x86_64.cc (Scan::local): Likewise.
12735         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
12736         to symbol_section_and_value.
12737         * testsuite/many_sections_test.cc: New file.
12738         * testsuite/Makefile.am (BUILT_SOURCES): Define.
12739         (check_PROGRAMS): Add many_sections_test.
12740         (many_sections_test_SOURCES): Define.
12741         (many_sections_test_DEPENDENCIES): Define.
12742         (many_sections_test_LDFLAGS): Define.
12743         (BUILT_SOURCES): Add many_sections_define.h.
12744         (many_sections_define.h): New target.
12745         (BUILT_SOURCES): Add many_sections_check.h.
12746         (many_sections_check.h): New target.
12747         (check_PROGRAMS): Add many_sections_r_test.
12748         (many_sections_r_test_SOURCES): Define.
12749         (many_sections_r_test_DEPENDENCIES): Define.
12750         (many_sections_r_test_LDFLAGS): Define.
12751         (many_sections_r_test_LDADD): Define.
12752         (many_sections_r_test.o): New target.
12753         * testsuite/Makefile.in: Rebuild.
12754
12755 2008-04-17  Cary Coutant  <ccoutant@google.com>
12756
12757         * errors.cc (Errors::info): New function.
12758         (gold_info): New function.
12759         * errors.h (Errors::info): New function.
12760         * gold.h (gold_info): New function.
12761         * object.cc (Input_objects::add_object): Print trace output.
12762         * options.cc (options::parse_set): New function.
12763         (General_options::parse_wrap): Deleted.
12764         (General_options::General_options): Deleted initializer.
12765         * options.h (options::String_set): New typedef.
12766         (options::parse_set): New function.
12767         (DEFINE_set): New macro.
12768         (General_options::wrap): Changed to use DEFINE_set. Changed
12769         callers of any_wrap_symbols and is_wrap_symbol.
12770         (General_options::trace, General_options::trace_symbol):
12771         New options.
12772         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
12773         (General_options::wrap_symbols_): Deleted.
12774         * symtab.cc (Symbol_table::add_from_object): Print trace output.
12775
12776 2008-04-17  David S. Miller  <davem@davemloft.net>
12777
12778         * options.cc (General_options::parse_V): New function.
12779         * options.h: Add entries for -V and -Qy.
12780
12781 2008-04-17  Ian Lance Taylor  <iant@google.com>
12782
12783         * common.cc (Symbol_table::allocate_commons): Remove options
12784         parameter.  Change caller.
12785         (Symbol_table::do_allocate_commons): Remove options parameter.
12786         Change caller.  Just call do_allocate_commons_list twice.
12787         (Symbol_table::do_allocate_commons_list): New function, broken out
12788         of do_allocate_commons.
12789         * common.h (class Allocate_commons_task): Remove options_ field.
12790         Update constructor.
12791         * symtab.cc (Symbol_table::Symbol_table): Initialize
12792         tls_commons_.
12793         (Symbol_table::add_from_object): Put TLS common symbols on
12794         tls_commons_ list.
12795         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
12796         which are IN_OUTPUT_DATA.
12797         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
12798         allocate_commons and do_allocate_commons declarations.  Declare
12799         do_allocate_commons_list.
12800         * gold.cc (queue_middle_tasks): Update creation of
12801         Allocate_commons_task to not pass options.
12802         * testsuite/Makefile.am (INCLUDES): Add -I.. .
12803         (TLS_TEST_C_FLAGS): New variable.
12804         (tls_test_c_pic.o): New target.
12805         (tls_test_shared.so): Link in tls_test_c_pic.o.
12806         (tls_test_c_pic_ie.o): New target.
12807         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
12808         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
12809         (tls_test_c.o): New target.
12810         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
12811         (tls_pic_test_LDADD): Likewise.
12812         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
12813         (tls_shared_gd_to_ie_test_LDADD): Likewise.
12814         (tls_test_c_gnu2.o): New target.
12815         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
12816         tls_test_c_gnu2.o.
12817         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
12818         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
12819         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
12820         * testsuite/tls_test.cc: Include "config.h".
12821         (t_last): Call t11_last.
12822         * testsuite/tls_test.h (t11, t11_last): Declare.
12823         * testsuite/tls_test_c.c: New file.
12824         * testsuite/tls_test_main.cc (thread_routine): Call t11.
12825         * configure.ac: Check for OpenMP support.
12826         * configure, config.in, Makefile.in: Rebuild.
12827         * testsuite/Makefile.in: Rebuild.
12828
12829 2008-04-16  Cary Coutant  <ccoutant@google.com>
12830
12831         * i386.cc (Target_i386::define_tls_base_symbol): New function.
12832         (Target_i386::tls_base_symbol_defined_): New field.
12833         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12834         (Target_i386::Scan::global): Likewise.
12835         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
12836         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
12837         (Target_x86_64::tls_base_symbol_defined_): New field.
12838         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
12839         (Target_x86_64::Scan::global): Likewise.
12840
12841 2008-04-16  Cary Coutant  <ccoutant@google.com>
12842
12843         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
12844         (Symbol::needs_plt_entry): Allow weak undefined symbols.
12845         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
12846         building shared libraries.
12847         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
12848         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
12849         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
12850         * testsuite/Makefile.in: Rebuild.
12851         * testsuite/weak_undef.h: New file.
12852         * testsuite/weak_undef_file1.cc: Add extra test cases.
12853         * testsuite/weak_undef_file2.cc: Likewise.
12854         * testsuite/weak_undef_test.cc: Likewise.
12855
12856 2008-04-16  David S. Miller  <davem@davemloft.net>
12857
12858         * sparc.cc (Target_sparc::Scan): Change from struct to class.
12859         Add issued_non_pic_error_ field.  Declare check_non_pic.
12860         (Target_sparc::Scan::check_non_pic): New function.
12861         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
12862         (Target_sparc::Scan::global): Likewise.
12863
12864         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
12865         * configure: Rebuild.
12866
12867         * options.h (DEFINE_enable): New macro.
12868         (new_dtags): New enable option.
12869         (initfirst, interpose, loadfltr, nodefaultlib,
12870         nodelete, nodlopen, nodump): New -z options.
12871         * layout.cc (Layout:finish_dynamic_section): If new
12872         dtags enabled, emit DT_RUNPATH.  Also, emit a
12873         DT_FLAGS_1 containing any specified -z flags.
12874
12875 2008-04-16  Ian Lance Taylor  <iant@google.com>
12876
12877         * copy-relocs.cc: New file.
12878         * copy-relocs.h: New file.
12879         * reloc.cc: Remove Copy_relocs code.
12880         * reloc.h: Likewise.
12881         * reloc-types.h (struct Reloc_types) [both versions]: Add
12882         get_reloc_addend_noerror.
12883         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
12884         variants of add_global which take an addend which must be zero.
12885         * i386.cc: Include "copy-relocs.h".
12886         (class Target_i386): Change type of copy_relocs_ to variable,
12887         update initializer.
12888         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
12889         Change all callers.
12890         (Target_i386::do_finalize_sections): Change handling of
12891         copy_relocs_.
12892         * sparc.cc: Include "copy-relocs.h".
12893         (class Target_sparc): Change type of copy_relocs_ to variable,
12894         update initializer.
12895         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
12896         Change all callers.
12897         (Target_sparc::do_finalize_sections): Change handling of
12898         copy_relocs_.
12899         * x86_64.cc: Include "copy-relocs.h".
12900         (class Target_x86_64): Change type of copy_relocs_ to variable,
12901         update initializer.
12902         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
12903         class.  Change all callers.
12904         (Target_x86_64::do_finalize_sections): Change handling of
12905         copy_relocs_.
12906         * Makefile.am (CCFILES): Add copy-relocs.cc.
12907         (HFILES): Add copy-relocs.h.
12908
12909         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
12910
12911         * testsuite/script_test_4.sh: Permit leading zeroes.
12912
12913 2008-04-15  Ian Lance Taylor  <iant@google.com>
12914
12915         * script-sections.cc (Script_sections::create_segments): Use
12916         header_size_adjustment even when there is enough room for the
12917         headers.
12918         * testsuite/script_test_4.sh: New file.
12919         * testsuite/script_test_4.t: New file.
12920         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
12921         (check_DATA): Add script_test_4.stdout.
12922         (MOSTLYCLEANFILES): Likewise.
12923         (script_test_4): New target.
12924         (script_test_4.stdout): New target.
12925         * testsuite/Makefile.in: Rebuild.
12926
12927         * sparc.cc: Add definitions for Output_data_plt_sparc class
12928         constants.
12929
12930 2008-04-14  David S. Miller  <davem@davemloft.net>
12931
12932         * sparc.cc: New file.
12933         * Makefile.am (TARGETSOURCES): Add sparc.cc
12934         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
12935         * configure.tgt: Document targ_extra_size and
12936         targ_extra_big_endian.  Add entries for sparc-* and
12937         sparc64-*.
12938         * configure.ac: Handle targ_extra_size and
12939         targ_extra_big_endian.
12940         * Makefile.in: Rebuild.
12941         * configure: Likewise.
12942         * po/POTFILES.in: Likewise.
12943         * po/gold.pot: Likewise.
12944
12945 2008-04-14  Ian Lance Taylor  <iant@google.com>
12946
12947         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
12948         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
12949         in the name/type/flags to section mapping.  Don't call
12950         allocate_output_section.
12951         (Layout::choose_output_section): Change parameter from adjust_name
12952         to is_input_section.  Don't permit input sections after sections
12953         are attached to segments.  Don't call allocate_output_section.
12954         (Layout::layout_eh_frame): Call update_flags_for_input_section,
12955         not write_enable_output_section.
12956         (Layout::make_output_section): Don't push to
12957         unattached_section_list_ nor call attach_to_segment.  Call
12958         attach_section_to_segment if sections are attached.
12959         (Layout::attach_sections_to_segments): New function.
12960         (Layout::attach_section_to_segment): New function.
12961         (Layout::attach_allocated_section_to_segment): Rename from
12962         attach_to_segment.  Remove flags parameter.
12963         (Layout::allocate_output_section): Remove function.
12964         (Layout::write_enable_output_section): Remove function.
12965         * layout.h (class Layout): Update for above changes.  Add new
12966         field sections_are_attached_.
12967         * output.h (Output_section::update_flags_for_input_section): New
12968         function.
12969         * output.cc (Output_section::add_input_section): Call
12970         update_flags_for_input_section.
12971         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
12972
12973 2008-04-11  Cary Coutant  <ccoutant@google.com>
12974
12975         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
12976         thought unnecessary.
12977         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
12978
12979 2008-04-11  Ian Lance Taylor  <iant@google.com>
12980
12981         * output.h (class Output_section_data): Remove inline definition
12982         of set_addralign.
12983         * output.cc (Output_section_data::set_addralign): New function.
12984
12985 2008-04-11  Cary Coutant  <ccoutant@google.com>
12986
12987         Add support for TLS descriptors for i386 and x86_64.
12988         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
12989         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
12990         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
12991         GOT_TYPE_TLS_DESC.
12992         (Target_i386::got_mod_index_entry): Remove unnecessary code.
12993         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
12994         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
12995         relocations.
12996         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
12997         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
12998         Fix problem with initial-exec relocations.
12999         (Target_i386::Relocate::relocate_tls): Likewise.
13000         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13001         relaxation.
13002         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13003         support for section-plus-offset dynamic table entries.
13004         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13005         (Output_data_dynamic::Dynamic_entry): Add support for
13006         section-plus-offset dynamic table entries.
13007         (Output_data_dynamic::Classification): Likewise.
13008         (Output_data_dynamic::classification_): Renamed offset_.
13009         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13010         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13011         (Target_x86_64::make_plt_section): New function.
13012         (Target_x86_64::reserve_tlsdesc_entries): New function.
13013         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13014         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13015         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13016         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13017         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13018         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13019         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13020         add extra PLT entry for TLS descriptors.
13021         (Output_data_plt_x86_64::got_): New field.
13022         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13023         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13024         fields.
13025         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13026         descriptors.
13027         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13028         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13029         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13030         R_386_TLS_DESC_CALL relocations.
13031         (Target_x86_64::Scan::global): Likewise.
13032         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13033         for TLS descriptors.
13034         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13035         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13036         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13037         GD-to-IE relaxation.
13038         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13039         and TLS_DESCRIPTORS.
13040         * Makefile.in: Rebuild.
13041         * configure: Rebuild.
13042         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13043         (tls_test_shared2.so): New target.
13044         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13045         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13046         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13047         (tls_shared_gd_to_ie_test_LDADD): New variable.
13048         (tls_shared_gnu2_gd_to_ie_test): New target.
13049         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13050         New targets.
13051         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13052         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13053         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13054         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13055         (tls_shared_gnu2_test): New target.
13056         (tls_test_gnu2_shared.so): New target.
13057         (tls_shared_gnu2_test_SOURCES): New variable.
13058         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13059         (tls_shared_gnu2_test_LDFLAGS): New variable.
13060         (tls_shared_gnu2_test_LDADD): New variable.
13061         * testsuite/Makefile.in: Rebuild.
13062         * testsuite/Makefile.
13063
13064 2008-04-11  Ian Lance Taylor  <iant@google.com>
13065
13066         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13067         justsyms.t.
13068         * testsuite/Makefile.in: Rebuild.
13069
13070         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13071         long.
13072         * testsuite/script_test_2.cc (main): Adjust test.
13073
13074 2008-04-11  David S. Miller  <davem@davemloft.net>
13075             Ian Lance Taylor  <iant@google.com>
13076
13077         * options.h (General_options): Add entries for '-Y' and
13078         '-relax'.
13079         * options.cc (General_options:finalize): If -Y was used, add those
13080         entries to the library path instead of the default "/lib" and
13081         "/usr/lib".
13082
13083 2008-04-11  David S. Miller  <davem@davemloft.net>
13084
13085         * testsuite/justsyms.t: Start at 0x100.
13086         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13087         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13088         long.
13089         * testsuite/script_test_2.cc: Adjust string and section length
13090         checks.
13091
13092 2008-04-09  Ian Lance Taylor  <iant@google.com>
13093
13094         PR gold/5996
13095         * script-sections.cc (Sections_element::allocate_to_segment): Add
13096         orphan parameter.
13097         (Output_section_definition::allocate_to_segment): Likewise.
13098         (Orphan_output_section::allocate_to_segment): Likewise.
13099         (Script_sections::attach_sections_using_phdrs_clause): Don't
13100         propagate non-PT_LOAD segments to orphan sections.
13101         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13102         readelf rather than objdump.
13103         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13104         .interp section and PT_INTERP segment are the same size.
13105         * testsuite/Makefile.in: Rebuild.
13106
13107         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13108         aliases for symbols defined in the same object.
13109         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13110         (weak_alias_test_SOURCES): New variable.
13111         (weak_alias_test_DEPENDENCIES): New variable.
13112         (weak_alias_test_LDFLAGS): New variable.
13113         (weak_alias_test_LDADD): New variable.
13114         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13115         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13116         (weak_alias_test_3.o): New target.
13117         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13118         * testsuite/weak_alias_test_main.cc: New file.
13119         * testsuite/weak_alias_test_1.cc: New file.
13120         * testsuite/weak_alias_test_2.cc: New file.
13121         * testsuite/weak_alias_test_3.cc: New file.
13122
13123 2008-04-08  Ian Lance Taylor  <iant@google.com>
13124
13125         * options.h (class General_options): Add --noinhibit-exec option.
13126         * main.cc (main): Check --noinhibit-exec.
13127
13128         * options.h (class General_options): Define --wrap as a special
13129         option.  Add wrap_symbols_ field.
13130         (General_options::any_wrap_symbols): New function.
13131         (General_options::is_wrap_symbol): New function.
13132         * options.cc (General_options::parse_wrap): New function.
13133         (General_options::General_options): Initialize wrap_symbols_.
13134         * symtab.cc (Symbol_table::wrap_symbol): New function.
13135         (Symbol_table::add_from_object): Handle --wrap.
13136         * symtab.h (class Symbol_table): Declare wrap_symbol.
13137         * target.h (Target::wrap_char): New function.
13138         (Target::Target_info): Add wrap_char field.
13139         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13140         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13141         * testsuite/testfile.cc (Target_test::test_target_info):
13142         Likewise.
13143
13144         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13145         there is one.
13146
13147         * layout.h (class Layout): Add added_eh_frame_data_ field.
13148         * layout.cc (Layout::Layout): Initialize new field.
13149         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13150         output section until we find a section we merged successfully.
13151         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13152         that the size be non-zero.
13153
13154         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13155         qualifier.
13156
13157 2008-04-08  Craig Silverstein  <csilvers@google.com>
13158
13159         * configure.ac: Export new conditional variable HAVE_ZLIB.
13160         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13161         on HAVE_ZLIB.
13162         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13163         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13164
13165 2008-04-07  Ian Lance Taylor  <iant@google.com>
13166
13167         * version.cc (version_string): Set to "1.5".
13168
13169         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13170         Add issued_non_pic_error_ field.  Declare check_non_pic.
13171         (Target_x86_64::Scan::check_non_pic): New function.
13172         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13173         (Target_x86_64::Scan::global): Likewise.
13174
13175         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13176         addend parameter.  Change caller.  Handle merge sections.
13177         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13178         Address to Addend.  Don't add in the result of
13179         local_section_offset, pass down the addend and use the returned
13180         value.
13181         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13182         Update declarations of local_section_offset and symbol_value.
13183         * testsuite/two_file_test_1.cc (t18): New function.
13184         * testsuite/two_file_test_2.cc (f18): New function.
13185         * testsuite/two_file_test_main.cc (main): Call t18.
13186         * testsuite/two_file_test.h (t18, f18): Declare.
13187
13188         * configure.ac: Don't test for objdump, c++filt, or readelf.
13189         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13190         conditionals.
13191         (TEST_READELF): New variable.
13192         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13193         (check_PROGRAMS): Add two_file_strip_test.
13194         (two_file_strip_test): New target.
13195         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13196         (two_file_same_shared_strip_test_SOURCES): New variable.
13197         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13198         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13199         (two_file_same_shared_strip_test_LDADD): New variable.
13200         (two_file_shared_strip.so): New target.
13201         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13202         (ver_test_5.syms, ver_test_7.syms): Likewise.
13203         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13204         (strip_test_3.stdout): Use TEST_OBJDUMP.
13205         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13206
13207 2008-04-04  Cary Coutant  <ccoutant@google.com>
13208
13209         * symtab.h (Symbol::is_weak_undefined): New function.
13210         (Symbol::is_strong_undefined): New function.
13211         (Symbol::is_absolute): New function.
13212         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13213         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13214         absolute symbols.
13215         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13216         (weak_undef_test): New target.
13217         * testsuite/Makefile.in: Rebuild.
13218         * testsuite/weak_undef_file1.cc: New file.
13219         * testsuite/weak_undef_file2.cc: New file.
13220         * testsuite/weak_undef_test.cc: New file.
13221
13222 2008-04-03  Craig Silverstein  <csilvers@google.com>
13223
13224         * compressed_output.h (class Output_compressed_section): Use
13225         unsigned buffer.
13226         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13227         add zlib header.
13228         (zlib_compressed_suffix): Removed.
13229         (Output_compressed_section::set_final_data_size): Use unsigned
13230         buffers.
13231         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13232         Fix linker invocation.
13233         (flagstest_o_specialfile_and_compress_debug_sections):
13234         Likewise.
13235         * testsuite/Makefile.in: Regenerated.
13236
13237 2008-04-02  David S. Miller  <davem@davemloft.net>
13238
13239         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13240         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13241
13242 2008-04-02  Craig Silverstein  <csilvers@google.com>
13243
13244         * TODO: New file.
13245
13246 2008-04-02  Ian Lance Taylor  <iant@google.com>
13247
13248         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13249         parameters.  Update for new key type to views_.  Change all
13250         callers.
13251         (File_read::read): Adjust for byteshift in returned view.
13252         (File_read::add_view): New function, broken out of
13253         find_and_make_view.
13254         (File_read::make_view): New function, broken out of
13255         find_and_make_view.
13256         (File_read::find_or_make_view): Add offset and aligned
13257         parameters.  Rewrite accordingly.  Change all callers.
13258         (File_read::get_view): Add offset and aligned parameters.  Adjust
13259         for byteshift in return value.
13260         (File_read::get_lasting_view): Likewise.
13261         * fileread.h (class File_read): Update declarations.
13262         (class File_read::View): Add byteshift_ field.  Add byteshift to
13263         constructor.  Add byteshift method.
13264         * archive.h (Archive::clear_uncached_views): New function.
13265         (Archive::get_view): Add aligned parameter.  Change all callers.
13266         * object.h (Object::get_view): Add aligned parameter.  Change all
13267         callers.
13268         (Object::get_lasting_view): Likewise.
13269
13270         * fileread.cc (File_read::release): Don't call clear_views if
13271         there are multiple objects.
13272         * fileread.h (File_read::clear_uncached_views): New function.
13273         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13274         on the archive.
13275
13276 2008-03-31  Cary Coutant  <ccoutant@google.com>
13277
13278         Add thin archive support.
13279         * archive.cc (Archive::armagt): New const.
13280         (Archive::setup): Remove task parameter and calls to unlock.
13281         (Archive::unlock_nested_archives): New function.
13282         (Archive::read_header): Add nested_off parameter. Change
13283         all callers.
13284         (Archive::interpret_header): Likewise.
13285         (Archive::include_all_members): Change to handle thin
13286         archives.
13287         (Archive::include_member): Likewise.
13288         * archive.h (Archive::Archive): Add new parameters and
13289         initializers.
13290         (Archive::armagt): New const.
13291         (Archive::setup): Remove task parameter.
13292         (Archive::unlock_nested_archives): New function.
13293         (Archive::read_header): Add nested_off parameter.
13294         (Archive::interpret_header): Likewise.
13295         (Archive::Nested_archive_table): New typedef.
13296         (Archive::is_thin_archive_): New field.
13297         (Archive::nested_archives_): New field.
13298         (Archive::options_): New field.
13299         (Archive::dirpath_): New field.
13300         (Archive::task_): New field.
13301         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13302         for thin archives.  Pass additional parameters to
13303         Archive::Archive.  Unlock the archive file after calling
13304         Archive::setup.
13305
13306 2008-03-29  Ian Lance Taylor  <iant@google.com>
13307
13308         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13309         version symbol to be local.
13310         * testsuite/ver_test_4.sh: New file.
13311         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13312         (check_DATA): Add ver_test_4.syms.
13313         (ver_test_4.syms): New target.
13314         * testsuite/Makefile.in: Rebuild.
13315
13316         * output.cc
13317         (Output_section::Input_section_sort_entry::has_priority): New
13318         function.
13319         (Output_section::Input_section_sort_entry::match_file_name): New
13320         function.
13321         (Output_section::Input_section_sort_entry::match_section_name):
13322         Remove.
13323         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13324         Remove.
13325         (Output_section::Input_section_sort_entry::match_section_file):
13326         Remove.
13327         (Output_section::Input_section_sort_compare::operator()): Rewrite
13328         using new Input_section_sort_entry functions.  Sort crtbegin and
13329         crtend first.  Sort sections with no priority before sections with
13330         a priority.
13331         * testsuite/initpri1.c (d3): Check j != 4.
13332         (cd5): New constructor/destructor function.
13333         (main): Check j != 2.
13334
13335         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13336         new symbol when resolving, don't call set_is_default.
13337         * testsuite/ver_test_7.cc: New file.
13338         * testsuite/ver_test_7.sh: New file.
13339         * testsuite/Makefile.am (ver_test_7.so): New target.
13340         (ver_test_7.o): New target.
13341         (check_SCRIPTS): Add ver_test_7.sh.
13342         (check_DATA): Add ver_test_7.syms.
13343         (ver_test_7.syms): New target.
13344
13345 2008-03-28  Ian Lance Taylor  <iant@google.com>
13346
13347         * layout.cc (Layout::layout): If we see an input section with a
13348         name that needs sorting, set the must_sort flag for the output
13349         section.
13350         (Layout::make_output_section): If the name of the output section
13351         indicates that it might require sorting, set the may_sort flag.
13352         * output.h (Output_section::may_sort_attached_input_sections): New
13353         function.
13354         (Output_section::set_may_sort_attached_input_sections): New
13355         function.
13356         (Output_section::must_sort_attached_input_sections): New
13357         function.
13358         (Output_section::set_must_sort_attached_input_sections): New
13359         function.
13360         (class Output_section): Declare Input_section_sort_entry.  Define
13361         Input_section_sort_compare.  Declare
13362         sort_attached_input_sections.  Add new fields:
13363         may_sort_attached_input_sections_,
13364         must_sort_attached_input_sections_,
13365         attached_input_sections_are_sorted_.
13366         * output.cc (Output_section::Output_section): Initialize new
13367         fields.
13368         (Output_section::add_input_section): Add an entry to
13369         input_sections_ if may_sort or must_sort are true.
13370         (Output_section::set_final_data_size): Call
13371         sort_attached_input_sections if necessary.
13372         (Output_section::Input_section_sort_entry): Define new class.
13373         (Output_section::Input_section_sort_compare::operator()): New
13374         function.
13375         (Output_section::sort_attached_input_sections): New function.
13376         * configure.ac: Check whether the compiler supports constructor
13377         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13378         * testsuite/initpri1.c: New file.
13379         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13380         CONSTRUCTOR_PRIORITY.
13381         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13382         (initpri1_LDFLAGS): New variable.
13383         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13384
13385 2008-03-27  Ian Lance Taylor  <iant@google.com>
13386
13387         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13388         * testsuite/common_test_1.c: New file.
13389         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13390         (common_test_1_SOURCES): New variable.
13391         (common_test_1_DEPENDENCIES): New variable.
13392         (common_test_1_LDFLAGS): New variable.
13393
13394         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13395         and commons_ correctly when NAME/VERSION does not override
13396         NAME/NULL.
13397         * testsuite/ver_test_6.c: New file.
13398         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13399         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13400         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13401
13402 2008-03-26  Ian Lance Taylor  <iant@google.com>
13403
13404         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13405         of an undefined symbol from a version script.
13406         * testsuite/Makefile.am (ver_test_5.so): New target.
13407         (ver_test_5.o): New target.
13408         (check_SCRIPTS): Add ver_test_5.sh.
13409         (check_DATA): Add ver_test_5.syms.
13410         (ver_test_5.syms): New target.
13411         * testsuite/ver_test_5.cc: New file.
13412         * testsuite/ver_test_5.script: New file.
13413         * testsuite/ver_test_5.sh: New file.
13414         * Makefile.in, testsuite/Makefile.in: Rebuild.
13415
13416         PR gold/5986
13417         Fix problems building gold with gcc 4.3.0.
13418         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13419         (gold_error_at_location, gold_warning_at_location): Use it.
13420         * configure.ac: Check whether we can compile and use a template
13421         function with a printf attribute.
13422         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13423         when jumping over bytes.
13424         * object.cc: Instantiate Object::read_section_data.
13425         * debug.h: Include <cstring>
13426         * dwarf_reader.cc: Include <algorithm>
13427         * main.cc: Include <cstring>.
13428         * options.cc: Include <cstring>.
13429         * output.cc: Include <cstring>.
13430         * script.cc: Include <cstring>.
13431         * script.h: Include <string>.
13432         * symtab.cc: Include <cstring> and <algorithm>.
13433         * target-select.cc: Include <cstring>.
13434         * version.cc: Include <string>.
13435         * testsuite/testmain.cc: Include <cstdlib>.
13436         * configure, config.in: Rebuild.
13437
13438 2008-03-25  Ian Lance Taylor  <iant@google.com>
13439
13440         * options.cc: Include "../bfd/bfdver.h".
13441         (options::help): Print bug reporting address.
13442
13443         * version.cc (print_version): Adjust output for current value of
13444         BFD_VERSION_STRING.
13445
13446         * NEWS: New file.
13447
13448         * options.cc (options::help): Print list of supported targets.
13449         * target-select.h: Include <vector>.
13450         (class Target_selector): Make machine_, size_, and is_big_endian_
13451         fields const.  Add bfd_name_ and instantiated_target_ fields.
13452         (Target_selector::Target_selector): Add bfd_name parameter.
13453         (Target_selector::recognize): Make non-virtual, call
13454         do_recognize.
13455         (Target_selector::recognize_by_name): Make non-virtual, call
13456         do_recognize_by_name.
13457         (Target_selector::supported_names): New function.
13458         (Target_selector::bfd_name): New function.
13459         (Target_selector::do_instantiate_target): New pure virtual
13460         function.
13461         (Target_selector::do_recognize): New virtual function.
13462         (Target_selector::do_recognize_by_name): New virtual function.
13463         (Target_selector::instantiate_target): New private function.
13464         (supported_target_names): Declare.
13465         * target-select.cc (Target_selector::Target_selector): Update for
13466         new parameter and fields.
13467         (select_target_by_name): Check that the name matches before
13468         calling recognize_by_name.
13469         (supported_target_names): New function.
13470         * i386.cc (class Target_selector_i386): Update Target_selector
13471         constructor call.  Remove recognize and recognize_by_name.  Add
13472         do_instantiate_target.
13473         * x86_64.cc (class Target_selector_x86_64): Likewise.
13474         * testsuite/testfile.cc (class Target_selector_test): Update for
13475         changes to Target_selector.
13476
13477         * README: Rewrite, with some notes on unsupported features.
13478
13479 2008-03-24  Cary Coutant  <ccoutant@google.com>
13480
13481         * i386.cc (Target_i386::Got_type): New enum declaration.
13482         (Target_i386::Scan::local): Updated callers of Output_data_got
13483         member functions.
13484         (Target_i386::Scan::global): Likewise.
13485         (Target_i386::Relocate::relocate): Likewise.
13486         (Target_i386::Relocate::relocate_tls): Likewise.
13487         * object.h (Got_offset_list): New class.
13488         (Sized_relobj::local_has_got_offset): Added got_type parameter.
13489         (Sized_relobj::local_got_offset): Likewise.
13490         (Sized_relobj::set_local_got_offset): Likewise.
13491         (Sized_relobj::local_has_tls_got_offset): Removed.
13492         (Sized_relobj::local_tls_got_offset): Removed.
13493         (Sized_relobj::set_local_tls_got_offset): Removed.
13494         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
13495         * output.cc (Output_data_got::add_global): Added got_type parameter.
13496         (Output_data_got::add_global_with_rel): Likewise.
13497         (Output_data_got::add_global_with_rela): Likewise.
13498         (Output_data_got::add_global_pair_with_rel): New function.
13499         (Output_data_got::add_global_pair_with_rela): New function.
13500         (Output_data_got::add_local): Added got_type parameter.
13501         (Output_data_got::add_local_with_rel): Likewise.
13502         (Output_data_got::add_local_with_rela): Likewise.
13503         (Output_data_got::add_local_pair_with_rel): New function.
13504         (Output_data_got::add_local_pair_with_rela): New function.
13505         (Output_data_got::add_global_tls): Removed.
13506         (Output_data_got::add_global_tls_with_rel): Removed.
13507         (Output_data_got::add_global_tls_with_rela): Removed.
13508         (Output_data_got::add_local_tls): Removed.
13509         (Output_data_got::add_local_tls_with_rel): Removed.
13510         (Output_data_got::add_local_tls_with_rela): Removed.
13511         * output.h (Output_data_got::add_global): Added got_type parameter.
13512         (Output_data_got::add_global_with_rel): Likewise.
13513         (Output_data_got::add_global_with_rela): Likewise.
13514         (Output_data_got::add_global_pair_with_rel): New function.
13515         (Output_data_got::add_global_pair_with_rela): New function.
13516         (Output_data_got::add_local): Added got_type parameter.
13517         (Output_data_got::add_local_with_rel): Likewise.
13518         (Output_data_got::add_local_with_rela): Likewise.
13519         (Output_data_got::add_local_pair_with_rel): New function.
13520         (Output_data_got::add_local_pair_with_rela): New function.
13521         (Output_data_got::add_global_tls): Removed.
13522         (Output_data_got::add_global_tls_with_rel): Removed.
13523         (Output_data_got::add_global_tls_with_rela): Removed.
13524         (Output_data_got::add_local_tls): Removed.
13525         (Output_data_got::add_local_tls_with_rel): Removed.
13526         (Output_data_got::add_local_tls_with_rela): Removed.
13527         * resolve.cc (Symbol::override_base_with_special): Removed
13528         reference to has_got_offset_ field.
13529         * symtab.cc (Symbol::init_fields): Replaced initialization
13530         of got_offset_ with got_offsets_.  Removed initialization
13531         of has_got_offset_
13532         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
13533         (Symbol::got_offset): Likewise.
13534         (Symbol::set_got_offset): Likewise.
13535         (Symbol::has_tls_got_offset): Removed.
13536         (Symbol::tls_got_offset): Removed.
13537         (Symbol::set_tls_got_offset): Removed.
13538         (Symbol::got_offset_): Removed.
13539         (Symbol::tls_mod_got_offset_): Removed.
13540         (Symbol::tls_pair_got_offset_): Removed.
13541         (Symbol::got_offsets_): New field.
13542         (Symbol::has_got_offset): Removed.
13543         (Symbol::has_tls_mod_got_offset): Removed.
13544         (Symbol::has_tls_pair_got_offset): Removed.
13545         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
13546         (Target_x86_64::Scan::local): Updated callers of Output_data_got
13547         member functions.
13548         (Target_x86_64::Scan::global): Likewise.
13549         (Target_x86_64::Relocate::relocate): Likewise.
13550         (Target_x86_64::Relocate::relocate_tls): Likewise.
13551
13552 2008-03-25  Ben Elliston  <bje@au.ibm.com>
13553
13554         * yyscript.y: Fix spelling error in comment.
13555
13556 2008-03-24  Ian Lance Taylor  <iant@google.com>
13557
13558         * options.h (class General_options): Define build_id option.
13559         * layout.h (class Layout): Declare write_build_id, create_note,
13560         create_build_id.  Add build_id_note_ member.
13561         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
13562         "libiberty.h", "md5.h", "sha1.h".
13563         (Layout::Layout): Initialize eh_frame_data_,
13564         eh_frame_hdr_section_, and build_id_note_.
13565         (Layout::finalize): Call create_build_id.
13566         (Layout::create_note): New function, broken out of
13567         Layout::create_gold_note.
13568         (Layout::create_gold_note): Call create_note.
13569         (Layout::create_build_id): New function.
13570         (Layout::write_build_id): New function.
13571         (Close_task_runner::run): Call write_build_id.
13572
13573         * x86_64.cc: Correct license to GPLv3.
13574
13575 2008-03-23  Ian Lance Taylor  <iant@google.com>
13576
13577         * options.cc: Include "demangle.h".
13578         (parse_optional_string): New function.
13579         (parse_long_option): Handle takes_optional_argument.
13580         (parse_short_option): Update dash_z initializer.  Handle
13581         takes_optional_argument.
13582         (General_options::General_options): Initialize do_demangle_.
13583         (General_options::finalize): Set do_demangle_.  Handle demangling
13584         style.
13585         * options.h (parse_optional_string): Declare.
13586         (struct One_option): Add optional_arg field.  Update constructor.
13587         Update call constructor calls.  Add takes_optional_argument
13588         function.
13589         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
13590         (DEFINE_optional_string): Define.
13591         (General_options::demangle): Change from DEFINE_bool to
13592         DEFINE_optional_string.
13593         (General_options::no_demangle): New function.
13594         (General_options::do_demangle): New function.
13595         (General_options::set_do_demangle): New function.
13596         (General_options::execstack_status_): Move definition to end of
13597         class definition.
13598         (General_options::static_): Likewise.
13599         (General_options::do_demangle_): New field.
13600         * object.cc (big_endian>::get_symbol_location_info): Call
13601         Options::do_demangle, not Options::demangle.
13602         * symtab.cc (demangle): Likewise.
13603
13604 2008-03-22  Ian Lance Taylor  <iant@google.com>
13605
13606         * gold.h: Include <cstddef> and <sys/types.h>
13607         * options.h: Include <cstring>.
13608
13609 2008-03-21  Ian Lance Taylor  <iant@google.com>
13610
13611         * Added source code to GNU binutils.