* powerpc.cc (Stub_table::do_write): Delete redundant Address
[external/binutils.git] / gold / ChangeLog
1 2012-12-07  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Stub_table::do_write): Delete redundant Address
4         typedef and invalid_address constant.
5         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
6         instantiate constants.
7
8 2012-12-07  Alan Modra  <amodra@gmail.com>
9
10         * options.h (General_options): Add no_toc_optimize.
11         * powerpc.cc (ok_lo_toc_insn): New function.
12         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
13
14 2012-12-06  Alan Modra  <amodra@gmail.com>
15
16         * options.h (General_options): Add plt_align, plt_static_chain,
17         plt_thread_safe.  Update stub_group_size help text.
18         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
19         for new plt_thread_safe_ var.
20         (use_plt_offset): Correct comments.
21         (Target_powerpc::do_relax): Look for thread creation symbols to
22         determine default plt_thread_safe value.  Clear plt call stubs
23         as well as branch stubs each iteration.
24         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
25         insn constants.
26         (l, hi, ha, write_insn): Move earlier.
27         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
28         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
29         plt stubs too.
30         (Stub_table::update_size): Adjust.
31         (Stub_table::prev_size, set_prev_size): Delete.
32         (Stub_table::stub_align): Let --plt-align affect result.
33         (Stub_table::plt_call_size): Calculate sizes for various stubs.
34         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
35         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
36         (Stub_table::do_write): Support more stub variants.
37
38 2012-12-04  Alan Modra  <amodra@gmail.com>
39
40         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
41         (Target_powerpc::do_define_standard_symbols): New function.
42
43 2012-12-03  Alan Modra  <amodra@gmail.com>
44
45         * output.h: Formatting, whitespace.
46
47 2012-12-03  Alan Modra  <amodra@gmail.com>
48
49         * layout.h (Layout::get_executable_sections): Declare.
50         * layout.cc (Layout::get_executable_sections): New function.
51         * arm.cc (Target_arm::group_sections): Use it.
52         (Arm_output_section::group_sections): Delete now redundant test.
53         * output.cc (Output_reloc::Output_reloc): Add is_relative.
54         param to handle relative relocs.
55         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
56         (Output_data_reloc::add_absolute): Adjust.
57         (Output_data_reloc::add_relative): New function.
58         (Output_data::reset_data_size): New function.
59         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
60         (Output_section::set_addralign): New function.
61         (Output_section::checkpoint_set_addralign): New function.
62         (Output_section::clear_section_offsets_need_adjustment): New function.
63         (Output_section::input_sections): Make public.
64         * powerpc.cc (class Output_data_brlt_powerpc): New.
65         (class Stub_table, class Stub_control): New.
66         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
67         stub_table_, set_stub_table, stub_table): New vectors and accessor
68         functions.
69         (Target_powerpc::do_may_relax, do_relax, push_branch,
70         new_stub_table, stub_tables, brlt_section, group_sections,
71         add_branch_lookup_table, find_branch_lookup_table,
72         write_branch_lookup_table, make_brlt_section): New functions.
73         (Target_powerpc::struct Sort_sections, class Branch_info): New.
74         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
75         branch_info_): New vars.
76         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
77         make call stubs here.
78         (Output_data_glink): Remove all call stub handling from this class.
79         (Target_powerpc::Scan::local, global): Save interesting branch
80         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
81         (Target_powerpc::do_finalize_sections): Only make reg save/restore
82         functions on final link.
83         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
84         Handle long branch destinations too.
85         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
86         do_plt_address_for_local): Adjust lookup of plt call stubs.
87
88 2012-11-30  Alan Modra  <amodra@gmail.com>
89
90         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
91         relocs against protected symbols when building 32-bit shared libs.
92
93 2012-11-30  Alan Modra  <amodra@gmail.com>
94
95         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
96         param.  Call got_section() to make .got.  Update all callers
97         and their callers and so on.
98
99 2012-11-30  Alan Modra  <amodra@gmail.com>
100
101         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
102         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
103         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
104         value if it already exists.
105
106 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
107
108         PR gold/14858
109         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
110
111 2012-11-14  Roland McGrath  <mcgrathr@google.com>
112
113         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
114         than bfc instruction for data sandboxing.
115
116 2012-11-08  Alan Modra  <amodra@gmail.com>
117
118         * po/POTFILES.in: Regenerate.
119
120 2012-11-05  Alan Modra  <amodra@gmail.com>
121
122         * configure.ac: Apply 2012-09-10 change to config.in here.
123         * configure: Regenerate.
124
125 2012-11-05  Alan Modra  <amodra@gmail.com>
126
127         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
128         (struct Opd_ent): Use "Address" rather than "Offset".
129         (Output_data_got_powerpc::got_base_offset): Return Valtype.
130         (Target_powerpc::got_section): Make public.
131         (Target_powerpc::scan_relocs): Move code setting symbols..
132         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
133         Create _SDA_BASE_ only when referenced.
134
135 2012-11-02  Roland McGrath  <mcgrathr@google.com>
136
137         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
138         from last change.
139
140 2012-11-01  Roland McGrath  <mcgrathr@google.com>
141
142         * target.h (Sized_target::relocate_relocs): Use Elf_Off
143         for offset_in_output_section parameter.
144         (Sized_target::relocate_special_relocatable): Likewise.
145         * arm.cc (Target_arm::relocate_relocs): Likewise.
146         (Target_arm::relocate_special_relocatable): Likewise.
147         * i386.cc (Target_i386::relocate_relocs): Likewise.
148         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
149         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
150         * target-reloc.h (relocate_relocs): Likewise.
151         * testsuite/testfile.cc (Target_test): Likewise.
152         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
153         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
154
155         * system.h: Move inclusion of <clocale> to after <libintl.h> in
156         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
157
158         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
159         parameter, which is unused in the [!F_SETFD] case.
160
161         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
162         SYMNDX to off_t before comparing it to this->data_size().
163         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
164         * incremental.cc (Output_section_incremental_inputs::do_write):
165         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
166
167         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
168
169 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
170
171         * gold.cc (Target_arm::do_adjust_elf_header): Add the
172         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
173         in EABI_VER5.
174
175 2012-10-29  Cary Coutant  <ccoutant@google.com>
176
177         * dwp.cc (usage): Add file and exit status parameters;
178         add --help and --version options.
179         (print_version): New function.
180         (main): Add --help and --version options.
181
182 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
183
184         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
185         final_layout_sequence.txt.
186         * testsuite/Makefile.in: Regenerated.
187
188 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
189
190         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
191         COMPILE generated by automake.
192         (LINK1): Likewise.
193         (CXXCOMPILE1): Likewise.
194         (CXXLINK1): Likewise.
195         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
196         (LINK): Likewise.
197         (CXXCOMPILE): Likewise.
198         (CXXLINK): Likewise.
199         * testsuite/Makefile.in: Regenerated.
200
201 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
202
203         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
204         on bad fwrite return.
205
206 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
207
208         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
209         on val.
210
211 2012-10-23  Cary Coutant  <ccoutant@google.com>
212
213         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
214         * testsuite/Makefile.in: Regenerate.
215         * testsuite/dwp_test.h: New source file.
216         * testsuite/dwp_test_1.cc: New source file.
217         * testsuite/dwp_test_1.s: New source file.
218         * testsuite/dwp_test_1.sh: New source file.
219         * testsuite/dwp_test_1b.cc: New source file.
220         * testsuite/dwp_test_1b.s: New source file.
221         * testsuite/dwp_test_2.cc: New source file.
222         * testsuite/dwp_test_2.s: New source file.
223         * testsuite/dwp_test_2.sh: New source file.
224         * testsuite/dwp_test_main.cc: New source file.
225         * testsuite/dwp_test_main.s: New source file.
226
227 2012-10-23  Cary Coutant  <ccoutant@google.com>
228
229         * dwp.h: New header file.
230         * dwp.cc: New source file.
231         * gold.h: Move shared declarations to system.h.
232         * system.h: New header file.
233         * Makefile.am: Add dwp.
234         * Makefile.in: Regenerate.
235
236 2012-10-23  Cary Coutant  <ccoutant@google.com>
237
238         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
239         Dwarf_info_reader::read_from_pointer.
240         (Dwarf_pubnames_table::read_header): Likewise.
241         (Dwarf_pubnames_table::next_name): Likewise.
242         (Dwarf_die::read_attributes): Likewise.
243         (Dwarf_die::skip_attributes): Likewise.
244         (Dwarf_info_reader::read_from_pointer): New function template.
245         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
246         (Dwarf_pubnames_table): Likewise.
247         (Dwarf_info_reader::read_from_pointer): New function template.
248         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
249         Dwarf_pubnames_table ctor.
250
251 2012-10-23  Cary Coutant  <ccoutant@google.com>
252
253         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
254         abbrev_shndx.
255         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
256         abbrev_shndx_.
257         (Dwarf_info_reader::set_abbrev_shndx): New method.
258         (Dwarf_info_reader::abbrev_shndx_): New data member.
259
260 2012-10-23  Cary Coutant  <ccoutant@google.com>
261
262         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
263         from object, not parameters.
264         (Dwarf_info_reader::parse): Likewise.
265         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
266         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
267         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
268         methods.
269
270 2012-10-23  Cary Coutant  <ccoutant@google.com>
271
272         * fileread.cc (Input_file::Input_file): New constructor.
273         * fileread.h (class Input_file): Add new constructor.
274
275 2012-10-18  Alan Modra  <amodra@gmail.com>
276
277         PR gold/14727
278         * object.cc (Relobj::is_section_name_included): Also match
279         .sdata personality section.
280
281 2012-10-18  Alan Modra  <amodra@gmail.com>
282
283         * target-reloc.h (class Default_comdat_behavior): New, package up..
284         (get_comdat_behaviour): ..this.
285         (relocate_section): Add Relocate_comdat_behavior template arg,
286         adjust code to suit.
287         * arm.cc (Target_arm::relocate_section): Adjust to suit.
288         (Target_arm::scan_reloc_section): Likewise.
289         * i386.cc (Target_i386::relocate_section): Likewise.
290         * sparc.cc (Target_sparc::relocate_section): Likewise.
291         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
292         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
293         * powerpc.cc (class Relocate_comdat_behavior): New.
294         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
295         gold::relocate_section with new template arg.
296
297 2012-10-18  Alan Modra  <amodra@gmail.com>
298
299         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
300         dynamic relocs for GOT_TPREL got entries, without symbol if
301         resolving locally.
302         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
303         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
304         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
305
306 2012-10-17  Alan Modra  <amodra@gmail.com>
307
308         PR gold/14726
309         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
310
311 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
312
313         * layout.cc (Layout::include_section): Keep sections marked
314         SHF_EXCLUDE when doing relocatable links.
315
316 2012-10-16  Alan Modra  <amodra@gmail.com>
317
318         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
319         (Target_powerpc::do_finalize_sections): Call it.
320         (Output_data_save_res): New class and supporting functions.
321         (Target_powerpc::symval_for_branch): Only look up .opd entry for
322         normal symbols defined in object files.
323
324 2012-10-12  Alan Modra  <amodra@gmail.com>
325
326         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
327         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
328         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
329         section if scan_opd_relocs not yet called.
330         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
331
332 2012-10-12  Alan Modra  <amodra@gmail.com>
333
334         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
335         add_local_ifunc_entry): Revert last change.
336         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
337
338 2012-10-05  Alan Modra  <amodra@gmail.com>
339
340         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
341         do_plt_address_for_global): New functions.
342         (Output_data_got_powerpc::do_write): Don't segfault when linking
343         statically.
344         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
345         add_local_ifunc_entry): Return true on adding entry..
346         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
347         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
348         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
349         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
350         set up symbols here.
351         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
352         syms here.  Do so even when no .iplt.  Don't segfault when linking
353         statically.
354         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
355         new variants without reloc param.
356         (Glink_sym_ent::Glink_sym_ent): Likewise.
357         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
358         reloc when refs will resolve to plt call stub.
359         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
360         R_PPC_PLTREL24 to resolve locally.
361         (Target_powerpc::Scan::global): Correct ifunc handling.
362         (Target_powerpc::Relocate::relocate): Correct local sym glink
363         lookup.  Don't destroy "value" when we have a plt call stub,
364         and when checking plt call validity.
365         (Target_powerpc::do_dynsym_value): Simplify.
366
367 2012-10-05  Alan Modra  <amodra@gmail.com>
368
369         * i386.cc (Output_data_plt_i386::address_for_global,
370         address_for_local): Add plt offset to returned value.  Adjust uses.
371         * sparc.cc (Output_data_plt_sparc::address_for_global,
372         address_for_local): Likewise.
373         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
374         address_for_local): Likewise.
375         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
376         address_for_local): Likewise.
377         * target.h (Target::plt_address_for_global, plt_address_for_local):
378         Update comment.
379         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
380         (Output_data_got::Got_entry::write): Nor here.
381         * output.h: Comment fix.
382
383 2012-10-02  Jiong Wang  <jiwang@tilera.com>
384
385         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
386         global_offset_table_ value for larget got.
387         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
388
389 2012-09-29  Alan Modra  <amodra@gmail.com>
390
391         * powerpc.cc (Target_powerpc::iplt_): New output section.
392         (Target_powerpc::iplt_section, make_iplt_section,
393         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
394         (Target_powerpc::make_plt_entry): Handle ifunc syms.
395         Target_powerpc::plt_entry_count): Count iplt entries too.
396         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
397         reloc section in constructor.  New params.
398         (Target_powerpc::make_plt_section): Create reloc section here instead.
399         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
400         functions.
401         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
402         (Output_data_glink::add_entry, find_entry): New functions to
403         deal with local syms.
404         (Glink_sym_ent): Add support for local syms.
405         (Output_data_glink::do_write): Handle ifunc plt entries.
406         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
407         (Target_powerpc::Scan::local, global): Handle ifunc syms.
408         (Target_powerpc::Relocate::relocate): Likewise.
409         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
410
411 2012-09-25  Alan Modra  <amodra@gmail.com>
412
413         * object.h (Sized_relobj_file::adjust_local_symbol,
414         do_adjust_local_symbol): New functions.
415         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
416         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
417         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
418         and irregular opd entry spacing.
419         (Powerpc_relobj::do_read_relocs): Add opd size checks.
420         (Global_symbol_visitor_opd): New functor.
421         (Target_powerpc::do_finalize_sections): Omit global symbols defined
422         on deleted opd entries.
423
424 2012-09-15  Jiong Wang  <jiwang@tilera.com>
425
426         * tilegx.cc: New file.
427         * Makefile.am (TARGETSOURCES): Add tilegx.cc
428         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
429         * configure.tgt: Add entries for tilegx*.
430         * configure.ac: Likewise.
431         * Makefile.in: Rebuild.
432         * configure: Likewise.
433         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
434         tilegx.
435
436 2012-09-13  Alan Modra  <amodra@gmail.com>
437
438         * target-reloc.h (scan_relocs): Call scan.local for relocs
439         against symbols in discarded sections.  Pass is_discarded
440         param.
441         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
442         Add is_discarded param.
443         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
444         is_discarded to flag opd entry as discarded.  Don't emit dyn
445         relocs on such entries.
446         (Target_powerpc::Scan::global): Similarly detect and handle
447         such opd entries.
448         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
449         opd_ent_.  Update all uses.
450         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
451         (Target_powerpc::relocate_section): Zero out discarded opd
452         entry relocs.
453
454 2012-09-12  Ian Lance Taylor  <iant@google.com>
455
456         PR gold/14570
457         * output.cc: Rename Output_data_got template parameter from size
458         to got_size for all functions.  Compile all variants of
459         Output_data_got.
460         (Output_data_got::Got_entry::write): Correct use of size for
461         symbol value.  Use local_is_tls rather than casting to
462         Sized_relobj_file.
463         * object.h (class Object): Add local_is_tls and do_local_is_tls.
464         (class Sized_relobj_file): Add do_local_is_tls.
465         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
466
467 2012-09-11  Alan Modra  <amodra@gmail.com>
468
469         PR gold/14566
470         * layout.cc (Layout::set_segment_offsets): When using
471         common-page-size alignment, ensure we are on a new max-page-size
472         page.
473         * output.cc (Output_segment::set_section_addresses): Use
474         abi_pagesize, not common_pagesize for relro boundary.
475         (Output_segment::set_offset): Likewise.
476
477 2012-09-11  Alan Modra  <amodra@gmail.com>
478
479         * output.h (Output_data_got::add_global_tls, add_local_tls,
480         add_local_tls_pair): New functions.
481         (Output_data_got::add_local_pair_with_rel): Remove second
482         reloc param.  Expand comment.
483         (Output_data_got::Got_entry): Rename use_plt_offset_ to
484         use_plt_or_tls_offset_, similarly for constructor param.
485         (Output_data_got::Got_entry::write): Add got_index param.
486         * output.cc (Output_data_got::add_global_tls, add_local_tls,
487         add_local_tls_pair): New functions.
488         (Output_data_got::Got_entry::write): Handle tls symbols
489         with use_plt_or_tls_offset_ set specially.
490         (Output_data_got::add_local_pair_with_rel): Only one reloc.
491         (Output_data_got::do_write): Replace iterator with index, pass
492         index to entry write function.
493         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
494         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
495         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
496         call.
497         * i386.cc (Target_i386::Scan::local): Likewise.
498         * sparc.cc (Target_sparc::Scan::local): Likewise.
499         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
500         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
501         do_tls_offset_for_global): New functions.
502         (Target_powerpc::Scan::local): Correct TLS relocations and got
503         entry values.
504         (Target_powerpc::Scan::global): Don't emit unnecessary
505         dynamic relocations on TLS GOT entries.
506
507 2012-09-10  Matthias Klose  <doko@ubuntu.com>
508
509         * config.in: Disable sanity check for kfreebsd.
510
511 2012-09-10  Sterling Augustine  <saugustine@google.com>
512
513         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
514         (Gdb_index::pubtypes_read): New parameter.
515         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
516         to calls.
517         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
518         pubtypes_object_.
519
520 2012-09-09  Alan Modra  <amodra@gmail.com>
521
522         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
523         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
524         * gc.h (gc_process_relocs): Call target gc_add_reference.
525         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
526         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
527         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
528         unnecessary cast.
529         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
530         to cater for when we don't need code offset.  Update use.
531         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
532         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
533         set_opd_valid): New functions.
534         (Target_powerpc::do_gc_add_reference): New function.
535         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
536         stashed refs.
537         (Target_powerpc::do_gc_mark_symbol): New function.
538
539 2012-09-06  Cary Coutant  <ccoutant@google.com>
540
541         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
542         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
543         (Dwarf_die::skip_attributes): Likewise.
544         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
545         * testsuite/gdb_index_test.cc (inline_func_1): New function.
546         (main): Call it.
547         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
548
549 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
550
551         * testsuite/script_test_3.t: Add .got.plt output section
552         statement.
553         * testsuite/script_test_4.t: Likewise.
554
555 2012-09-05  Alan Modra  <amodra@gmail.com>
556
557         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
558         update all uses and lose "enum" when using type.
559
560 2012-09-05  Alan Modra  <amodra@gmail.com>
561
562         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
563         * configure: Regenerate.
564         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
565         (plugin_final_layout.stdout): Likewise.
566         (memory_test): Set page sizes to 0x1000.
567         * testsuite/Makefile.in: Regenerate.
568         * testsuite/discard_locals_test.sh: Add FIXME comment.
569         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
570         * testsuite/pr14265.t: Add .got output section statement.
571         * testsuite/script_test_2.t: Likewise.
572         * testsuite/script_test_3.t: Likewise.
573         * testsuite/script_test_4.t: Likewise.
574         * testsuite/script_test_5.t: Likewise.
575         * testsuite/script_test_6.t: Likewise.
576         * testsuite/script_test_7.t: Likewise.
577         * testsuite/script_test_9.t: Likewise.
578
579 2012-09-05  Alan Modra  <amodra@gmail.com>
580
581         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
582         (Powerpc_relocate_functions::Status): New typedef.
583         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
584         (Target_powerpc::Scan::local): Handle REL64.
585         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
586         for REL32 and REL64.
587         (Target_powerpc::symval_for_branch): New function, extracted from..
588         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
589         checks.  Report overflow errors.
590
591 2012-09-05  Alan Modra  <amodra@gmail.com>
592
593         * object.h (Sized_relobj_file::emit_relocs): Delete.
594         (Sized_relobj_file::emit_relocs_reltype): Delete.
595         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
596         relocate_relocs for --emit-relocs.
597         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
598         * output.h: Update comment.
599         (Output_segment::first_section): New function.
600         (Output_segment::first_section_load_address): Use first_section.
601         * output.cc (Output_segment::first_section): New function extracted..
602         (Output_segment::first_section_load_address): ..from here.  Delete.
603         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
604         * target.h (Sized_target::relocate_for_relocatable): Likewise.
605         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
606         adjust call to target.h function.
607         * i386.cc (Target_i386): Likewise.
608         * sparc.cc (Target_sparc): Likewise.
609         * x86_64.cc (Target_x86_64): Likewise.
610         * powerpc.cc (Target_powerpc): Likewise.
611         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
612         first tls section has section symbol for optimised local dynamic
613         output relocs.
614         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
615         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
616         optimised tls code.
617         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
618         Rename to relocate_relocs.  Update error message.
619
620 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
621
622         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
623         --just-symbols.
624
625 2012-08-31  Alan Modra  <amodra@gmail.com>
626
627         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
628         (Powerpc_relobj::toc_base_offset): New stub function.
629         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
630         got_mod_index_offset to tlsld_got_offset.  Update all refs.
631         (Target_powerpc::Relocate::enum skip_tls): New.
632         (Target_powerpc::call_tls_get_addr_): New var.
633         (Target_powerpc::is_branch_reloc): Move to file scope.
634         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
635         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
636         New functions.
637         (Target_powerpc::enum Got_type): Delete old values, add new ones.
638         (powerpc_info): Correct common_pagesize for ppc64.
639         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
640         (Powerpc_relocate_functions): Add overflow check enums and functions.
641         Add non-shift version of rela, rela_ua.  Delete all rel public
642         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
643         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
644         addr16_ha3, addr14 functions.
645         (Output_data_got_powerpc::add_constant_pair): New function.
646         (Output_data_got_powerpc::got_base_offset): Likewise.
647         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
648         (instruction constants): Sort, add some more.
649         (Output_data_glink::do_write): Add and use Address typedef.  Use
650         object->toc_base_offset() stub for 64-bit.
651         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
652         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
653         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
654         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
655         Always treat .opd relocs as against locally defined symbol.
656         Correct condition for RELATIVE relocs.
657         (Target_powerpc::do_finalize_sections): Test for NULL sections.
658         (Target_powerpc::Relocate::relocate): Use plt call stub as value
659         for 32-bit syms with a plt entry.  Correct ppc64 toc base
660         calculations.  Handle TLS relocs, and more.  Add overflow
661         checking and adjust for Powerpc_relocate_functions changes.
662         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
663         Reinstate --emit-relocs code with FIXME.
664
665 2012-08-30  Alan Modra  <amodra@gmail.com>
666
667         * layout.cc (Layout::set_segment_offsets): Set p_align to
668         abi_pagesize, not common_pagesize.
669         (Layout::relaxation_loop_body): Similarly use abi_pagesize
670         to determine whether file header can go in segment.
671
672 2012-08-30  Alan Modra  <amodra@gmail.com>
673
674         * output.h (Output_reloc::Output_reloc <output section>): Add
675         is_relative param.  Adjust calls.
676         (Output_reloc::add_output_section_relative): New functions.
677         * output.cc (Output_reloc::Output_reloc <output section>): Handle
678         is_relative.
679         (Output_reloc::symbol_value): Handle SECTION_CODE.
680
681 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
682
683         * gold.cc (queue_middle_tasks): Call layout again when unique
684         segments for sections is desired.
685         * layout.cc (Layout::Layout): Initialize new members.
686         (Layout::get_output_section_flags): New function.
687         (Layout::choose_output_section): Call get_output_section_flags.
688         (Layout::layout): Make output section for mapping to a unique segment.
689         (Layout::insert_section_segment_map): New function.
690         (Layout::attach_allocated_section_to_segment): Make unique segment for
691         output sections marked so.
692         (Layout::segment_precedes): Check for unique segments when sorting.
693         * layout.h (Layout::Unique_segment_info): New struct.
694         (Layout::Section_segment_map): New typedef.
695         (Layout::insert_section_segment_map): New function.
696         (Layout::get_output_section_flags): New function.
697         (Layout::is_unique_segment_for_sections_specified): New function.
698         (Layout::set_unique_segment_for_sections_specified): New function.
699         (Layout::unique_segment_for_sections_specified_): New member.
700         (Layout::section_segment_map_): New member.
701         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
702         Rename is_gc_pass_one to is_pass_one.
703         Rename is_gc_pass_two to is_pass_two.
704         Rename is_gc_or_icf to is_two_pass.
705         Check for which pass based on whether symbols data is present.
706         Make it two pass when unique segments for sections is desired.
707         * output.cc (Output_section::Output_section): Initialize new
708         members.
709         * output.h (Output_section::is_unique_segment): New function.
710         (Output_section::set_is_unique_segment): New function.
711         (Output_section::is_unique_segment_): New member.
712         (Output_section::extra_segment_flags): New function.
713         (Output_section::set_extra_segment_flags): New function.
714         (Output_section::extra_segment_flags_): New member.
715         (Output_section::segment_alignment): New function.
716         (Output_section::set_segment_alignment): New function.
717         (Output_section::segment_alignment_): New member.
718         (Output_segment::Output_segment): Initialize is_unique_segment_.
719         (Output_segment::is_unique_segment): New function.
720         (Output_segment::set_is_unique_segment): New function.
721         (Output_segment::is_unique_segment_): New member.
722         * plugin.cc (allow_unique_segment_for_sections): New function.
723         (unique_segment_for_sections): New function.
724         (Plugin::load): Add new functions to transfer vector.
725         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
726         * Makefile.in: Regenerate.
727         * testsuite/plugin_final_layout.sh: Check if unique segment
728         functionality works.
729         * testsuite/plugin_section_order.c (onload): Check if new interfaces
730         are available.
731         (allow_unique_segment_for_sections): New global.
732         (unique_segment_for_sections): New global.
733         (claim_file_hook): Call allow_unique_segment_for_sections.
734         (all_symbols_read_hook): Call unique_segment_for_sections.
735
736 2012-08-22  Cary Coutant  <ccoutant@google.com>
737
738         * layout.cc (Layout::include_section): Don't assert on GROUP
739         sections with --emit-relocs.
740
741 2012-08-21  Cary Coutant  <ccoutant@google.com>
742
743         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
744         if --export-dynamic-symbol names an undef symbol.
745
746 2012-08-18  Alan Modra  <amodra@gmail.com>
747
748         * powerpc.cc: Formatting and white space.
749         (Powerpc_relobj): Rename got2_section_ to special_.
750         Add opd_ent_shndx_ and opd_ent_off_ vectors.
751         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
752         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
753         (Target_powerpc): Add Address typedef and invalid_address.  Use
754         throughout.
755         (Target_powerpc::is_branch_reloc): New function.
756         (Powerpc_relocate_functions): Add Address typedef, use throughout.
757         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
758         for dst_mask, value and addend.
759         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
760         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
761         (Output_data_glink::do_write): Correct toc base.  Don't try to use
762         uint16_t for 24-bit offset.  Use get_output_section_offset and
763         check return.
764         (Target_powerpc::Scan::local): Handle more relocs.
765         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
766         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
767         Plug in toc restoring insn after plt calls.  Translate branches
768         to function descriptor symbols to corresponding entry point.
769         (Target_powerpc::relocate_for_relocatable): Check return from
770         get_output_section_offset.
771         * symtab.h: Comment typo.
772
773 2012-08-14  Ian Lance Taylor  <iant@google.com>
774
775         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
776         unsupported_relocal_local to call unsupported_reloc_global.
777
778 2012-08-14  Nick Clifton  <nickc@redhat.com>
779
780         PR ld/14265
781         * script-sections.cc (Sections_element::output_section_name): Add
782         keep return parameter.
783         (Output_section_element::match_name): Add keep return parameter.
784         Return the value of the keep_ member.
785         * script-sections.h (class Output_section): Update
786         output_section_name prototype.
787         * layout.cc (Layout::keep_input_section): New public member
788         function.
789         (Layout::choose_output_section): Pass keep parameter to
790         output_section_name.
791         * layout.h (class Layout): Add keep_input_section.
792         * object.cc (Sized_relobj_file::do_layout): Check for kept input
793         sections.
794         * testsuite/Makefile.am: Add a test.
795         * testsuite/Makefile.in: Regenerate.
796         * testsuite/pr14265.c: Source file for the test.
797         * testsuite/pr14265.t: Linker script for the test.
798         * testsuite/pr14265.sh: Shell script for the test.
799
800 2012-08-14  Alan Modra  <amodra@gmail.com>
801
802         * target.h (Target::output_section_name): New function.
803         (Target::do_output_section_name): New function.
804         * layout.cc (Layout::choose_output_section): Call the above.
805         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
806
807 2012-08-14  Alan Modra  <amodra@gmail.com>
808
809         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
810         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
811         for replace_constant call.
812         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
813         (Output_data_glink::do_print_to_mapfile): New function.
814         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
815         (Target_powerpc::Relocate::relocate): Likewise.
816
817 2012-08-14  Alan Modra  <amodra@gmail.com>
818
819         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
820         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
821         (Output_data_glink::add_entry,find_entry): Remove shndx param.
822         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
823         all references to shndx_.  Handle special case for R_PPC_PLTREL24
824         here.
825         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
826         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
827         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
828         here.
829         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
830         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
831
832 2012-08-12  Alan Modra  <amodra@gmail.com>
833
834         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
835         (glink insn constants): Use uint32_t.
836         (Output_data_glink::add_entry): Use insert, not [] operator.
837
838 2012-08-11  Alan Modra  <amodra@gmail.com>
839
840         * object.h (Sized_relobj_file::find_shdr): New function.
841         (Sized_relobj_file::find_special_sections): New function.
842         * object.cc (Sized_relobj_file::find_shdr): New function.
843         (Sized_relobj_file::find_eh_frame): Use find_shdr.
844         (Sized_relobj_file::find_special_sections): New function, split out..
845         (Sized_relobj_file::do_read_symbols): ..from here.
846         * output.h (Output_data_got::replace_constant): New function.
847         (Output_data_got::num_entries): New function.
848         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
849         (Output_data_got::got_offset): Protected rather than private.
850         (Output_data_got::replace_got_entry): New function.
851         * output.cc (Output_data_got::replace_got_entry): New function.
852         * powerpc.cc (class Powerpc_relobj): New.
853         (class Powerpc_relocate_functions): Delete all psymval variants or
854         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
855         Implement _ha functions using corresponding _hi function.
856         (Powerpc_relobj::find_special_sections): New function.
857         (Target_powerpc::do_make_elf_object): New function.
858         (class Output_data_got_powerpc): New.
859         (class Output_data_glink): New.
860         (class Powerpc_scan_relocatable_reloc): New.
861         Many more changes througout file.
862
863 2012-08-09  Nick Clifton  <nickc@redhat.com>
864
865         * po/vi.po: Updated Vietnamese translation.
866
867 2012-08-07  Ian Lance Taylor  <iant@google.com>
868
869         * layout.cc (Layout::add_target_dynamic_tags): If
870         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
871         plt_rel.
872
873 2012-07-30  Nick Clifton  <nickc@redhat.com>
874
875         * po/gold.pot: Updated template.
876         * po/es.po: Updated Spanish translation.
877
878 2012-07-18  Cary Coutant  <ccoutant@google.com>
879
880         PR gold/14344
881         * configure.ac: Add check for -gpubnames support.
882         * configure: Regenerate.
883         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
884         support; force -gno-pubnames.
885         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
886         support.
887         (gdb_index_test_4): New test.
888         * testsuite/Makefile.in: Regenerate.
889         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
890         * testsuite/gdb_index_test_2.sh: Likewise.
891         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
892         * testsuite/gdb_index_test_4.sh: New script.
893         * testsuite/gdb_index_test_comm.sh: New script with common code;
894         don't look for space after colon.
895
896 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
897
898         * gold.cc (queue_middle_tasks): Update function order only after
899         deferred objects due to plugins are processed.
900
901 2012-07-11  Ian Lance Taylor  <iant@google.com>
902
903         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
904         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
905         (Target_arm::scan_reloc_for_stub): Likewise.
906         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
907         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
908         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
909         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
910         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
911
912 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
913             Ian Lance Taylor  <iant@google.com>
914
915         PR gold/14309
916         * configure.ac: Test whether std::tr1::hash<off_t> works.
917         * gold.h: Add a specialization for std::tr1::hash<off_t> if
918         needed.
919         * output.h (class Output_fill): Add virtual destructor.
920         * configure, config.in: Rebuild.
921
922 2012-06-22  Roland McGrath  <mcgrathr@google.com>
923
924         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
925
926 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
927
928         * plugin.cc (Plugin::load): Handle position independent executables.
929
930 2012-06-06  Cary Coutant  <ccoutant@google.com>
931
932         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
933         add .debug_macro.
934         (lines_only_debug_sections): Likewise.
935         (gdb_fast_lookup_sections): New static array.
936         (is_gdb_debug_section): Rename formal parameter.
937         (is_lines_only_debug_section): Likewise.
938         (is_gdb_fast_lookup_section): New function.
939         (Layout::include_section): Check for ".zdebug_" prefix; pass
940         section name suffix to is_gdb_debug_section, et al.; check for
941         fast-lookup sections when building .gdb_index.
942         * options.h (--strip-debug-gdb): Update GDB version number.
943
944 2012-06-06  Cary Coutant  <ccoutant@google.com>
945
946         * configure.ac: Add check for fallocate.
947         * configure: Regenerate.
948         * config.in: Regenerate.
949
950         * options.h (class General_options): Add --mmap-output-file and
951         --posix-fallocate options.
952         * output.cc: (posix_fallocate): Remove; replace with...
953         (gold_fallocate): New function.
954         (Output_file::map_no_anonymous): Call gold_fallocate.
955         (Output_file::map): Check --mmap-output-file option.
956
957 2012-06-05  Jing Yu  <jingyu@google.com>
958
959         * gold.h (textdomain): Add do {} to empty while(0).
960         (bindtextdomain): Likewise.
961
962 2012-06-04  Cary Coutant  <ccoutant@google.com>
963
964         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
965         has_dynsym_index.
966
967 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
968
969         * symtab.cc (Symbol_table::define_special_symbol):
970         Initialize *poldsym to prevent uninitialized variable errors.
971
972 2012-05-23  Cary Coutant  <ccoutant@google.com>
973
974         * layout.cc (Layout::section_name_mapping): Add rules to handle
975         exact match on .data.rel.ro.local or .data.rel.ro.
976         (Layout::output_section_name): Check for exact matches.
977
978 2012-05-23  Cary Coutant  <ccoutant@google.com>
979
980         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
981         more carefully.
982
983 2012-05-22  Cary Coutant  <ccoutant@google.com>
984
985         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
986         object before exporting symbol.
987
988 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
989
990         * testsuite/tls_test.cc: Include "config.h" first.
991         * testsuite/tls_test_c.c: Likewise.
992
993 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
994             Nick Clifton  <nickc@redhat.com>
995
996         PR 14072
997         * configure.in: Add check that sysdep.h has been included before
998         any system header files.
999         * configure: Regenerate.
1000         * config.in: Regenerate.
1001
1002 2012-05-14  Cary Coutant  <ccoutant@google.com>
1003
1004         * layout.cc (Layout::make_output_section): Mark .tdata section
1005         as RELRO.
1006         * testsuite/relro_test.cc: Add a TLS variable.
1007
1008 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1009
1010         PR gold/14091
1011         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1012         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1013         R_X86_64_64.
1014
1015 2012-05-08  Cary Coutant  <ccoutant@google.com>
1016
1017         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1018         (lines_only_debug_sections): Likewise.
1019
1020 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1021
1022         * nacl.cc: New file.
1023         * nacl.h: New file.
1024         * Makefile.am (CCFILES, HFILES): Add them.
1025         * Makefile.in: Regenerate.
1026         * i386.cc (Output_data_plt_i386_nacl): New class.
1027         (Output_data_plt_i386_nacl_exec): New class.
1028         (Output_data_plt_i386_nacl_dyn): New class.
1029         (Target_i386_nacl): New class.
1030         (Target_selector_i386_nacl): New class.
1031         (target_selector_i386): Use it instead of Target_selector_i386.
1032         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1033         (Target_x86_64_nacl): New class.
1034         (Target_selector_x86_64_nacl): New class.
1035         (target_selector_x86_64, target_selector_x32): Use it instead of
1036         Target_selector_x86_64.
1037         * arm.cc (Output_data_plt_arm_nacl): New class.
1038         (Target_arm_nacl): New class.
1039         (Target_selector_arm_nacl): New class.
1040         (target_selector_arm, target_selector_armbe): Use it instead of
1041         Target_selector_arm.
1042
1043         * target-select.cc (select_target): Take new Input_file* and off_t
1044         arguments, pass them on to recognize method of selector.
1045         * object.cc (make_elf_sized_object): Update caller.
1046         * parameters.cc (parameters_force_valid_target): Likewise.
1047         * incremental.cc (make_sized_incremental_binary): Likewise.
1048         * target-select.h: Update decl.
1049         (Target_selector::recognize): Take new Input_file* argument,
1050         pass it on to do_recognize.
1051         (Target_selector::do_recognize): Take new Input_file* argument.
1052         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1053         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1054         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1055         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1056
1057         * target.h (Target::Target_info): New members isolate_execinstr
1058         and rosegment_gap.
1059         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1060         * arm.cc (Target_arm::arm_info): Update initializer.
1061         * i386.cc (Target_i386::i386_info): Likewise.
1062         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1063         * sparc.cc (Target_sparc::sparc_info): Likewise.
1064         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1065         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1066         * layout.cc (Layout::attach_allocated_section_to_segment):
1067         Take new const Target* argument.  If target->isolate_execinstr(), act
1068         like --rosegment.
1069         (Layout::find_first_load_seg): Take new const Target* argument;
1070         if target->isolate_execinstr(), reject PF_X segments.
1071         (Layout::relaxation_loop_body): Update caller.
1072         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1073         reset file offset to zero when we hit LOAD_SEG, and then do a second
1074         loop over the segments before LOAD_SEG to reassign offsets after
1075         addresses have been determined.  Handle target->rosegment_gap().
1076         (Layout::attach_section_to_segment): Take new const Target* argument;
1077         pass it to attach_allocated_section_to_segment.
1078         (Layout::make_output_section): Update caller.
1079         (Layout::attach_sections_to_segments): Take new const Target* argument;
1080         pass it to attach_section_to_segment.
1081         * gold.cc (queue_middle_tasks): Update caller.
1082         * layout.h (Layout): Update method decls with new arguments.
1083
1084         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1085         Target_info pointer to use.
1086         (Target_arm::do_make_data_plt): New virtual method.
1087         (Target_arm::make_data_plt): New method that calls it.
1088         (Target_arm::make_plt_entry): Use it.
1089         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1090         for the section alignment.
1091         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1092         method.
1093         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1094         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1095         method.
1096         (Output_data_plt_arm::get_plt_entry_size): Call it.
1097         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1098         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1099         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1100         method.
1101         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1102         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1103         method instead of sizeof(plt_entry).
1104         (Output_data_plt_arm::add_entry): Likewise.
1105         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1106         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1107         than static method.
1108         (Target_arm::plt_entry_size): Likewise.
1109         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1110         Move to ...
1111         (Output_data_plt_arm_standard): ... here, new class.
1112         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1113         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1114         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1115
1116         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1117         Take additional argument for the PLT entry size.
1118         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1119         Use get_plt_entry_size method rather than plt_entry_size variable.
1120         (Output_data_plt_x86_64::reserve_slot): Likewise.
1121         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1122         (Output_data_plt_x86_64::add_entry): Likewise.
1123         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1124         (Output_data_plt_x86_64::address_for_global): Likewise.
1125         (Output_data_plt_x86_64::address_for_local): Likewise.
1126         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1127         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1128         Make method non-static.
1129         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1130         method.
1131         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1132         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1133         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1134         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1135         virtual method.
1136         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1137         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1138         virtual method.
1139         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1140         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1141         virtual method.
1142         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1143         (Output_data_plt_x86_64::plt_entry_size)
1144         (Output_data_plt_x86_64::first_plt_entry)
1145         (Output_data_plt_x86_64::plt_entry)
1146         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1147         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1148         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1149         (Output_data_plt_x86_64_standard): ... here, new class.
1150         (Target_x86_64::Target_x86_64): Take optional argument for the
1151         Target_info pointer to use.
1152         (Target_x86_64::do_make_data_plt): New virtual method.
1153         (Target_x86_64::make_data_plt): New method to call it.
1154         (Target_x86_64::init_got_plt_for_update): Use that.
1155         Call this->plt_->add_eh_frame method here.
1156         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1157         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1158         rather than static method.
1159         (Target_x86_64::plt_entry_size): Likewise.
1160         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1161         rather than plt_entry_size variable.  Move guts of PLT filling to...
1162         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1163         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1164         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1165
1166         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1167         additional argument for the section alignment.
1168         Don't do add_eh_frame_for_plt here.
1169         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1170         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1171         variable.
1172         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1173         method.
1174         (Output_data_plt_i386::get_plt_entry_size): Call it.
1175         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1176         (Output_data_plt_i386::add_eh_frame): New method to call it.
1177         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1178         method.
1179         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1180         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1181         method.
1182         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1183         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1184         method instead of plt_entry_size.
1185         (Output_data_plt_i386::plt_entry_size)
1186         (Output_data_plt_i386::plt_eh_frame_fde_size)
1187         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1188         (Output_data_plt_i386_standard): ... here, new class.
1189         (Output_data_plt_i386_exec): New class.
1190         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1191         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1192         (Output_data_plt_i386::exec_plt_entry): Move to ...
1193         (Output_data_plt_i386_exec::plt_entry): ... here.
1194         (Output_data_plt_i386_dyn): New class.
1195         (Output_data_plt_i386::first_plt_entry): Move to ...
1196         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1197         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1198         (Output_data_plt_i386_dyn::plt_entry): ... here.
1199         (Target_i386::Target_i386): Take optional argument for the Target_info
1200         pointer to use.
1201         (Target_i386::do_make_data_plt): New virtual method.
1202         (Target_i386::make_data_plt): New method to call it.
1203         (Target_i386::make_plt_section): Use that.
1204         Call this->plt_->add_eh_frame method here.
1205         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1206         rather than plt_entry_size variable.
1207         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1208         (Output_data_plt_i386::address_for_local): Likewise.
1209         (Output_data_plt_i386::do_write): Likewise.
1210         Move guts of PLT filling to...
1211         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1212         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1213         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1214         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1215
1216 2012-05-01  Cary Coutant  <ccoutant@google.com>
1217
1218         * dwarf_reader.cc (Dwarf_die::read_attributes)
1219         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1220         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1221         * reduced_debug_output.cc
1222         (Output_reduced_debug_info_section::get_die_end): Remove
1223         DW_FORM_GNU_ref_index.  Add default case.
1224
1225 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1226
1227         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1228         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1229         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1230         DW_AT_high_pc as offset from DW_AT_low_pc.
1231
1232         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1233         * testsuite/Makefile.in: Regenerate.
1234         * testsuite/gdb_index_test_3.c: New test source file.
1235         * testsuite/gdb_index_test_3.sh: New test source file.
1236
1237 2012-04-25  Ian Lance Taylor  <iant@google.com>
1238
1239         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1240         pointer.
1241         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1242         as a class, not a struct.
1243         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1244         (Target_arm::apply_cortex_a8_workaround): Likewise.
1245         * gc.h: Declare Reloc_types as a struct, not a class.
1246         * object.h: Declare Symbols_data as a struct.
1247         * reloc.h: Declare Read_relocs_data as a struct.
1248         * target.h: Declare Relocate_info as a struct.
1249
1250 2012-04-24  David S. Miller  <davem@davemloft.net>
1251
1252         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1253         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1254         and R_SPARC_WPLT30.
1255
1256 2012-04-24  Cary Coutant  <ccoutant@google.com>
1257
1258         * incremental-dump.cc (find_input_containing_global): Replace
1259         magic number with symbolic constant.
1260         (dump_incremental_inputs): Update version number.
1261         * incremental.cc (Output_section_incremental_inputs): Update version
1262         number; import symbolic constants from Incremental_inputs_reader.
1263         (Incremental_inputs::create_data_sections): Align relocations
1264         section correctly for 64-bit targets.
1265         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1266         constants; add padding.
1267         (Output_section_incremental_inputs::write_header): Add assert for
1268         header_size.
1269         (Output_section_incremental_inputs::write_input_files): Add assert
1270         for input_entry_size.
1271         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1272         add assert for object_info_size, input_section_entry_size,
1273         global_sym_entry_size.
1274         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1275         for data structure sizes; use them.
1276         (Incremental_input_entry_reader): Import symbolic constants from
1277         Incremental_inputs_reader; use them.
1278
1279 2012-04-23  David S. Miller  <davem@davemloft.net>
1280
1281         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1282         and elf_flags_set_.
1283         (Target_sparc::Target_sparc): Initialize new fields.
1284         (Target_sparc::do_make_elf_object): New function.
1285         (Target_sparc::do_adjust_elf_header): New function.
1286
1287 2012-04-23  Cary Coutant  <ccoutant@google.com>
1288
1289         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1290         CU range table of gdb index.
1291
1292 2012-04-20  David S. Miller  <davem@davemloft.net>
1293
1294         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1295         instead of false.
1296
1297 2012-04-16  David S. Miller  <davem@davemloft.net>
1298
1299         * sparc.cc (Target_sparc::got_address): New function.
1300         (Sparc_relocate_functions::gdop_hix22): New function.
1301         (Sparc_relocate_functions::gdop_lox10): New function.
1302         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1303         relocs.
1304         (Target_sparc::Scan::local): Likewise if the global symbol is not
1305         preemptible and is not IFUNC.
1306         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1307         transformations for local and non-preemptible non-IFUNC global
1308         symbols.
1309
1310         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1311         writing out 64-bit part of ranges.
1312
1313         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1314         -fpic and -fpie respectively.
1315         * Makefile.in: Regenerate.
1316
1317         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1318         (Target_sparc::Target_sparc): Initialize new field.
1319         (Target_sparc::do_plt_section_for_global): New function.
1320         (Target_sparc::do_plt_section_for_local): New function.
1321         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1322         (Target_sparc::make_plt_section): New function, broken out of
1323         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1324         (Target_sparc::make_plt_entry): Call make_plt_section.
1325         (Target_sparc::make_local_ifunc_plt_entry): New function.
1326         (Target_sparc::rela_ifunc_section): New function.
1327         (Target_sparc::plt_section): Remove const.
1328         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1329         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1330         and ifunc_count_ fields.
1331         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1332         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1333         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1334         (Output_data_plt_sparc::rela_ifunc): New function.
1335         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1336         (Output_data_plt_sparc::has_ifunc_section): New function.
1337         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1338         (Output_data_plt_sparc::address_for_global): New function.
1339         (Output_data_plt_sparc::address_for_local): New function.
1340         (Output_data_plt_sparc::plt_index_to_offset): New function.
1341         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1342         and entry_count.
1343         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1344         entry_count.
1345         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1346         R_SPARC_JMP_IREL to switch.
1347         (Target_sparc::Scan::check_non_pic): Likewise.
1348         (Target_sparc::Scan::local): Handle IFUNC symbols.
1349         (Target_sparc::Scan::local): Likewise.
1350         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1351         and plt_address_for_local.
1352         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1353         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1354
1355         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1356         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1357         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1358         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1359         global relocs too.
1360         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1361         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1362         calls.
1363         * sparc.cc (Target_sparc::Scan::global): Likewise.
1364         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1365
1366 2012-04-16  Cary Coutant  <ccoutant@google.com>
1367
1368         * archive.cc (Library_base::should_include_member): Check for
1369         --export-dynamic-symbol.
1370         * options.h (class General_options): Add --export-dynamic-symbol.
1371         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1372         --export-dynamic-symbol.
1373         (Symbol_table::gc_mark_undef_symbols): Likewise.
1374         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1375
1376 2012-04-12  David S. Miller  <davem@davemloft.net>
1377
1378         * sparc.cc (Reloc::wdisp10): New relocation method.
1379         (Reloc::h34): Likewise.
1380         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1381         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1382         R_SPARC_WDISP10.
1383         (Target_sparc::Scan::local): Likewise.
1384         (Target_sparc::Scan::global): Likewise.
1385         (Target_sparc::Relocate::relocate): Likewise.
1386
1387 2012-04-09  Cary Coutant  <ccoutant@google.com>
1388
1389         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1390         low_pc == 0.
1391
1392 2012-04-06  Ian Lance Taylor  <iant@google.com>
1393
1394         * timer.cc: #include <unistd.h>.
1395
1396 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1397
1398         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1399         * config.in: Regenerate.
1400         * configure: Regenerate.
1401
1402 2012-04-05  Nick Clifton  <nickc@redhat.com>
1403
1404         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1405         (AM_LC_MESSAGES): Add.
1406         * aclocal.m4: Regenerate.
1407         * config.in: Regenerate.
1408         * configure: Regenerate.
1409
1410 2012-03-21  Cary Coutant  <ccoutant@google.com>
1411
1412         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1413         * Makefile.in: Regenerate.
1414         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1415         (Sized_elf_reloc_mapper::symbol_section): New function.
1416         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1417         (make_elf_reloc_mapper): New function.
1418         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1419         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1420         (Dwarf_abbrev_table::do_get_abbrev): New function.
1421         (Dwarf_ranges_table::read_ranges_table): New function.
1422         (Dwarf_ranges_table::read_range_list): New function.
1423         (Dwarf_pubnames_table::read_section): New function.
1424         (Dwarf_pubnames_table::read_header): New function.
1425         (Dwarf_pubnames_table::next_name): New function.
1426         (Dwarf_die::Dwarf_die): New function.
1427         (Dwarf_die::read_attributes): New function.
1428         (Dwarf_die::skip_attributes): New function.
1429         (Dwarf_die::set_name): New function.
1430         (Dwarf_die::set_linkage_name): New function.
1431         (Dwarf_die::attribute): New function.
1432         (Dwarf_die::string_attribute): New function.
1433         (Dwarf_die::int_attribute): New function.
1434         (Dwarf_die::uint_attribute): New function.
1435         (Dwarf_die::ref_attribute): New function.
1436         (Dwarf_die::child_offset): New function.
1437         (Dwarf_die::sibling_offset): New function.
1438         (Dwarf_info_reader::check_buffer): New function.
1439         (Dwarf_info_reader::parse): New function.
1440         (Dwarf_info_reader::do_parse): New function.
1441         (Dwarf_info_reader::do_read_string_table): New function.
1442         (Dwarf_info_reader::lookup_reloc): New function.
1443         (Dwarf_info_reader::get_string): New function.
1444         (Dwarf_info_reader::visit_compilation_unit): New function.
1445         (Dwarf_info_reader::visit_type_unit): New function.
1446         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1447         Sized_elf_reloc_mapper.
1448         (Sized_dwarf_line_info::symbol_section): Remove function.
1449         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1450         (Sized_dwarf_line_info::read_line_mappings): Remove object
1451         parameter, adjust callers.
1452         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1453         * dwarf_reader.h: Include <sys/types.h>.
1454         (class Track_relocs): Remove forward declaration.
1455         (class Elf_reloc_mapper): New class.
1456         (class Sized_elf_reloc_mapper): New class.
1457         (class Dwarf_abbrev_table): New class.
1458         (class Dwarf_range_list): New class.
1459         (class Dwarf_ranges_table): New class.
1460         (class Dwarf_pubnames_table): New class.
1461         (class Dwarf_die): New class.
1462         (class Dwarf_info_reader): New class.
1463         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1464         (Sized_dwarf_line_info::symbol_section): Remove member function.
1465         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1466         base class.
1467         * gdb-index.cc: New source file.
1468         * gdb-index.h: New source file.
1469         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1470         and .debug_types sections, call Layout::add_to_gdb_index.
1471         (Sized_relobj_incr::do_section_name): Implement.
1472         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1473         return type; Implement.
1474         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1475         return type.
1476         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1477         parameter list and return type.
1478         (Sized_incr_dynobj::do_section_contents): Likewise.
1479         * layout.cc: Include gdb-index.h.
1480         (Layout::Layout): Initialize gdb_index_data_.
1481         (Layout::init_fixed_output_section): Check for .gdb_index section.
1482         (Layout::add_to_gdb_index): New function. Instantiate.
1483         * layout.h: Add forward declaration for class Gdb_index.
1484         (Layout::add_to_gdb_index): New member function.
1485         (Layout::gdb_index_data_): New data member.
1486         * main.cc: Include gdb-index.h.
1487         (main): Print statistics for gdb index.
1488         * object.cc (Object::section_contents): Move code into
1489         do_section_contents.
1490         (need_decompressed_section): Check for sections needed when building
1491         gdb index.
1492         (build_compressed_section_map): Likewise.
1493         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1494         gdb index.
1495         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1496         sections; call Layout::add_to_gdb_index.
1497         (Sized_relobj_file::do_decompressed_section_contents): Call
1498         do_section_contents directly.
1499         * object.h (Object::do_section_contents): Adjust parameter list and
1500         return type.
1501         (Object::do_decompressed_section_contents): Call do_section_contents
1502         directly.
1503         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1504         return type.
1505         * options.h (class General_options): Add --gdb-index option.
1506         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1507         list and return type.
1508         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1509         * reloc.h (Track_relocs::checkpoint): New function.
1510         (Track_relocs::reset): New function.
1511
1512         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1513         New test cases.
1514         * testsuite/Makefile.in: Regenerate.
1515         * testsuite/gdb_index_test.cc: New test source file.
1516         * testsuite/gdb_index_test_1.sh: New test source file.
1517         * testsuite/gdb_index_test_2.sh: New test source file.
1518
1519 2012-03-19  Doug Kwan  <dougkwan@google.com>
1520
1521         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1522         (Target_arm::do_finalize_sections): Remove code which defines
1523         __exidx_start and __exidx_end.  Make symbol table parameter
1524         anonymous as it is not used.
1525         * gold.cc (queue_middle_tasks): Call target hook to define any
1526         target-specific symbols.
1527         * target.h (Target::define_standard_symbols): New method.
1528         (Target::do_define_standard_symbols): Same.
1529         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1530         * testsuite/Makefile.in: Regenerate.
1531         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1532         and __exidx_end.
1533         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1534         relocations are generated for __exidx_start and __exidx_end.
1535
1536 2012-03-16  Doug Kwan  <dougkwan@google.com>
1537
1538         * testsuite/Makefile.am: Disable test initpri3b.
1539         * testsuite/Makefile.in: Regenerate.
1540
1541 2012-03-15  Doug Kwan  <dougkwan@google.com>
1542
1543         * arm.cc (Target_arm::got_section): Make .got section read-only
1544         if -z now is given.
1545
1546 2012-03-15  Ian Lance Taylor  <iant@google.com>
1547
1548         PR gold/13850
1549         * layout.cc (Layout::make_output_section): Correctly mark
1550         SHT_INIT_ARRAY, et. al., as relro.
1551
1552 2012-03-14  Doug Kwan  <dougkwan@google.com>
1553
1554         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1555         dynamic relocations for protected symbols in shared objects.
1556
1557 2012-03-13  Ian Lance Taylor  <iant@google.com>
1558
1559         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1560         keep the larger alignment.
1561
1562 2012-03-12  Cary Coutant  <ccoutant@google.com>
1563
1564         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1565         handling of DW_LNE_define_file.
1566
1567 2012-03-12  Cary Coutant  <ccoutant@google.com>
1568
1569         * reduced_debug_output.cc
1570         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1571         codes to switch.
1572
1573 2012-02-29  Cary Coutant  <ccoutant@google.com>
1574
1575         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1576
1577 2012-02-29  Cary Coutant  <ccoutant@google.com>
1578
1579         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1580         Call Object::decompressed_section_contents.
1581         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1582         New dtor.
1583         (Sized_dwarf_line_info::buffer_start_): New data member.
1584         * merge.cc (Output_merge_data::do_add_input_section): Call
1585         Object::decompressed_section_contents.
1586         (Output_merge_string::do_add_input_section): Likewise.
1587         * object.cc (need_decompressed_section): New function.
1588         (build_compressed_section_map): Decompress sections needed later.
1589         (Sized_relobj_file::do_decompressed_section_contents): New function.
1590         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1591         * object.h (Object::decompressed_section_contents): New function.
1592         (Object::discard_decompressed_sections): New function.
1593         (Object::do_decompressed_section_contents): New function.
1594         (Object::do_discard_decompressed_sections): New function.
1595         (Compressed_section_info): New type.
1596         (Compressed_section_map): Include decompressed section contents.
1597         (Sized_relobj_file::do_decompressed_section_contents): New function.
1598         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1599
1600 2012-02-16  Cary Coutant  <ccoutant@google.com>
1601
1602         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1603         * testsuite/Makefile.in: Regenerate.
1604
1605 2012-02-14  Cary Coutant  <ccoutant@google.com>
1606
1607         * options.cc (General_options::finalize): Disallow -pie and -static.
1608
1609 2012-02-03  Doug Kwan  <dougkwan@google.com>
1610
1611         * arm.cc (Arm_relocate_functions::abs8,
1612         Arm_relocate_functions::abs16): Use
1613         Bits::has_signed_unsigned_overflow32.
1614         (Arm_relocate_functions::thm_abs8): Correct range of
1615         overflow check.
1616         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1617         in assertions.
1618
1619 2012-02-02  Doug Kwan  <dougkwan@google.com>
1620
1621         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1622         position independent outputs, not just shared objects.
1623
1624 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1625
1626         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1627         * configure: Regenerated.
1628
1629 2012-01-27  Ian Lance Taylor  <iant@google.com>
1630
1631         * reloc.h (Bits): New class with static functions, copied from
1632         namespace utils in arm.cc.
1633         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1634         instead.
1635
1636 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1637
1638         * incremental.cc (write_info_blocks): Correct relocation offset.
1639
1640 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1641
1642         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1643         (Relocate::tls_gd_to_le): Likewise.
1644
1645 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1646
1647         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1648
1649 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1650
1651         * configure.ac: Check if -mcmodel=medium works.
1652         * configure: Regenerated.
1653
1654 2012-01-24  Cary Coutant  <ccoutant@google.com>
1655
1656         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1657         definition and ...
1658         (read_unsigned_LEB_128_x): ... this new function.
1659         (read_signed_LEB_128): Replaced with inline definition and ...
1660         (read_signed_LEB_128_x): ... this new function.
1661         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1662         (read_unsigned_LEB_128): Add inline definition.
1663         (read_signed_LEB_128_x): New function.
1664         (read_signed_LEB_128): Add inline definition.
1665         * testsuite/Makefile.am (leb128_unittest): New unit test.
1666         * testsuite/Makefile.in: Regenerate.
1667         * testsuite/leb128_unittest.cc: New unit test.
1668
1669 2012-01-23  Ian Lance Taylor  <iant@google.com>
1670
1671         PR gold/13617
1672         * i386.cc (Target_i386::do_code_fill): When using a jmp
1673         instruction, pad with nop instructions.
1674         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1675
1676 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1677
1678         * x86_64.cc (gc_process_relocs): Add typename on types used in
1679         template.
1680         (scan_relocs): Likewise.
1681         (relocate_section): Likewise.
1682         (apply_relocation): Likewise.
1683
1684 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1685
1686         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1687         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1688         under x32.
1689
1690 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1691
1692         * x86_64.cc: Initial support for x32.
1693
1694 2012-01-03  Cary Coutant  <ccoutant@google.com>
1695
1696         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1697         Use abstract base class for GOT.
1698         * gold/output.h (class Output_data_got_base): New abstract base class.
1699         (class Output_data_got): Derive from new base class, adjust ctors.
1700         (Output_data_got::reserve_slot): Make virtual; rename to
1701         do_reserve_slot; Adjust callers.
1702         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1703         pointer to abstract base class.
1704         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1705
1706 2011-12-18  Ian Lance Taylor  <iant@google.com>
1707
1708         * object.h (Relobj::local_symbol_value): New function.
1709         (Relobj::local_plt_offset): New function.
1710         (Relobj::local_has_got_offset): New function.
1711         (Relobj::local_got_offset): New function.
1712         (Relobj::set_local_got_offset): New function.
1713         (Relobj::do_local_symbol_value): New pure virtual function.
1714         (Relobj::do_local_plt_offset): Likewise.
1715         (Relobj::do_local_has_got_offset): Likewise.
1716         (Relobj::do_local_got_offset): Likewise.
1717         (Relobj::do_set_local_got_offset): Likewise.
1718         (Sized_relobj::do_local_has_got_offset): Rename from
1719         local_has_got_offset.
1720         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1721         (Sized_relobj::do_set_local_got_offset): Rename from
1722         set_local_got_offset.
1723         (Sized_relobj_file::do_local_plt_offset): Rename from
1724         local_plt_offset.
1725         (Sized_relobj_file::do_local_symbol_value): New function.
1726         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1727         local_plt_offset.
1728         * output.cc (Output_data_got::Got_entry::write): Change object to
1729         Relobj.  Use local_symbol_value.
1730         (Output_data_got::add_global_with_rel): Change rel_dyn to
1731         Output_data_reloc_generic*.  Use add_global_generic.
1732         (Output_data_got::add_global_with_rela): Remove.  Change all
1733         callers to use add_global_with_rel.
1734         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1735         Output_data_reloc_generic*.  Use add_global_generic.
1736         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1737         callers to use add_global_pair_with_rel.
1738         (Output_data_got::add_local): Change object to Relobj*.
1739         (Output_data_got::add_local_plt): Likewise.
1740         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1741         change rel_dyn to Output_data_reloc_generic*.  Use
1742         add_local_generic.
1743         (Output_data_got::add_local_with_rela): Remove.  Change all
1744         callers to use all_local_with_rel.
1745         (Output_data_got::add_local_pair_with_rel): Change object to
1746         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1747         add_output_section_generic.
1748         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1749         callers to use add_local_pair_with_rel.
1750         (Output_data_got::reserve_local): Change object to Relobj*.
1751         * output.h: (class Output_data_reloc_generic): Add pure virtual
1752         declarations for add_global_generic, add_local_generic,
1753         add_output_section_generic.
1754         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1755         functions for Output_data_reloc_generic.  Update declarations for
1756         changes listed in output.cc.
1757         (class Output_data_got): Change template parameter to got_size.
1758         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1759         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1760         function.
1761         (Sized_relobj_incr::do_local_plt_offset): New function.
1762         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1763         add_global_generic.
1764
1765 2011-12-17  Cary Coutant  <ccoutant@google.com>
1766
1767         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1768         * resolve.cc (Symbol_table::resolve): Likewise.
1769         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1770         arrays.
1771         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1772
1773 2011-12-16  Ian Lance Taylor  <iant@google.com>
1774
1775         * output.h (Output_data_reloc_generic::add): Only call
1776         add_dynamic_reloc if this is a dynamic reloc section.
1777
1778 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1779
1780         PR gold/13505
1781         * target-reloc.h (apply_relocation): Replace <64, false> with
1782         <size, big_endian>.
1783
1784 2011-11-25  Nick Clifton  <nickc@redhat.com>
1785
1786         * po/it.po: New Italian translation.
1787
1788 2011-11-17  Sterling Augustine  <saugustine@google.com>
1789
1790         * script.cc (script_include_directive): Implement.
1791         (read_script_file): New local variables name and search_path. Update
1792         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1793         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1794         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1795
1796 2011-11-11  Sterling Augustine  <saugustine@google.com>
1797
1798         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1799         (file_or_sections_cmd): Likewise.
1800
1801 2011-11-11  Doug Kwan  <dougkwan@google.com>
1802
1803         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1804         if --just-symbols is given.
1805
1806 2011-11-10  Doug Kwan  <dougkwan@google.com>
1807
1808         PR gold/13362
1809         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1810         when processing data relocs.
1811         * reloc.h (Relocate_functions::rel_unaligned): New method.
1812         (Relocate_functions::pcrel_unaligned): Ditto.
1813         (Relocate_functions::rel32_unaligned): Ditto.
1814         (Relocate_functions::pcrel32_unaligned): Ditto.
1815
1816 2011-11-09  Doug Kwan  <dougkwan@google.com>
1817
1818         PR gold/13362
1819         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1820         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1821         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1822         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1823         (Relocate_functions::rel_unaligned): New.
1824         (Relocate_functions::rel32_unaligned): New.
1825         * target-reloc.h (relocate_for_relocatable): Add code to handle
1826         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1827         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1828         arm_unaligned_reloc_r): New targets.
1829         * testsuite/Makefile.in: Regenerate.
1830         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1831         linking.
1832
1833 2011-11-02  Ian Lance Taylor  <iant@google.com>
1834
1835         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1836         NATIVE_LINKER.
1837         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1838         * options.cc (General_options::finalize): Use library search path
1839         from configure script if specified.  If not native and no sysroot,
1840         only search TOOLLIBDIR.
1841         * options.h (Search_directory::Search_directory): Change name to
1842         const std::string&.
1843         (General_options::add_to_library_path_with_sysroot): Change arg to
1844         const std::string&.
1845         * configure, Makefile.in, config.in: Rebuild.
1846
1847 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1848
1849         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1850         we are working around the ARM1176 Erratum.
1851         * options.h (General_options::fix_arm1176): Add option.
1852         * testsuite/Makefile.am: Add testcases, and keep current ones
1853         working.
1854         * testsuite/Makefile.in: Regenerate.
1855         * testsuite/arm_fix_1176.s: New file.
1856         * testsuite/arm_fix_1176.sh: Likewise.
1857
1858 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1859
1860         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1861         may_use_blx_.
1862         (Target_arm::may_use_blx): Remove method.
1863         (Target_arm::set_may_use_blx): Likewise.
1864         (Target_arm::may_use_v4t_interworking): New method.
1865         (Target_arm::may_use_v5t_interworking): Likewise.
1866         (Target_arm::may_use_blx_): Remove member variable.
1867         (Arm_relocate_functions::arm_branch_common): Check for v5T
1868         interworking.
1869         (Arm_relocate_functions::thumb_branch_common): Likewise.
1870         (Reloc_stub::stub_type_for_reloc): Likewise.
1871         (Target_arm::do_finalize_sections): Correct interworking checks.
1872         * testsuite/Makefile.am: Add new tests.
1873         * testsuite/Makefile.in: Regenerate.
1874         * testsuite/arm_farcall_arm_arm.s: New test.
1875         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1876         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1877         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1878         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1879         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1880         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1881         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1882
1883 2011-10-31  Cary Coutant  <ccoutant@google.com>
1884
1885         PR gold/13023
1886         * expression.cc (Expression::eval_with_dot): Add
1887         is_section_dot_assignment parameter.
1888         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1889         absolute and assigning to dot within a section.
1890         * script-sections.cc
1891         (Output_section_element_assignment::set_section_addresses): Pass
1892         dot_section to set_if_absolute.
1893         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1894         as is_section_dot_assignment flag to eval_with_dot.
1895         (Output_section_element_dot_assignment::set_section_addresses):
1896         Likewise.
1897         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1898         parameter.  Also set value if relative to dot_section; set the
1899         symbol's output_section.
1900         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1901         parameter.  Adjust all callers.
1902         (Expression::eval_maybe_dot): Likewise.
1903         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1904         Adjust all callers.
1905         * testsuite/script_test_2.t: Test assignment of an absolute value
1906         to dot within an output section element.
1907
1908 2011-10-31  Cary Coutant  <ccoutant@google.com>
1909
1910         * options.h (class General_options): Add --[no-]gnu-unique options.
1911         * symtab.cc (Symbol_table::sized_write_globals): Convert
1912         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1913
1914 2011-10-31  Cary Coutant  <ccoutant@google.com>
1915
1916         PR gold/13359
1917         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1918         unnecessary assertion.
1919         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1920
1921 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1922
1923         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1924         gc_mark_symbol.
1925         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1926         gc_mark_symbol.
1927         Change to just keep the section associated with symbol.
1928         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1929         they are externally visible and --export-dynamic is turned on.
1930         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1931
1932 2011-10-19  Ian Lance Taylor  <iant@google.com>
1933
1934         PR gold/13163
1935         * script-sections.cc
1936         (Output_section_element_dot_assignment::needs_output_section): New
1937         function.
1938
1939 2011-10-19  Ian Lance Taylor  <iant@google.com>
1940
1941         PR gold/13204
1942         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1943         --section-start option was seen.
1944         * options.h (General_options::any_section_start): New function.
1945
1946 2011-10-18  David S. Miller  <davem@davemloft.net>
1947
1948         PR binutils/13301
1949         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1950         member to track relocation locations that have moved during TLS
1951         reloc optimizations.
1952         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1953         (Target_sparc::Relocate::relocate): Adjust view down by 4
1954         bytes if it matches reloc_adjust_addr_.
1955         (Target_sparc::Relocate::relocate_tls): Always move the
1956         __tls_get_addr call delay slot instruction forward 4 bytes when
1957         performing relaxation.
1958
1959 2011-10-18  Cary Coutant  <ccoutant@google.com>
1960
1961         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1962         (Output_file::map_no_anonymous): Check for non-zero
1963         return code from posix_fallocate.
1964
1965 2011-10-17  Cary Coutant  <ccoutant@google.com>
1966
1967         PR gold/13245
1968         * plugin.cc (is_visible_from_outside): Check for symbols
1969         referenced from dynamic objects.
1970         * resolve.cc (Symbol_table::resolve): Don't count references
1971         from dynamic objects as references from real ELF files.
1972         * testsuite/plugin_test_2.sh: Adjust expected result.
1973
1974 2011-10-17  Cary Coutant  <ccoutant@google.com>
1975
1976         * gold.cc: Include timer.h.
1977         (queue_middle_tasks): Stamp time.
1978         (queue_final_tasks): Likewise.
1979         * main.cc (main): Store timer in parameters.  Print timers
1980         for each pass.
1981         * parameters.cc (Parameters::Parameters): Initialize timer_.
1982         (Parameters::set_timer): New function.
1983         (set_parameters_timer): New function.
1984         * parameters.h (Parameters::set_timer): New function.
1985         (Parameters::timer): New function.
1986         (Parameters::timer_): New data member.
1987         (set_parameters_timer): New function.
1988         * timer.cc (Timer::stamp): New function.
1989         (Timer::get_pass_time): New function.
1990         * timer.h (Timer::stamp): New function.
1991         (Timer::get_pass_time): New function.
1992         (Timer::pass_times_): New data member.
1993
1994 2011-10-17  Cary Coutant  <ccoutant@google.com>
1995
1996         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1997         task for members of lib groups.
1998
1999 2011-10-17  Cary Coutant  <ccoutant@google.com>
2000
2001         PR gold/13288
2002         * fileread.cc (File_read::find_view): Add assert.
2003         (File_read::make_view): Move bounds check (replace with assert)...
2004         (File_read::find_or_make_view): ... to here.
2005
2006 2011-10-12  Cary Coutant  <ccoutant@google.com>
2007
2008         * output.cc (Output_file::open_base_file): Handle case where
2009         ::read returns less than requested size.
2010
2011 2011-10-10  Cary Coutant  <ccoutant@google.com>
2012
2013         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2014         Initialize defined_count_.
2015         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2016         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2017         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2018         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2019         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2020         * incremental.h (Sized_relobj_incr::defined_count_): New data
2021         member.
2022         (Sized_incr_dynobj::defined_count_): New data member.
2023         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2024         Return zeroes instead of internal error.
2025
2026 2011-10-10  Cary Coutant  <ccoutant@google.com>
2027
2028         PR gold/13249
2029         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2030         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2031         * output.h (class Output_reloc): Add use_plt_offset flag.
2032         (Output_reloc::type_): Adjust size of bit field.
2033         (Output_reloc::use_plt_offset_): New bit field.
2034         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2035         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2036         flag.  Adjust all callers.
2037         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2038         creating RELATIVE relocations.
2039
2040 2011-10-10  Nick Clifton  <nickc@redhat.com>
2041
2042         * po/es.po: Updated Spanish translation.
2043         * po/fi.po: Updated Finnish translation.
2044
2045 2011-10-03   Diego Novillo  <dnovillo@google.com>
2046
2047         * options.cc (parse_uint): Fix dereference of RETVAL.
2048
2049 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2050
2051         * layout.h (section_order_map_): New member.
2052         (get_section_order_map): New member function.
2053         * output.cc (Output_section::add_input_section): Check for patterns
2054         only when --section-ordering-file is specified.
2055         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2056         output_sections have been formed.
2057         * layout.cc (Layout_Layout): Initialize section_order_map_.
2058         * plugin.cc (update_section_order): Store order in order_map. Do not
2059         update the order.
2060         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2061         * testsuite/Makefile.in: Regenerate.
2062         * testsuite/plugin_section_order.c: New file.
2063         * testsuite/plugin_final_layout.cc: New file.
2064         * testsuite/plugin_final_layout.sh: New file.
2065
2066 2011-09-29  Cary Coutant  <ccoutant@google.com>
2067
2068         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2069         Check for NULL.
2070         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2071         symbols during incremental update.
2072         (Symbol_table::add_from_dynobj): Likewise.
2073
2074 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2075             Ian Lance Taylor  <iant@google.com>
2076
2077         * symtab.cc (Symbol_table::define_special_symbol): Always
2078         canonicalize version string.
2079
2080 2011-09-26  Cary Coutant  <ccoutant@google.com>
2081
2082         * gold.cc (queue_initial_tasks): Move option checks ...
2083         * options.cc (General_options::finalize): ... to here. Disable
2084         some options; make others fatal.
2085
2086 2011-09-26  Cary Coutant  <ccoutant@google.com>
2087
2088         gcc PR lto/47247
2089         * plugin.cc (get_symbols_v2): New function.
2090         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2091         (is_referenced_from_outside): New function.
2092         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2093         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2094         (get_symbols): Pass version parameter.
2095         (get_symbols_v2): New function.
2096         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2097         parameter.
2098         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2099         (onload): Add LDPT_GET_SYMBOLS_V2.
2100         (all_symbols_read_hook): Use get_symbols_v2; check for
2101         LDPR_PREVAILING_DEF_IRONLY_EXP.
2102         * testsuite/plugin_test_3.sh: Update expected results.
2103
2104 2011-09-23  Simon Baldwin  <simonb@google.com>
2105
2106         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2107         configuration options.
2108         * configure: Regenerate.
2109         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2110         * Makefile.in: Regenerate.
2111         * testsuite/Makefile.in: Regenerate.
2112
2113 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2114
2115         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2116
2117 2011-09-19  Cary Coutant  <ccoutant@google.com>
2118
2119         * incremental.cc (can_incremental_update): Fix typo in comment.
2120         * incremental.h (can_incremental_update): Likewise.
2121
2122 2011-09-18  Cary Coutant  <ccoutant@google.com>
2123
2124         * incremental.cc (can_incremental_update): New function.
2125         * incremental.h (can_incremental_update): New function.
2126         * layout.cc (Layout::init_fixed_output_section): Call it.
2127         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2128         * object.cc (Sized_relobj_file::do_layout): Call
2129         can_incremental_update.
2130
2131 2011-09-13  Cary Coutant  <ccoutant@google.com>
2132
2133         * configure.ac: Check for glibc support for gnu_indirect_function
2134         support with static linking, setting automake conditional
2135         IFUNC_STATIC.
2136         * Makefile.in: Regenerate.
2137         * configure: Regenerate.
2138
2139         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2140         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2141         for IFUNC_STATIC.
2142         * testsuite/Makefile.in: Regenerate.
2143
2144 2011-09-13  Cary Coutant  <ccoutant@google.com>
2145
2146         * incremental.cc (Sized_relobj_incr::do_layout): Call
2147         report_comdat_group for kept comdat sections.
2148         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2149         * testsuite/Makefile.in: Regenerate.
2150         * testsuite/incr_comdat_test_1.cc: New source file.
2151         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2152         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2153         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2154
2155 2011-09-13  Ian Lance Taylor  <iant@google.com>
2156
2157         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2158         variable external_symbols_offset.
2159
2160 2011-09-12  Ian Lance Taylor  <iant@google.com>
2161
2162         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2163         triggered if object has no symbols.
2164
2165 2011-09-09  David S. Miller  <davem@davemloft.net>
2166
2167         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2168         (Output_fill_debug_line::do_write): Likewise.
2169
2170 2011-08-29  Cary Coutant  <ccoutant@google.com>
2171
2172         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2173         casts to match formatting specs.
2174         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2175
2176 2011-08-26  Cary Coutant  <ccoutant@google.com>
2177
2178         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2179         remaining hole size when allocating.
2180         (Layout::make_output_section): Set fill methods for debug sections.
2181         * layout.h (Free_list::Free_list_node): Move from private to
2182         public.
2183         (Free_list::set_min_hole_size): New function.
2184         (Free_list::begin, Free_list::end): New functions.
2185         (Free_list::min_hole_): New data member.
2186         * output.cc: Include dwarf.h.
2187         (Output_fill_debug_info::do_minimum_hole_size): New function.
2188         (Output_fill_debug_info::do_write): New function.
2189         (Output_fill_debug_line::do_minimum_hole_size): New function.
2190         (Output_fill_debug_line::do_write): New function.
2191         (Output_section::Output_section): Initialize new data member.
2192         (Output_section::set_final_data_size): Ensure patch space is larger
2193         than minimum hole size.
2194         (Output_section::do_write): Fill holes in debug sections.
2195         * output.h (Output_fill): New class.
2196         (Output_fill_debug_info): New class.
2197         (Output_fill_debug_line): New class.
2198         (Output_section::set_free_space_fill): New function.
2199         (Output_section::free_space_fill_): New data member.
2200         * testsuite/Makefile.am (incremental_test_3): Add
2201         --incremental-patch option.
2202         (incremental_test_4): Likewise.
2203         (incremental_test_5): Likewise.
2204         (incremental_test_6): Likewise.
2205         (incremental_copy_test): Likewise.
2206         (incremental_common_test_1): Likewise.
2207         * testsuite/Makefile.in: Regenerate.
2208
2209 2011-08-26  Nick Clifton  <nickc@redhat.com>
2210
2211         * po/es.po: Updated Spanish translation.
2212
2213 2011-08-01  Cary Coutant  <ccoutant@google.com>
2214
2215         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2216         * gold/testsuite/Makefile.in: Regenerate.
2217         * gold/testsuite/justsyms_exec.c: New source file.
2218         * gold/testsuite/justsyms_lib.c: New source file.
2219
2220 2011-08-01  Cary Coutant  <ccoutant@google.com>
2221
2222         * layout.cc (Layout::set_segment_offsets): Don't realign text
2223         segment if -Ttext was specified.
2224         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2225         file type.
2226         * object.h (Sized_relobj_file::e_type): New function.
2227         (Sized_relobj_file::e_type_): New data member.
2228         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2229         base address for ET_EXEC files.
2230         * target.cc (Target::do_make_elf_object_implementation): Allow
2231         ET_EXEC files with --just-symbols option.
2232
2233 2011-07-28  Cary Coutant  <ccoutant@google.com>
2234
2235         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2236         Add thread_number parameter.
2237         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2238         * workqueue-threads.cc
2239         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2240         current thread if its thread number is greater than desired thread
2241         count.
2242         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2243         Add thread_number parameter.
2244         (Workqueue::should_cancel_thread): Likewise.
2245         (Workqueue::find_runnable_or_wait): Pass thread_number to
2246         should_cancel_thread.
2247         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2248         parameter.
2249
2250 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2251
2252         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2253         only after checking if it cannot be forced local.
2254         * symtab.h (is_externally_visible): Check if the symbol is not forced
2255         local.
2256
2257 2011-07-15  Ian Lance Taylor  <iant@google.com>
2258
2259         * options.h (class General_options): Add --print-output-format.
2260         Move -EL next to -EB, for  better --help output.
2261         * target-select.cc: Include <cstdio>, "options.h", and
2262         "parameters.h".
2263         (Target_selector::do_target_bfd_name): New function.
2264         (print_output_format): New function.
2265         * target-select.h (class Target_selector): Update declarations.
2266         (Target_selector::target_bfd_name): New function.
2267         (print_output_format): Declare.
2268         * main.cc: Include "target-select.h".
2269         (main): Handle --print-output-format.
2270         * gold.cc: Include "target-select.h".
2271         (queue_initial_tasks): Handle --print-output-format when there are
2272         no input files.
2273         * parameters.cc (parameters_force_valid_target): Give a better
2274         error message if -EB/-EL does not match target.
2275         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2276         function.
2277
2278 2011-07-15  Ian Lance Taylor  <iant@google.com>
2279
2280         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2281         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2282         (Output_data_plt_i386::do_write): Write address of .dynamic
2283         section to first entry in .got.plt section.
2284         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2285         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2286         Initialize layout_.
2287         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2288         section to first entry in .got.plt section.
2289         * layout.h (Layout::dynamic_section): New function.
2290
2291 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2292
2293         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2294         to claim_file call.
2295         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2296         input_section_position_, and input_section_glob_.
2297         (read_layout_from_file): Call function section_ordering_specified.
2298         * layout.h (is_section_ordering_specified): New function.
2299         (section_ordering_specified): New function.
2300         (section_ordering_specified_): New boolean member.
2301         * main.cc(main): Call load_plugins after layout object is defined.
2302         * output.cc (Output_section::add_input_section): Use
2303         function section_ordering_specified to check if section ordering is
2304         needed.
2305         * output.cc (Output_section::add_relaxed_input_section): Use
2306         function section_ordering_specified to check if section ordering is
2307         needed.
2308         (Output_section::update_section_layout): New function.
2309         (Output_section::sort_attached_input_sections): Check if input section
2310         must be reordered.
2311         * output.h (Output_section::update_section_layout): New function.
2312         * plugin.cc (get_section_count): New function.
2313         (get_section_type): New function.
2314         (get_section_name): New function.
2315         (get_section_contents): New function.
2316         (update_section_order): New function.
2317         (allow_section_ordering): New function.
2318         (Plugin::load): Add the new interfaces to the transfer vector.
2319         (Plugin_manager::load_plugins): New parameter.
2320         (Plugin_manager::all_symbols_read): New parameter.
2321         (Plugin_manager::claim_file): New parameter. Save the elf object for
2322         unclaimed objects.
2323         (Plugin_manager::get_elf_object): New function.
2324         (Plugin_manager::get_view): Change to directly use the bool to check
2325         if get_view is called from claim_file_hook.
2326         * plugin.h (input_objects): New function
2327         (Plugin__manager::load_plugins): New parameter.
2328         (Plugin_manager::claim_file): New parameter.
2329         (Plugin_manager::get_elf_object): New function.
2330         (Plugin_manager::in_claim_file_handler): New function.
2331         (Plugin_manager::in_claim_file_handler_): New member.
2332         (layout): New function.
2333         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2334         handler with an extra parameter. Make the elf object before calling
2335         claim_file handler.
2336         * testsuite/plugin_test.c (get_section_count): New function pointer.
2337         (get_section_type): New function pointer.
2338         (get_section_name): New function pointer.
2339         (get_section_contents): New function pointer.
2340         (update_section_order): New function pointer.
2341         (allow_section_ordering): New function pointer.
2342         (onload): Check if the new interfaces exist.
2343
2344 2011-07-13  Ian Lance Taylor  <iant@google.com>
2345
2346         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2347         relro section.
2348         * x86_64.cc (Target_x86_64::got_section): Likewise.
2349         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2350         (relro_now_test_SOURCES): New variable.
2351         (relro_now_test_DEPENDENCIES): New variable.
2352         (relro_now_test_LDFLAGS): New variable.
2353         (relro_now_test_LDADD): New variable.
2354         (relro_now_test.so): New target.
2355         * testsuite/Makefile.in: Rebuild.
2356
2357 2011-07-12  Ian Lance Taylor  <iant@google.com>
2358
2359         PR gold/12980
2360         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2361         GLOB_DAT relocation rather than a RELATIVE relocation for a
2362         protected symbol when creating a shared library.
2363         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2364         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2365         * testsuite/protected_main_1.cc (main): Test that protected
2366         function has same address.
2367
2368 2011-07-11  Ian Lance Taylor  <iant@google.com>
2369
2370         PR gold/12979
2371         * options.h (class General_options): Add -Bgroup.
2372         * options.cc (General_options::finalize): If -Bgroup is set,
2373         default to --unresolved-symbols=report-all.
2374         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2375         * target-reloc.h (issue_undefined_symbol_error): Handle
2376         --unresolved-symbols=report-all.
2377
2378 2011-07-08  Ian Lance Taylor  <iant@google.com>
2379
2380         PR gold/11985
2381         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2382         if linker script discards key sections.
2383         (Layout::create_dynamic_symtab): Likewise.
2384         (Layout::assign_local_dynsym_offsets): Likewise.
2385         (Layout::sized_create_version_sections): Likewise.
2386         (Layout::create_interp): Likewise.
2387         (Layout::finish_dynamic_section): Likewise.
2388         (Layout::set_dynamic_symbol_size): Likewise.
2389
2390 2011-07-08  Ian Lance Taylor  <iant@google.com>
2391
2392         PR gold/12386
2393         * options.h (class General_options): Add --unresolved-symbols.
2394         * target-reloc.h (issue_undefined_symbol_error): Check
2395         --unresolved-symbols.  Add comments.
2396
2397 2011-07-08  Ian Lance Taylor  <iant@google.com>
2398
2399         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2400         expression more complex.
2401
2402 2011-07-08  Ian Lance Taylor  <iant@google.com>
2403
2404         PR gold/11317
2405         * target-reloc.h (issue_undefined_symbol_error): New inline
2406         function, broken out of relocate_section.
2407         (relocate_section): Call issue_undefined_symbol_error.
2408         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2409         there is no TLS segment if we are about to issue an undefined
2410         symbol error.
2411         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2412
2413 2011-07-08  Ian Lance Taylor  <iant@google.com>
2414
2415         PR gold/12279
2416         * resolve.cc (Symbol_table::should_override): Add fromtype
2417         parameter.  Change all callers.  Give error when linking together
2418         TLS and non-TLS symbol.
2419         (Symbol_table::should_override_with_special): Add fromtype
2420         parameter.  Change all callers.
2421         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2422         there is no TLS segment if we have reported some errors.
2423         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2424
2425 2011-07-08  Ian Lance Taylor  <iant@google.com>
2426
2427         PR gold/12372
2428         * target.h (Target::plt_address_for_global): New function.
2429         (Target::plt_address_for_local): New function.
2430         (Target::plt_section_for_global): Remove.
2431         (Target::plt_section_for_local): Remove.
2432         (Target::do_plt_address_for_global): New virtual function.
2433         (Target::do_plt_address_for_local): New virtual function.
2434         (Target::do_plt_section_for_global): Remove.
2435         (Target::do_plt_section_for_local): Remove.
2436         (Target::register_global_plt_entry): Add Symbol_table and Layout
2437         parameters.
2438         * output.cc (Output_data_got::Got_entry::write): Use
2439         plt_address_for_global and plt_address_for_local.
2440         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2441         address of output section.
2442         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2443         got_irelative_, and irelative_count_ fields.  Update
2444         declarations.
2445         (Output_data_plt_i386::has_irelative_section): New function.
2446         (Output_data_plt_i386::entry_count): Add irelative_count_.
2447         (Output_data_plt_i386::set_final_data_size): Likewise.
2448         (class Target_i386): Add got_irelative_ and rel_irelative_
2449         fields.  Update declarations.
2450         (Target_i386::Target_i386): Initialize new fields.
2451         (Target_i386::do_plt_address_for_global): New function replacing
2452         do_plt_section_for_global.
2453         (Target_i386::do_plt_address_for_local): New function replacing
2454         do_plt_section_for_local.
2455         (Target_i386::got_section): Create got_irelative_.
2456         (Target_i386::rel_irelative_section): New function.
2457         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2458         fields.  Don't define __rel_iplt_{start,end}.
2459         (Output_data_plt_i386::add_entry): Add symtab and layout
2460         parameters.  Change all callers.  Use different PLT and GOT for
2461         IFUNC symbols.
2462         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2463         layout parameters.  Change all callers.  Use different PLT and
2464         GOT.
2465         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2466         (Output_data_plt_i386::rel_irelative): New function.
2467         (Output_data_plt_i386::address_for_global): New function.
2468         (Output_data_plt_i386::address_for_local): New function.
2469         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2470         IRELATIVE GOT when changing IFUNC GOT entries.
2471         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2472         reloc.
2473         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2474         if we didn't create an IRELATIVE GOT.
2475         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2476         plt_address_for_local.
2477         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2478         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2479         got_irelative_, and irelative_count_ fields.  Update
2480         declarations.
2481         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2482         Initialize new fields.  Remove symtab parameter.  Change all
2483         callers.
2484         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2485         irelative_count_.
2486         (Output_data_plt_x86_64::has_irelative_section): New function.
2487         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2488         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2489         fields.  Update declarations.
2490         (Target_x86_64::Target_x86_64): Initialize new fields.
2491         (Target_x86_64::do_plt_address_for_global): New function replacing
2492         do_plt_section_for_global.
2493         (Target_x86_64::do_plt_address_for_local): New function replacing
2494         do_plt_section_for_local.
2495         (Target_x86_64::got_section): Create got_irelative_.
2496         (Target_x86_64::rela_irelative_section): New function.
2497         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2498         all callers.  Don't create __rel_iplt_{start,end}.
2499         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2500         parameters.  Change all callers.  Use different PLT and GOT for
2501         IFUNC symbols.
2502         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2503         layout parameters.  Change all callers.  Use different PLT and
2504         GOT.
2505         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2506         parameters.  Change all callers.  Use different PLT and GOT for
2507         IFUNC symbols.
2508         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2509         (Output_data_plt_x86_64::rela_irelative): New function.
2510         (Output_data_plt_x86_64::address_for_global): New function.
2511         (Output_data_plt_x86_64::address_for_local): New function.
2512         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2513         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2514         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2515         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2516         parameters.
2517         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2518         reloc.
2519         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2520         symbols if we didn't create an IRELATIVE GOT.
2521         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2522         plt_address_for_local.
2523         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2524         * testsuite/ifuncvar1.c: New test file.
2525         * testsuite/ifuncvar2.c: New test file.
2526         * testsuite/ifuncvar3.c: New test file.
2527         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2528         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2529         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2530         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2531         * testsuite/Makefile.in: Rebuild.
2532
2533 2011-07-07  Cary Coutant  <ccoutant@google.com>
2534
2535         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2536         (two_file_test_1_ndebug.o): Likewise.
2537         (two_file_test_1b_ndebug.o): Likewise.
2538         (two_file_test_2_ndebug.o): Likewise.
2539         (two_file_test_main_ndebug.o): Likewise.
2540         (incremental_test_2): Link with no-debug versions.
2541
2542 2011-07-06  Cary Coutant  <ccoutant@google.com>
2543
2544         * gold/incremental.cc
2545         (Output_section_incremental_inputs::write_info_blocks): Check for
2546         hidden and internal symbols.
2547
2548 2011-07-06  Cary Coutant  <ccoutant@google.com>
2549
2550         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2551         Check disposition for startup file.
2552         (Incremental_inputs::report_command_line): Ignore
2553         --incremental-startup-unchanged option.
2554         * options.cc (General_options::parse_incremental_startup_unchanged):
2555         New function.
2556         (General_options::General_options): Initialize new data member.
2557         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2558         (General_options): Add --incremental-startup-unchanged option.
2559         (General_options::incremental_startup_disposition): New function.
2560         (General_options::incremental_startup_disposition_): New data member.
2561
2562 2011-07-06  Cary Coutant  <ccoutant@google.com>
2563
2564         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2565         input file index to Script_info ctor.
2566         (Sized_incremental_binary::do_file_has_changed): Find the
2567         command-line argument for files named in scripts.
2568         * incremental.h (Script_info::Script_info): New ctor
2569         with input file index.
2570         (Script_info::input_file_index): New function.
2571         (Script_info::input_file_index_): New data member.
2572         (Incremental_binary::get_library): Add const.
2573         (Incremental_binary::get_script_info): Add const.
2574         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2575         * testsuite/Makefile.am (incremental_test_5): New test case.
2576         (incremental_test_6): New test case.
2577         * testsuite/Makefile.in: Regenerate.
2578
2579 2011-07-06  Cary Coutant  <ccoutant@google.com>
2580
2581         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2582         debug output when command lines differ.
2583
2584 2011-07-06  Cary Coutant  <ccoutant@google.com>
2585
2586         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2587         --incremental-patch option.
2588         * layout.cc (Free_list::allocate): Extend allocation beyond original
2589         end if enabled.
2590         (Layout::make_output_section): Mark sections that should get
2591         patch space.
2592         * options.cc (parse_percent): New function.
2593         * options.h (parse_percent): New function.
2594         (DEFINE_percent): New macro.
2595         (General_options): Add --incremental-patch option.
2596         * output.cc (Output_section::Output_section): Initialize new data
2597         members.
2598         (Output_section::add_input_section): Print section name when out
2599         of patch space.
2600         (Output_section::add_output_section_data): Likewise.
2601         (Output_section::set_final_data_size): Add patch space when
2602         doing --incremental-full.
2603         (Output_section::do_reset_address_and_file_offset): Remove patch
2604         space.
2605         (Output_segment::set_section_list_addresses): Print debug output
2606         only if --incremental-update.
2607         * output.h (Output_section::set_is_patch_space_allowed): New function.
2608         (Output_section::is_patch_space_allowed_): New data member.
2609         (Output_section::patch_space_): New data member.
2610         * parameters.cc (Parameters::incremental_full): New function.
2611         * parameters.h (Parameters::incremental_full): New function
2612         * testsuite/Makefile.am (incremental_test_2): Add test for
2613         --incremental-patch option.
2614         * testsuite/Makefile.in: Regenerate.
2615         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2616         (t18): Remove function body.
2617
2618 2011-07-05  Doug Kwan  <dougkwan@google.com>
2619
2620         PR gold/12771
2621         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2622         Arm_Address type for relocation result.
2623         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2624         overflow check.
2625         (Arm_relocate_functions::abs32): Use unaligned access.
2626         (Arm_relocate_functions::rel32): Ditto.
2627         (Arm_relocate_functions::prel31): Ditto.
2628         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2629         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2630         static data relocations.
2631         * testsuite/Makefile.in: Regnerate.
2632         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2633
2634 2011-07-05  Ian Lance Taylor  <iant@google.com>
2635
2636         PR gold/12392
2637         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2638         symbols if necessary.
2639         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2640
2641 2011-07-05  Ian Lance Taylor  <iant@google.com>
2642
2643         PR gold/12952
2644         * resolve.cc (Symbol::override_base_with_special): Simply override
2645         version with special symbol version, ignoring previous version.
2646
2647 2011-07-05  Ian Lance Taylor  <iant@google.com>
2648
2649         * object.cc (Sized_relobj_file::include_section_group): Add
2650         information to comment about signature location.
2651
2652 2011-07-02  Ian Lance Taylor  <iant@google.com>
2653
2654         PR gold/12957
2655         * options.h (class General_options): Add -f and -F.
2656         * options.cc (General_options::finalize): Fatal error if -f/-F
2657         are used without -shared.
2658         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2659
2660 2011-07-02  Ian Lance Taylor  <iant@google.com>
2661
2662         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2663
2664 2011-07-01  Ian Lance Taylor  <iant@google.com>
2665
2666         PR gold/12525
2667         PR gold/12952
2668         * resolve.cc (Symbol::override_base_with_special): Don't override
2669         the version if the overriding symbol has a different name.
2670         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2671         all callers.  If we give an error about an undefined version,
2672         define the base version if necessary.
2673         * dynobj.h (class Versions): Update declaration.
2674         * testsuite/weak_alias_test_5.cc: New file.
2675         * testsuite/weak_alias_test.script: New file.
2676         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2677         and versioned_alias have the right value, and call t2.
2678         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2679         weak_alias_test_5.so.
2680         (weak_alias_test_LDADD): Likewise.
2681         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2682         * testsuite/Makefile.in: Rebuild.
2683
2684 2011-07-01  Ian Lance Taylor  <iant@google.com>
2685
2686         PR gold/12525
2687         * options.h (class General_options): Support -z notext.
2688         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2689         -Wl,-z,notext.
2690         (two_file_shared_nonpic.so): Likewise.
2691         (two_file_shared_mixed.so): Likewise.
2692         (two_file_shared_mixed_1.so): Likewise.
2693         (weak_undef_lib_nonpic.so): Likewise.
2694         (alt/weak_undef_lib_nonpic.so): Likewise.
2695         (tls_test_shared_nonpic.so): Likewise.
2696         * testsuite/Makefile.in: Rebuild.
2697
2698 2011-07-01  Ian Lance Taylor  <iant@google.com>
2699
2700         PR gold/12525
2701         * configure.ac: Test whether static linking works, setting
2702         the automake conditional HAVE_STATIC.
2703         * testsuite/Makefile.am: Disable tests using -static if
2704         HAVE_STATIC is not true.
2705         * configure, testsuite/Makefile.in: Rebuild.
2706
2707 2011-07-01  Ian Lance Taylor  <iant@google.com>
2708
2709         PR gold/12525
2710         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2711         Assert if we see DW_EH_PE_indirect.
2712         * target.h (Target::ehframe_datarel_base): New function.
2713         (Target::do_ehframe_datarel_base): New target function.
2714         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2715         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2716         function.
2717
2718 2011-07-01  Ian Lance Taylor  <iant@google.com>
2719
2720         PR gold/12571
2721         * options.h (class General_options): Add
2722         --ld-generated-unwind-info.
2723         * ehframe.cc (Fde::write): Add address parameter.  Change all
2724         callers.  If associated with PLT, fill in address and size.
2725         (Cie::set_output_offset): Only add merge mapping if there is an
2726         object.
2727         (Cie::write): Add address parameter.  Change all callers.
2728         (Eh_frame::add_ehframe_for_plt): New function.
2729         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2730         input_offset_ fields into union u_, with new plt field.
2731         (Fde::Fde): Adjust for new union field.
2732         (Fde::Fde) [Output_data version]: New constructor.
2733         (Fde::add_mapping): Only add merge mapping if there is an object.
2734         (class Cie): Update declarations.
2735         (class Eh_frame): Declare add_ehframe_for_plt.
2736         * layout.cc (Layout::layout_eh_frame): Break out code into
2737         make_eh_frame_section, and call it.
2738         (Layout::make_eh_frame_section): New function.
2739         (Layout::add_eh_frame_for_plt): New function.
2740         * layout.h (class Layout): Update declarations.
2741         * merge.cc (Merge_map::add_mapping): Add assertion.
2742         * i386.cc: Include "dwarf.h".
2743         (class Output_data_plt_i386): Make first_plt_entry,
2744         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2745         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2746         and plt_eh_frame_fde.
2747         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2748         boundary.  Call add_eh_frame_for_plt if appropriate.
2749         * x86_64.cc: Include "dwarf.h".
2750         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2751         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2752         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2753         and plt_eh_frame_fde.
2754         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2755         appropriate.
2756
2757 2011-06-29  Ian Lance Taylor  <iant@google.com>
2758
2759         PR gold/12629
2760         * object.cc (Sized_relobj_file::layout_section): Change shdr
2761         parameter to be const.
2762         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2763         out of do_layout.
2764         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2765         appropriate.  Call layout_eh_frame_section.
2766         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2767         sections.
2768         * object.h (class Sized_relobj_file): Update declarations.
2769
2770 2011-06-29  Ian Lance Taylor  <iant@google.com>
2771
2772         PR gold/12652
2773         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2774         modifier.
2775         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2776
2777 2011-06-29  Ian Lance Taylor  <iant@google.com>
2778
2779         PR gold/12675
2780         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2781         SHT_X86_64_UNWIND.
2782         * layout.cc (Layout::layout_eh_frame): Likewise.
2783
2784 2011-06-29  Ian Lance Taylor  <iant@google.com>
2785
2786         PR gold/12695
2787         * layout.cc (Layout::symtab_section_shndx): New function.
2788         * layout.h (class Layout): Declare symtab_section_shndx.
2789         * output.cc (Output_section::write_header): Call it.
2790
2791 2011-06-29  Ian Lance Taylor  <iant@google.com>
2792
2793         PR gold/12818
2794         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2795         symbols which are not used in a relocation.
2796
2797 2011-06-28  Ian Lance Taylor  <iant@google.com>
2798
2799         PR gold/12898
2800         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2801         script create indistinguishable segments.
2802         (Layout::set_segment_offsets): Use stable_sort when sorting
2803         segments.  Pass this to Compare_segments constructor.
2804         * layout.h (class Layout): Make segment_precedes non-static.
2805         (class Compare_segments): Change from struct to class.  Add
2806         layout_ field.  Add constructor.
2807         * script-sections.cc
2808         (Script_sections::attach_sections_using_phdrs_clause): Rename
2809         local orphan to is_orphan.  Don't report failure to put empty
2810         section in segment.  On attachment failure, report name of
2811         section, and attach to first PT_LOAD segment.
2812
2813 2011-06-28  Ian Lance Taylor  <iant@google.com>
2814
2815         PR gold/12934
2816         * target-select.cc (Target_selector::Target_selector): Add
2817         emulation parameter.  Change all callers.
2818         (select_target_by_bfd_name): Rename from select_target_by_name.
2819         Change all callers.
2820         (select_target_by_emulation): New function.
2821         (supported_emulation_names): New function.
2822         * target-select.h (class Target_selector): Add emulation_ field.
2823         Update declarations.
2824         (Target_selector::recognize_by_bfd_name): Rename from
2825         recognize_by_name.  Change all callers.
2826         (Target_selector::supported_bfd_names): Rename from
2827         supported_names.  Change all callers.
2828         (Target_selector::recognize_by_emulation): New function.
2829         (Target_selector::supported_emulations): New function.
2830         (Target_selector::emulation): New function.
2831         (Target_selector::do_recognize_by_bfd_name): Rename from
2832         do_recognize_by_name.  Change all callers.
2833         (Target_selector::do_supported_bfd_names): Rename from
2834         do_supported_names.  Change all callers.
2835         (Target_selector::do_recognize_by_emulation): New function.
2836         (Target_selector::do_supported_emulations): New function.
2837         (select_target_by_bfd_name): Change name in declaration.
2838         (select_target_by_emulation): Declare.
2839         (supported_emulation_names): Declare.
2840         * parameters.cc (parameters_force_valid_target): Try to find
2841         target based on emulation from -m option.
2842         * options.h (class General_options): Change doc string for -m.
2843         * options.cc (help): Print emulations.
2844         (General_options::parse_V): Likewise.
2845         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2846         Add emulation parameter.  Change all callers.
2847
2848 2011-06-28  Ian Lance Taylor  <iant@google.com>
2849
2850         * target.h (class Target): Add osabi_ field.
2851         (Target::osabi): New function.
2852         (Target::set_osabi): New function.
2853         (Target::Target): Initialize osabi_.
2854         (Target::do_adjust_elf_header): Make pure virtual.
2855         (Sized_target::do_adjust_elf_header): Declare.
2856         * target.cc (Sized_target::do_adjust_elf_header): New function.
2857         (class Sized_target): Instantiate all versions.
2858         * freebsd.h (class Target_freebsd): Remove.
2859         (Target_selector_freebsd::do_recognize): Call set_osabi on
2860         Target.
2861         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2862         (Target_selector_freebsd::set_osabi): Remove.
2863         * i386.cc (class Target_i386): Inherit from Sized_target rather
2864         than Target_freebsd.
2865         * x86_64.cc (class Target_x86_64): Likewise.
2866
2867 2011-06-28  Ian Lance Taylor  <iant@google.com>
2868
2869         * target.h (Target::can_check_for_function_pointers): Rewrite.
2870         Make non-virtual.
2871         (Target::can_icf_inline_merge_sections): Likewise.
2872         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2873         (Target::Target_info): Add can_icf_inline_merge_sections field.
2874         (Target::do_can_check_for_function_pointers): New virtual
2875         function.
2876         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2877         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2878         from can_check_for_function_pointers, move in file.
2879         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2880         section_may_have_icf_unsafe_poineters, move in file.
2881         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2882         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2883         Rename from can_check_for_function_pointers, move in file.
2884         (Target_i386::can_icf_inline_merge_sections): Remove.
2885         (Target_i386::i386_info): Initialize
2886         can_icf_inline_merge_sections.
2887         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2888         Initialize can_icf_inline_merge_sections.
2889         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2890         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2891         Rename from can_check_for_function_pointers, move in file.
2892         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2893         (Target_x86_64::x86_64_info): Initialize
2894         can_icf_inline_merge_sections.
2895         * testsuite/testfile.cc (Target_test::test_target_info):
2896         Likewise.
2897         * icf.cc (get_section_contents): Correct formatting.
2898
2899 2011-06-27  Ian Lance Taylor  <iant@google.com>
2900
2901         * symtab.cc (Symbol::versioned_name): New function.
2902         (Symbol_table::add_to_final_symtab): Use versioned_name when
2903         appropriate.
2904         (Symbol_table::sized_write_symbol): Likewise.
2905         * symtab.h (class Symbol): Declare versioned_name.
2906         * stringpool.h (class Stringpool_template): Add variant of add
2907         which takes a std::basic_string.
2908         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2909         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2910         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2911         (ver_test_12.o): New target.
2912         * testsuite/Makefile.in: Rebuild.
2913
2914 2011-06-27  Doug Kwan  <dougkwan@google.com>
2915
2916         * arm.cc (Arm_relocate_functions::thm_jump8,
2917         Arm_relocate_functions::thm_jump11): Use a wider signed
2918         type to compute offset.
2919         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2920         arm_thm_jump8.
2921         * testsuite/Makefile.in: Regenerate.
2922         * testsuite/arm_branch_in_range.sh: Check test results of
2923         arm_thm_jump11 and arm_thm_jump8.
2924         * testsuite/arm_thm_jump11.s: New test source file.
2925         * testsuite/arm_thm_jump11.t: New linker script.
2926         * testsuite/arm_thm_jump8.s: New test source file.
2927         * testsuite/arm_thm_jump8.t: New linker script.
2928
2929 2011-06-24  Ian Lance Taylor  <iant@google.com>
2930
2931         * layout.cc: Include "object.h".
2932         (ctors_sections_in_init_array): New static variable.
2933         (Layout::is_ctors_in_init_array): New function.
2934         (Layout::layout): Add entry to ctors_sections_in_init_array if
2935         appropriate.
2936         * layout.h (class Layout): Declare is_ctors_in_init_array.
2937         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2938         is_ctors_reverse_view is set.
2939         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2940         all callers.  Set is_ctors_reverse_view field of View_size.
2941         (Sized_relobj_file::reverse_words): New function.
2942         * object.h (Sized_relobj_file::View_size): Add
2943         is_ctors_reverse_view field.
2944         (class Sized_relobj_file): Update declarations.
2945         * testsuite/initpri3.c: New test.
2946         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2947         initpri3b.
2948         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2949         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2950         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2951         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2952         * testsuite/Makefile.in: Rebuild.
2953
2954 2011-06-24  Cary Coutant  <ccoutant@google.com>
2955
2956         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2957         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2958         (debug_msg_cdebug.err): New targets.
2959         * testsuite/Makefile.in: Regenerate.
2960         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2961         Fix checks for link with shared library.
2962
2963 2011-06-24  Doug Kwan  <dougkwan@google.com>
2964
2965         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2966         skip empty text sections.
2967         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2968
2969 2011-06-22  Ian Lance Taylor  <iant@google.com>
2970
2971         PR gold/12910
2972         * options.h (class General_options): Add --ctors-in-init-array.
2973         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2974         friends as SHT_PROGBITS for merging sections.
2975         (Layout::layout): Remove special handling of .init_array and
2976         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2977         and .dtors if ctors_in_init_array.
2978         (Layout::make_output_section): Force correct section types for
2979         .init_array and friends.  Don't sort if doing relocatable link,
2980         Don't sort .ctors and .dtors if ctors_in_init_array.
2981         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2982         (Layout::output_section_name): Add relobj parameter.  Change all
2983         callers.  Handle .ctors. and .dtors. in code rather than table.
2984         Handle .ctors and .dtors if ctors_in_init_array.
2985         (Layout::match_file_name): New function, moved from output.cc.
2986         * layout.h (class Layout): Update declarations.
2987         * output.cc: Include "layout.h".
2988         (Input_section_sort_entry::get_priority): New function.
2989         (Input_section_sort_entry::match_file_name): Just call
2990         Layout::match_file_name.
2991         (Output_section::Input_section_sort_init_fini_compare::operator()):
2992         Handle .ctors and .dtors.  Sort by explicit priority rather than
2993         by name.
2994         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2995         * testsuite/initpri2.c: New test.
2996         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2997         (check_PROGRAMS): Add initpri2.
2998         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2999         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3000         * configure, testsuite/Makefile.in: Rebuild.
3001
3002 2011-06-19  Ian Lance Taylor  <iant@google.com>
3003
3004         PR gold/12880
3005         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3006         .interp section to a PT_INTERP segment even if we have seen a
3007         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3008         clause in a linker script.
3009         (Layout::finalize): Don't create a .interp section if we've
3010         already create a PT_INTERP segment.
3011         (Layout::create_interp): Always call choose_output_section (revert
3012         patch of 2011-06-17).  Don't create PT_INTERP segment.
3013         * script-sections.cc
3014         (Script_sections::create_note_and_tls_segments): Add a .interp
3015         section to a PT_INTERP segment even if we have seen a
3016         --dynamic-linker option.
3017
3018 2011-06-18  Ian Lance Taylor  <iant@google.com>
3019
3020         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3021         merely because a non-PT_LOAD segment has a dynamic reloc.
3022
3023 2011-06-18  Ian Lance Taylor  <iant@google.com>
3024
3025         * layout.cc (Layout::finish_dynamic_section): Don't create
3026         DT_FLAGS entry if not needed.
3027
3028 2011-06-18  Ian Lance Taylor  <iant@google.com>
3029
3030         PR gold/12745
3031         * layout.cc (Layout::layout_eh_frame): Correct handling of
3032         writable .eh_frame section.
3033
3034 2011-06-17  Ian Lance Taylor  <iant@google.com>
3035
3036         PR gold/12893
3037         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3038         symbol is redefined with the exact same object and value.
3039
3040 2011-06-17  Ian Lance Taylor  <iant@google.com>
3041
3042         PR gold/12880
3043         * layout.h (class Layout): Add interp_segment_ field.
3044         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3045         (Layout::attach_allocated_section_to_segment): If making shared
3046         library, put .interp section in PT_INTERP segment.
3047         (Layout::finalize): Also call create_interp if -dynamic-linker
3048         option was used.
3049         (Layout::create_interp): Assert that there is no PT_INTERP
3050         segment.  If not using a SECTIONS clause, use make_output_section.
3051         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3052         * script-sections.cc
3053         (Script_sections::create_note_and_tls_segments): If making shared
3054         library, put .interp section in PT_INTERP segment.
3055
3056 2011-06-17  Ian Lance Taylor  <iant@google.com>
3057
3058         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3059         when making a shared library.
3060
3061 2011-06-17  Ian Lance Taylor  <iant@google.com>
3062
3063         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3064         parameter.  Change all callers.  Don't issue warning about PC32
3065         against locally defined symbol.
3066
3067 2011-06-16  Ian Lance Taylor  <iant@google.com>
3068
3069         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3070         occurs in same object.
3071
3072 2011-06-14  Alan Modra  <amodra@gmail.com>
3073
3074         * po/POTFILES.in: Regenerate.
3075
3076 2011-06-09  Ian Lance Taylor  <iant@google.com>
3077
3078         * script-sections.cc
3079         (Orphan_output_section::set_section_addresses): For a relocatable
3080         link set address to 0.
3081
3082 2011-06-09  Cary Coutant  <ccoutant@google.com>
3083
3084         PR gold/12804
3085         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3086         used with --compress-debug-sections.
3087         * gold/object.cc (Sized_relobj_file::do_layout): Report
3088         uncompressed size of compressed input sections.
3089
3090 2011-06-08  Cary Coutant  <ccoutant@google.com>
3091
3092         PR gold/12804
3093         * testsuite/two_file_test_2_v1.cc: Change initialization of
3094         v2 to keep it in .data.
3095
3096 2011-06-07  Cary Coutant  <ccoutant@google.com>
3097
3098         * common.cc (Symbol_table::do_allocate_commons_list): Call
3099         gold_fallback.
3100         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3101         (Errors::fallback): New function.
3102         (gold_fallback): New function.
3103         * errors.h (Errors::fallback): New function.
3104         * gold.cc (gold_exit): Change status parameter to enum; adjust
3105         all callers.
3106         (queue_initial_tasks): Call gold_fallback.
3107         * gold.h: Include cstdlib.
3108         (Exit_status): New enum type.
3109         (gold_exit): Change status parameter to enum.
3110         (gold_fallback): New function.
3111         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3112         (Layout::create_symtab_sections): Likewise.
3113         (Layout::create_shdrs): Likewise.
3114         * main.cc (main): Adjust call to gold_exit.
3115         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3116         (Output_data_got::add_got_entry_pair): Likewise.
3117         (Output_section::add_input_section): Likewise.
3118         (Output_section::add_output_section_data): Likewise.
3119         (Output_segment::set_section_list_addresses): Likewise.
3120         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3121
3122 2011-06-07  Cary Coutant  <ccoutant@google.com>
3123
3124         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3125         for incremental links.
3126         * output.cc (Output_segment::set_section_list_addresses): Remove
3127         FIXME and test for TLS or BSS.
3128
3129 2011-06-07  Cary Coutant  <ccoutant@google.com>
3130
3131         * testsuite/Makefile.am: Add incremental_copy_test,
3132         incremental_common_test_1.
3133         * testsuite/Makefile.in: Regenerate.
3134         * testsuite/common_test_1_v1.c: New source file.
3135         * testsuite/common_test_1_v2.c: New source file.
3136         * testsuite/copy_test_v1.cc: New source file.
3137
3138 2011-06-07  Cary Coutant  <ccoutant@google.com>
3139
3140         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3141         update, allocate common from bss section's free list.
3142         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3143         linker-defined symbols.
3144         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3145         Skip GOT and PLT entries that are no longer referenced.
3146         (Output_section_incremental_inputs::write_info_blocks): Mark
3147         linker-defined symbols.
3148         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3149         * output.cc (Output_section::allocate): New function.
3150         * output.h (Output_section::allocate): New function.
3151         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3152         linker-defined symbols.
3153         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3154         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3155         (Symbol::init_base_output_data): Likewise.
3156         (Symbol::init_base_output_segment): Likewise.
3157         (Symbol::init_base_constant): Likewise.
3158         (Sized_symbol::init_output_data): Likewise.
3159         (Sized_symbol::init_output_segment): Likewise.
3160         (Sized_symbol::init_constant): Likewise.
3161         (Symbol_table::do_define_in_output_data): Likewise.
3162         (Symbol_table::do_define_in_output_segment): Likewise.
3163         (Symbol_table::do_define_as_constant): Likewise.
3164         * symtab.h (Symbol::is_predefined): New function.
3165         (Symbol::init_base_output_data): Add is_predefined parameter.
3166         (Symbol::init_base_output_segment): Likewise.
3167         (Symbol::init_base_constant): Likewise.
3168         (Symbol::is_predefined_): New data member.
3169         (Sized_symbol::init_output_data): Add is_predefined parameter.
3170         (Sized_symbol::init_output_segment): Likewise.
3171         (Sized_symbol::init_constant): Likewise.
3172         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3173
3174 2011-06-07  Cary Coutant  <ccoutant@google.com>
3175
3176         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3177         instead of emit_copy_reloc.
3178         (Copy_relocs::emit_copy_reloc): Refactor.
3179         (Copy_relocs::make_copy_reloc): New function.
3180         (Copy_relocs::add_copy_reloc): Remove.
3181         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3182         section.
3183         (Copy_relocs::make_copy_reloc): New function.
3184         (Copy_relocs::add_copy_reloc): Remove.
3185         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3186         unchanged input files.
3187         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3188         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3189         Reserve BSS space for COPY relocations.
3190         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3191         (Output_section_incremental_inputs::write_info_blocks): Record
3192         whether a symbol is copied from a shared object.
3193         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3194         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3195         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3196         (Incremental_input_entry_reader::get_output_symbol_index): Add
3197         is_copy parameter.
3198         (Incremental_binary::emit_copy_relocs): New function.
3199         (Incremental_binary::do_emit_copy_relocs): New function.
3200         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3201         new data member.
3202         (Sized_incremental_binary::add_copy_reloc): New function.
3203         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3204         (Sized_incremental_binary::Copy_reloc): New struct.
3205         (Sized_incremental_binary::Copy_relocs): New typedef.
3206         (Sized_incremental_binary::copy_relocs_): New data member.
3207         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3208         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3209         * target.h (Sized_target::emit_copy_reloc): New function.
3210         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3211
3212 2011-06-02  Cary Coutant  <ccoutant@google.com>
3213
3214         PR gold/12163
3215         * gold/archive.cc (Archive::Archive): Initialize new data member.
3216         (Archive::include_all_members): Return if archive has already been
3217         included.
3218         * gold/archive.h (Archive::include_all_members_): New data member.
3219
3220 2011-06-02  Nick Clifton  <nickc@redhat.com>
3221
3222         * dynobj.h: Fix spelling mistake in comment.
3223         * output.cc: Likewise.
3224
3225 2011-05-31  Doug Kwan  <dougkwan@google.com>
3226             Asier Llano
3227
3228         PR gold/12826
3229         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3230         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3231         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3232         redundant arm_exidx_test.so.
3233         * testsuite/Makefile.in: Regenerate.
3234         (check_SCRIPTS): Add pr12826.sh
3235         (check_DATA): Add pr12826.stdout
3236         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3237         * testsuite/pr12826.sh: New file.
3238         * testsuite/pr12826_1.s: Ditto.
3239         * testsuite/pr12826_1.s: Ditto.
3240
3241 2011-05-30  Ian Lance Taylor  <iant@google.com>
3242
3243         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3244         sections.
3245
3246 2011-05-29  Ian Lance Taylor  <iant@google.com>
3247
3248         PR gold/12804
3249         * testsuite/Makefile.am: Use different file name for two_file_test
3250         temporary file for each incremental test.
3251         * testsuite/Makefile.in: Rebuild.
3252
3253 2011-05-29  Ian Lance Taylor  <iant@google.com>
3254
3255         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3256         binary input file is empty.
3257
3258 2011-05-27  Ian Lance Taylor  <iant@google.com>
3259
3260         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3261         (ver_test_9.so): Likewise.
3262         * testsuite/Makefile.in: Rebuild.
3263
3264 2011-05-26 Cary Coutant  <ccoutant@google.com>
3265
3266         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3267         * incremental.cc (Incremental_inputs::report_input_section): Fix
3268         comment, indentation.
3269         (Incremental_inputs::report_comdat_group): New function.
3270         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3271         of data for incremental input file entry.
3272         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3273         group count, COMDAT group signatures.
3274         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3275         an unchanged input file.
3276         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3277         Initialize new data member.
3278         (Incremental_object_entry::add_comdat_group): New function.
3279         (Incremental_object_entry::get_comdat_group_count): New function.
3280         (Incremental_object_entry::get_comdat_signature_key): New function.
3281         (Incremental_object_entry::groups_): New data member.
3282         (Incremental_inputs::report_comdat_group): New function.
3283         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3284         data for incremental input file entry.
3285         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3286         (Incremental_input_entry_reader::get_input_section): Adjust size of
3287         data for incremental input file entry.
3288         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3289         (Incremental_input_entry_reader::get_comdat_group_signature): New
3290         function.
3291         * object.cc (Sized_relobj::include_section_group): Report kept
3292         COMDAT groups for incremental links.
3293
3294 2011-05-24  David Meyer  <pdox@google.com>
3295
3296         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3297         with name parameter.  Add found_name parameter.
3298         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3299         * dirsearch.h (class Dirsearch): Update declaration.
3300
3301 2011-05-24  Ian Lance Taylor  <iant@google.com>
3302
3303         * archive.cc (Library_base::should_include_member): Pull in object
3304         from archive if it defines the entry symbol.
3305         * parameters.cc (Parameters::entry): New function.
3306         * parameters.h (class Parameters): Declare entry.
3307         * output.h (class Output_file_header): Remove entry_ field.
3308         * output.cc (Output_file_header::Output_file_header): Remove entry
3309         parameter.  Change all callers.
3310         (Output_file_header::entry): Use parameters->entry.
3311         * gold.cc (queue_middle_tasks): Likewise.
3312         * plugin.cc (Plugin_hook::run): Likewise.
3313
3314 2011-05-24 Cary Coutant  <ccoutant@google.com>
3315
3316         * gold.cc (queue_initial_tasks): Pass incremental base filename
3317         to Output_file::open_base_file; don't print error message.
3318         * incremental-dump.cc (main): Adjust call to
3319         Output_file::open_for_modification.
3320         * incremental-dump.cc (main): Likewise.
3321         * incremental.cc (Incremental_inputs::report_command_line):
3322         Ignore --incremental-base option when comparing command lines.
3323         Ignore parameter when given as separate argument.
3324         * options.h (class General_options): Add --incremental-base.
3325         * output.cc (Output_file::Output_file):
3326         (Output_file::open_base_file): Add base_name and writable parameters;
3327         read base file into new file; print error message here.
3328         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3329         callers.
3330         * output.h (Output_file::open_for_modification): Rename to...
3331         (Output_file::open_base_file): ...this; add base_name and
3332         writable parameters; adjust all callers.
3333         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3334         callers.
3335         * testsuite/Makefile.am (incremental_test_4): Test
3336         --incremental-base.
3337         * testsuite/Makefile.in: Regenerate.
3338
3339 2011-05-24 Cary Coutant  <ccoutant@google.com>
3340
3341         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3342         incremental_test_4.
3343         * testsuite/Makefile.in: Regenerate.
3344         * testsuite/two_file_test_1_v1.cc: New test source file.
3345         * testsuite/two_file_test_1b_v1.cc: New test source file.
3346         * testsuite/two_file_test_2_v1.cc: New test source file.
3347
3348 2011-05-24 Cary Coutant  <ccoutant@google.com>
3349
3350         * dynobj.h (Dynobj::do_dynobj): New function.
3351         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3352         flag and soname for shared objects.
3353         * incremental.cc (Incremental_inputs::report_object): Make
3354         either Incremental_object_entry or Incremental_dynobj_entry; add
3355         soname to string table.
3356         (Incremental_inputs::report_input_section): Add assertion.
3357         (Output_section_incremental_inputs::set_final_data_size): Adjust
3358         type of input file entry for shared libraries; adjust size of
3359         shared library info entry.
3360         (Output_section_incremental_inputs::write_input_files): Write
3361         as_needed flag for shared libraries.
3362         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3363         of input file entry for shared libraries; write soname.
3364         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3365         soname from incremental info.
3366         * incremental.h (enum Incremental_input_flags): Add
3367         INCREMENTAL_INPUT_AS_NEEDED.
3368         (Incremental_input_entry::Incremental_input_entry): Initialize new
3369         data member.
3370         (Incremental_input_entry::set_as_needed): New function.
3371         (Incremental_input_entry::as_needed): New function.
3372         (Incremental_input_entry::do_dynobj_entry): New function.
3373         (Incremental_input_entry::as_needed_): New data member.
3374         (Incremental_object_entry::Incremental_object_entry): Don't check
3375         for shared library.
3376         (Incremental_object_entry::do_type): Likewise.
3377         (class Incremental_dynobj_entry): New class.
3378         (Incremental_input_entry_reader::as_needed): New function.
3379         (Incremental_input_entry_reader::get_soname): New function.
3380         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3381         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3382         size of shared library info entry.
3383         * layout.cc (Layout::finish_dynamic_section): Don't test for
3384         incremental link when adding DT_NEEDED entries.
3385         * object.h (Object::Object): Initialize new data member.
3386         (Object::dynobj): New function.
3387         (Object::set_as_needed): New function.
3388         (Object::as_needed): New function.
3389         (Object::do_dynobj): New function.
3390         (Object::as_needed_): New data member.
3391
3392 2011-05-24 Cary Coutant  <ccoutant@google.com>
3393
3394         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3395         info; adjust display of GOT entries.
3396         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3397         vector of input objects; remove file_status_.
3398         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3399         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3400         got_plt reader; call target hooks to reserve GOT entries.
3401         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3402         of input file info header and GOT info entry.
3403         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3404         relocation info.
3405         (Got_plt_view_info::got_descriptor): Remove.
3406         (Got_plt_view_info::sym_index): New data member.
3407         (Got_plt_view_info::input_index): New data member.
3408         (Local_got_offset_visitor::visit): Write input file index.
3409         (Global_got_offset_visitor::visit): Write 0 for input file index.
3410         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3411         with sym_index and input_index.
3412         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3413         incremental info GOT entry; replace got_descriptor with input_index.
3414         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3415         map from input file index to object.
3416         (Sized_relobj_incr::do_layout): Replace direct data member reference
3417         with accessor function.
3418         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3419         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3420         Adjust size of input file info header.
3421         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3422         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3423         (Incremental_input_entry_reader::get_input_section): Adjust size of
3424         input file info header.
3425         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3426         of incremental info GOT entry.
3427         (Incremental_got_plt_reader::get_got_desc): Remove.
3428         (Incremental_got_plt_reader::get_got_symndx): New function.
3429         (Incremental_got_plt_reader::get_got_input_index): New function.
3430         (Sized_incremental_binary::Sized_incremental_binary): Remove
3431         file_status_; add input_objects_.
3432         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3433         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3434         (Sized_incremental_binary::file_is_unchanged): Remove.
3435         (Sized_incremental_binary::set_input_object): New function.
3436         (Sized_incremental_binary::input_object): New function.
3437         (Sized_incremental_binary::file_status_): Remove.
3438         (Sized_incremental_binary::input_objects_): New data member.
3439         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3440         references.
3441         (Sized_relobj_incr::invalid_address): Move to base class.
3442         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3443         class.
3444         (Sized_relobj_incr::do_output_section_offset): Likewise.
3445         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3446         (Sized_relobj_incr::section_offsets_): Likewise.
3447         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3448         function.
3449         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3450         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3451         with accessor function.
3452         (Sized_relobj_file::do_layout): Likewise.
3453         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3454         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3455         (Sized_relobj_file::compute_final_local_value): Replace refs to
3456         section_offsets_ with accessor function.
3457         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3458         * object.h (Relobj::Relobj): Initialize new data members.
3459         (Relobj::add_dyn_reloc): New function.
3460         (Relobj::first_dyn_reloc): New function.
3461         (Relobj::dyn_reloc_count): New function.
3462         (Relobj::first_dyn_reloc_): New data member.
3463         (Relobj::dyn_reloc_count_): New data member.
3464         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3465         references.
3466         (Sized_relobj::Address): New typedef.
3467         (Sized_relobj::invalid_address): Move here from child class.
3468         (Sized_relobj::Sized_relobj): Initialize new data members.
3469         (Sized_relobj::sized_relobj): New function.
3470         (Sized_relobj::is_output_section_offset_invalid): Move here from
3471         child class.
3472         (Sized_relobj::get_output_section_offset): Likewise.
3473         (Sized_relobj::local_has_got_offset): Likewise.
3474         (Sized_relobj::local_got_offset): Likewise.
3475         (Sized_relobj::set_local_got_offset): Likewise.
3476         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3477         (Sized_relobj::clear_got_offsets): New function.
3478         (Sized_relobj::section_offsets): Move here from child class.
3479         (Sized_relobj::do_output_section_offset): Likewise.
3480         (Sized_relobj::do_set_section_offset): Likewise.
3481         (Sized_relobj::Local_got_offsets): Likewise.
3482         (Sized_relobj::local_got_offsets_): Likewise.
3483         (Sized_relobj::section_offsets_): Likewise.
3484         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3485         references.
3486         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3487         class.
3488         (Sized_relobj_file::sized_relobj): New function
3489         (Sized_relobj_file::local_has_got_offset): Move to base class.
3490         (Sized_relobj_file::local_got_offset): Likewise.
3491         (Sized_relobj_file::set_local_got_offset): Likewise.
3492         (Sized_relobj_file::get_output_section_offset): Likewise.
3493         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3494         (Sized_relobj_file::do_output_section_offset): Likewise.
3495         (Sized_relobj_file::do_set_section_offset): Likewise.
3496         (Sized_relobj_file::Local_got_offsets): Likewise.
3497         (Sized_relobj_file::local_got_offsets_): Likewise.
3498         (Sized_relobj_file::section_offsets_): Likewise.
3499         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3500         (all constructors).
3501         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3502         (Output_reloc::get_symbol_index): Likewise.
3503         (Output_reloc::local_section_offset): Likewise.
3504         (Output_reloc::get_address): Likewise.
3505         (Output_reloc::symbol_value): Likewise.
3506         (Output_data_got::reserve_slot): Move to class definition.
3507         (Output_data_got::reserve_local): New function.
3508         (Output_data_got::reserve_slot_for_global): Remove.
3509         (Output_data_got::reserve_global): New function.
3510         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3511         (all constructors, two instantiations).
3512         (Output_reloc::get_relobj): New function (two instantiations).
3513         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3514         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3515         (Output_data_reloc::add_global): Adjust type of relobj.
3516         (Output_data_reloc::add_global_relative): Likewise.
3517         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3518         (Output_data_reloc::add_local): Likewise.
3519         (Output_data_reloc::add_local_relative): Likewise.
3520         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3521         (Output_data_reloc::add_local_section): Likewise.
3522         (Output_data_reloc::add_output_section): Likewise.
3523         (Output_data_reloc::add_absolute): Likewise.
3524         (Output_data_reloc::add_target_specific): Likewise.
3525         (Output_data_got::reserve_slot): Move definition here.
3526         (Output_data_got::reserve_local): New function.
3527         (Output_data_got::reserve_global): New function.
3528         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3529         section_offsets_ with accessor function.
3530         (Sized_relobj_file::write_sections): Likewise.
3531         (Sized_relobj_file::do_relocate_sections): Likewise.
3532         * target.h (Sized_target::reserve_local_got_entry): New function.
3533         (Sized_target::reserve_global_got_entry): New function.
3534         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3535         (Target_x86_64::reserve_global_got_entry): New function.
3536         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3537
3538 2011-05-23 Cary Coutant  <ccoutant@google.com>
3539
3540         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3541         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3542         bit when checking got_type.
3543         * incremental.cc (Sized_incremental_binary::setup_readers):
3544         Store symbol table and string table locations; initialize bit vector
3545         of file status flags.
3546         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3547         unchanged files.
3548         (Sized_incremental_binary::do_process_got_plt): New function.
3549         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3550         (Output_section_incremental_inputs::set_final_data_size): Record
3551         file index for each input file.
3552         (Output_section_incremental_inputs::write_got_plt): Store file index
3553         instead of input entry offset for each GOT entry.
3554         * incremental.h
3555         (Incremental_input_entry::Incremental_input_entry): Initialize new
3556         data member.
3557         (Incremental_input_entry::set_offset): Store file index.
3558         (Incremental_input_entry::get_file_index): New function.
3559         (Incremental_input_entry::file_index_): New data member.
3560         (Incremental_binary::process_got_plt): New function.
3561         (Incremental_binary::do_process_got_plt): New function.
3562         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3563         data members.
3564         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3565         (Sized_incremental_binary::set_file_is_unchanged): New function.
3566         (Sized_incremental_binary::file_is_unchanged): New function.
3567         (Sized_incremental_binary::do_process_got_plt): New function.
3568         (Sized_incremental_binary::file_status_): New data member.
3569         (Sized_incremental_binary::main_symtab_loc_): New data member.
3570         (Sized_incremental_binary::main_strtab_loc_): New data member.
3571         * output.cc (Output_data_got::Got_entry::write): Add case
3572         RESERVED_CODE.
3573         (Output_data_got::add_global): Call add_got_entry.
3574         (Output_data_got::add_global_plt): Likewise.
3575         (Output_data_got::add_global_with_rel): Likewise.
3576         (Output_data_got::add_global_with_rela): Likewise.
3577         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3578         (Output_data_got::add_global_pair_with_rela): Likewise.
3579         (Output_data_got::add_local): Call add_got_entry.
3580         (Output_data_got::add_local_plt): Likewise.
3581         (Output_data_got::add_local_with_rel): Likewise.
3582         (Output_data_got::add_local_with_rela): Likewise.
3583         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3584         (Output_data_got::add_local_pair_with_rela): Likewise.
3585         (Output_data_got::reserve_slot): New function.
3586         (Output_data_got::reserve_slot_for_global): New function.
3587         (Output_data_got::add_got_entry): New function.
3588         (Output_data_got::add_got_entry_pair): New function.
3589         (Output_section::add_output_section_data): Edit FIXME.
3590         * output.h
3591         (Output_section_data_build::Output_section_data_build): New
3592         constructor with size parameter.
3593         (Output_data_space::Output_data_space): Likewise.
3594         (Output_data_got::Output_data_got): Initialize new data member; new
3595         constructor with size parameter.
3596         (Output_data_got::add_constant): Call add_got_entry.
3597         (Output_data_got::reserve_slot): New function.
3598         (Output_data_got::reserve_slot_for_global): New function.
3599         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3600         (Output_data_got::add_got_entry): New function.
3601         (Output_data_got::add_got_entry_pair): New function.
3602         (Output_data_got::free_list_): New data member.
3603         * target.h (Sized_target::init_got_plt_for_update): New function.
3604         (Sized_target::register_global_plt_entry): New function.
3605         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3606         Initialize new data member; call init; add constructor with PLT count.
3607         (Output_data_plt_x86_64::init): New function.
3608         (Output_data_plt_x86_64::add_relocation): New function.
3609         (Output_data_plt_x86_64::reserve_slot): New function.
3610         (Output_data_plt_x86_64::free_list_): New data member.
3611         (Target_x86_64::init_got_plt_for_update): New function.
3612         (Target_x86_64::register_global_plt_entry): New function.
3613         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3614         incremental updates.
3615         (Output_data_plt_x86_64::add_relocation): New function.
3616         * testsuite/object_unittest.cc (Object_test): Set default options.
3617
3618 2011-05-16  Ian Lance Taylor  <iant@google.com>
3619
3620         * options.h (class General_options): Make -i a synonym for -r.
3621
3622 2011-05-16  Ian Lance Taylor  <iant@google.com>
3623
3624         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3625
3626 2011-05-10 Cary Coutant  <ccoutant@google.com>
3627
3628         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3629         strip_all (-s).
3630
3631 2011-05-06  Ian Lance Taylor  <iant@google.com>
3632
3633         * layout.cc (Layout::layout): If the output section flags change,
3634         update the ordering.
3635
3636 2011-04-25 Cary Coutant  <ccoutant@google.com>
3637
3638         * incremental-dump.cc (dump_incremental_inputs): Print local
3639         symbol info for each input file.
3640         * incremental.cc
3641         (Output_section_incremental_inputs::set_final_data_size): Add local
3642         symbol info to input file entries in incremental info.
3643         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3644         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3645         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3646         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3647         implementation.
3648         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3649         (Sized_incr_relobj::do_relocate): Write the local symbols.
3650         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3651         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3652         Adjust size of input file header.
3653         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3654         (Incremental_inputs_reader::get_local_symbol_count): New function.
3655         (Incremental_inputs_reader::get_input_section): Adjust size of input
3656         file header.
3657         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3658         (Sized_incr_relobj::This): New typedef.
3659         (Sized_incr_relobj::sym_size): New const data member.
3660         (Sized_incr_relobj::Local_symbol): New struct.
3661         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3662         (Sized_incr_relobj::do_local_symbol_offset): New function.
3663         (Sized_incr_relobj::local_symbol_count_): New data member.
3664         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3665         (Sized_incr_relobj::local_symbol_index_): New data member.
3666         (Sized_incr_relobj::local_symbol_offset_): New data member.
3667         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3668         (Sized_incr_relobj::local_symbols_): New data member.
3669         * object.h (Relobj::output_local_symbol_count): New function.
3670         (Relobj::local_symbol_offset): New function.
3671         (Relobj::do_output_local_symbol_count): New function.
3672         (Relobj::do_local_symbol_offset): New function.
3673         (Sized_relobj::do_output_local_symbol_count): New function.
3674         (Sized_relobj::do_local_symbol_offset): New function.
3675
3676 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3677
3678         * descriptors.cc (set_close_on_exec): New function.
3679         (Descriptors::open): Use set_close_on_exec.
3680         * output.cc (S_ISLNK): Define if not defined.
3681
3682 2011-04-22 Cary Coutant  <ccoutant@google.com>
3683
3684         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3685         global symbol map.
3686         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3687         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3688         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3689         relocations.
3690         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3691         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3692         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3693         * incremental.h
3694         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3695         function.
3696         (Incremental_binary::apply_incremental_relocs): New function.
3697         (Incremental_binary::do_apply_incremental_relocs): New function.
3698         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3699         data member.
3700         (Sized_incremental_binary::add_global_symbol): New function.
3701         (Sized_incremental_binary::global_symbol): New function.
3702         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3703         (Sized_incremental_binary::symbol_map_): New data member.
3704         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3705         * target.h (Sized_target::apply_relocation): New function.
3706         * target-reloc.h (apply_relocation): New function.
3707         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3708
3709 2011-04-22  Doug Kwan  <dougkwan@google.com>
3710
3711         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3712         flag of a SHT_ARM_EXIDX section.
3713         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3714         * testsuite/Makefile.in: Regenerate.
3715         * testsuite/arm_exidx_test.s: New file.
3716         * testsuite/arm_exidx_test.sh: Same.
3717
3718 2011-04-20 Cary Coutant  <ccoutant@google.com>
3719
3720         PR gold/12689
3721         * archive.h (Incremental_archive_entry::Archive_member):
3722         Initialize arg_serial_ (second constructor).
3723
3724 2011-04-17  Ian Lance Taylor  <iant@google.com>
3725
3726         * object.cc (Relocate_info::location): Simplify location string.
3727         * errors.cc (Errors::error_at_location): Don't print program
3728         name.
3729         (Errors::warning_at_location): Likewise.
3730         (Errors::undefined_symbol): Likewise.
3731         * testsuite/debug_msg.sh: Update accordingly.
3732
3733 2011-04-14 Cary Coutant  <ccoutant@google.com>
3734
3735         * gold/layout.cc (Layout::symtab_section_offset): New function.
3736         * gold/layout.h (Layout::symtab_section_offset): New function.
3737         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3738
3739 2011-04-12  Ian Lance Taylor  <iant@google.com>
3740
3741         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3742         with MREMAP_MAYMOVE.
3743         * output.h (class Output_file): Add map_is_allocated_ field.
3744         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3745         not available, provide stubs.  If mremap is not available, #define
3746         it to gold_mremap.
3747         (MREMAP_MAYMOVE): Define if not defined.
3748         (Output_file::Output_file): Initialize map_is_allocated_.
3749         (Output_file::resize): Check map_is_allocated_.
3750         (Output_file::map_anonymous): If mmap fails, use malloc.
3751         (Output_file::unmap): Don't do anything for an anonymous map.
3752         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3753         is not available, provide stubs.
3754         (File_read::View::~View): Use free rather than delete[].
3755         (File_read::make_view): Use malloc rather than new[].  If mmap
3756         fails, use malloc.
3757         (File_read::find_or_make_view): Use malloc rather than new[].
3758         * gold.h: Remove HAVE_REMAP code.
3759         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3760         exists.  Rename mremap to gold_mremap.  If mmap is not available
3761         don't do anything.
3762         * configure, config.in: Rebuild.
3763
3764 2011-04-11  Ian Lance Taylor  <iant@google.com>
3765
3766         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3767         initialize local variable v.
3768
3769 2011-04-11  Cary Coutant  <ccoutant@google.com>
3770
3771         * archive.cc (Archive::include_member): Adjust call to
3772         report_object.
3773         (Add_archive_symbols::run): Track argument serial numbers.
3774         (Lib_group::include_member): Likewise.
3775         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3776         * archive.h (Incremental_archive_entry::Archive_member):
3777         Initialize arg_serial_.
3778         (Archive_member::arg_serial_): New data member.
3779         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3780         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3781         incremental link.
3782         (Sized_dynobj::do_for_all_local_got_entries): New function.
3783         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3784         function.
3785         * fileread.cc (get_mtime): New function.
3786         * fileread.h (get_mtime): New function.
3787         * gold.cc (queue_initial_tasks): Check for incremental update.
3788         (process_incremental_input): New function.
3789         (queue_middle_tasks): Don't force valid target for incremental
3790         update.
3791         * incremental-dump.cc (find_input_containing_global): Adjust
3792         size of symbol info entry.
3793         (dump_incremental_inputs): Dump argument serial number and
3794         in_system_directory flag; bias shndx by 1; print symbol names
3795         when dumping per-file symbol lists; use new symbol info readers.
3796         * incremental.cc
3797         (Output_section_incremental_inputs:update_data_size): New function.
3798         (Sized_incremental_binary::setup_readers): Setup input readers
3799         for each input file; build maps for files added from libraries
3800         and scripts.
3801         (Sized_incremental_binary::check_input_args): New function.
3802         (Sized_incremental_binary::do_check_inputs): Build map of argument
3803         serial numbers to input arguments.
3804         (Sized_incremental_binary::do_file_has_changed): Rename
3805         do_file_is_unchanged to this; compare file modification times.
3806         (Sized_incremental_binary::do_init_layout): New function.
3807         (Sized_incremental_binary::do_reserve_layout): New function.
3808         (Sized_incremental_binary::do_get_input_reader): Remove.
3809         (Sized_incremental_binary::get_symtab_view): New function.
3810         (Incremental_checker::can_incrementally_link_output_file): Remove.
3811         (Incremental_inputs::report_command_line): Exclude --debug options.
3812         (Incremental_inputs::report_archive_begin): Add parameter; track
3813         argument serial numbers; don't put input file entry for archive
3814         before archive members.
3815         (Incremental_inputs::report_archive_end): Put input file entry
3816         for archive after archive members.
3817         (Incremental_inputs::report_object): Add parameter; track argument
3818         serial numbers and in_system_directory flag.
3819         (Incremental_inputs::report_script): Add parameter; track argument
3820         serial numbers.
3821         (Output_section_incremental_inputs::set_final_data_size): Adjust
3822         size of symbol info entry; check for forwarding symbols.
3823         (Output_section_incremental_inputs::write_input_files): Write
3824         in_system_directory flag and argument serial number.
3825         (Output_section_incremental_inputs::write_info_blocks): Map section
3826         indices between incremental info and original input file; store
3827         input section index for each symbol.
3828         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3829         change operator() to visit().
3830         (class Global_got_offset_visitor): Likewise.
3831         (class Global_symbol_visitor_got_plt):
3832         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3833         classes.
3834         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3835         (Sized_incr_relobj::do_read_symbols): New function.
3836         (Sized_incr_relobj::do_layout): New function.
3837         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3838         (Sized_incr_relobj::do_add_symbols): New function.
3839         (Sized_incr_relobj::do_should_include_member): New function.
3840         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3841         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3842         (Sized_incr_relobj::do_section_size): New function.
3843         (Sized_incr_relobj::do_section_name): New function.
3844         (Sized_incr_relobj::do_section_contents): New function.
3845         (Sized_incr_relobj::do_section_flags): New function.
3846         (Sized_incr_relobj::do_section_entsize): New function.
3847         (Sized_incr_relobj::do_section_address): New function.
3848         (Sized_incr_relobj::do_section_type): New function.
3849         (Sized_incr_relobj::do_section_link): New function.
3850         (Sized_incr_relobj::do_section_info): New function.
3851         (Sized_incr_relobj::do_section_addralign): New function.
3852         (Sized_incr_relobj::do_initialize_xindex): New function.
3853         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3854         (Sized_incr_relobj::do_read_relocs): New function.
3855         (Sized_incr_relobj::do_gc_process_relocs): New function.
3856         (Sized_incr_relobj::do_scan_relocs): New function.
3857         (Sized_incr_relobj::do_count_local_symbols): New function.
3858         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3859         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3860         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3861         (Sized_incr_relobj::do_relocate): New function.
3862         (Sized_incr_relobj::do_set_section_offset): New function.
3863         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3864         (Sized_incr_dynobj::do_read_symbols): New function.
3865         (Sized_incr_dynobj::do_layout): New function.
3866         (Sized_incr_dynobj::do_add_symbols): New function.
3867         (Sized_incr_dynobj::do_should_include_member): New function.
3868         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3869         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3870         (Sized_incr_dynobj::do_section_size): New function.
3871         (Sized_incr_dynobj::do_section_name): New function.
3872         (Sized_incr_dynobj::do_section_contents): New function.
3873         (Sized_incr_dynobj::do_section_flags): New function.
3874         (Sized_incr_dynobj::do_section_entsize): New function.
3875         (Sized_incr_dynobj::do_section_address): New function.
3876         (Sized_incr_dynobj::do_section_type): New function.
3877         (Sized_incr_dynobj::do_section_link): New function.
3878         (Sized_incr_dynobj::do_section_info): New function.
3879         (Sized_incr_dynobj::do_section_addralign): New function.
3880         (Sized_incr_dynobj::do_initialize_xindex): New function.
3881         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3882         (make_sized_incremental_object): New function.
3883         (Incremental_library::copy_unused_symbols): New function.
3884         (Incremental_library::do_for_all_unused_symbols): New function.
3885         * incremental.h (enum Incremental_input_flags): New type.
3886         (class Incremental_checker): Remove.
3887         (Incremental_input_entry::Incremental_input_entry): Add argument
3888         serial number.
3889         (Incremental_input_entry::arg_serial): New function.
3890         (Incremental_input_entry::set_is_in_system_directory): New function.
3891         (Incremental_input_entry::is_in_system_directory): New function.
3892         (Incremental_input_entry::arg_serial_): New data member.
3893         (Incremental_input_entry::is_in_system_directory_): New data member.
3894         (class Script_info): Move here from script.h.
3895         (Script_info::Script_info): Add filename parameter.
3896         (Script_info::filename): New function.
3897         (Script_info::filename_): New data member.
3898         (Incremental_script_entry::Incremental_script_entry): Add argument
3899         serial number.
3900         (Incremental_object_entry::Incremental_object_entry): Likewise.
3901         (Incremental_object_entry::add_input_section): Build list of input
3902         sections with map to original shndx.
3903         (Incremental_object_entry::get_input_section_index): New function.
3904         (Incremental_object_entry::shndx_): New data member.
3905         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3906         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3907         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3908         serial number.
3909         (Incremental_inputs::report_archive_begin): Likewise.
3910         (Incremental_inputs::report_object): Likewise.
3911         (Incremental_inputs::report_script): Likewise.
3912         (class Incremental_global_symbol_reader): New class.
3913         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3914         and store flags and input file type.
3915         (Incremental_input_entry_reader::arg_serial): New function.
3916         (Incremental_input_entry_reader::type): Extract type from flags.
3917         (Incremental_input_entry_reader::is_in_system_directory): New function.
3918         (Incremental_input_entry_reader::get_input_section_count): Call
3919         accessor function for type.
3920         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3921         function for type; adjust size of global symbol entry.
3922         (Incremental_input_entry_reader::get_global_symbol_count): Call
3923         accessor function for type.
3924         (Incremental_input_entry_reader::get_object_count): Likewise.
3925         (Incremental_input_entry_reader::get_object_offset): Likewise.
3926         (Incremental_input_entry_reader::get_member_count): Likewise.
3927         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3928         (Incremental_input_entry_reader::get_member_offset): Likewise.
3929         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3930         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3931         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3932         (Incremental_input_entry_reader::get_global_symbol_reader): New
3933         function.
3934         (Incremental_input_entry_reader::get_output_symbol_index): New
3935         function.
3936         (Incremental_input_entry_reader::type_): Remove.
3937         (Incremental_input_entry_reader::flags_): New data member.
3938         (Incremental_inputs_reader::input_file_offset): New function.
3939         (Incremental_inputs_reader::input_file_index): New function.
3940         (Incremental_inputs_reader::input_file): Call input_file_offset.
3941         (Incremental_inputs_reader::input_file_at_offset): New function.
3942         (Incremental_relocs_reader::get_r_type): Reformat.
3943         (Incremental_relocs_reader::get_r_shndx): Reformat.
3944         (Incremental_relocs_reader::get_r_offset): Reformat.
3945         (Incremental_relocs_reader::data): New function.
3946         (Incremental_binary::Incremental_binary): Initialize new data members.
3947         (Incremental_binary::check_inputs): Add cmdline parameter.
3948         (Incremental_binary::file_is_unchanged): Remove.
3949         (Input_reader::arg_serial): New function.
3950         (Input_reader::get_unused_symbol_count): New function.
3951         (Input_reader::get_unused_symbol): New function.
3952         (Input_reader::do_arg_serial): New function.
3953         (Input_reader::do_get_unused_symbol_count): New function.
3954         (Input_reader::do_get_unused_symbol): New function.
3955         (Incremental_binary::input_file_count): New function.
3956         (Incremental_binary::get_input_reader): Change signature to use
3957         index instead of filename.
3958         (Incremental_binary::file_has_changed): New function.
3959         (Incremental_binary::get_input_argument): New function.
3960         (Incremental_binary::get_library): New function.
3961         (Incremental_binary::get_script_info): New function.
3962         (Incremental_binary::init_layout): New function.
3963         (Incremental_binary::reserve_layout): New function.
3964         (Incremental_binary::output_file): New function.
3965         (Incremental_binary::do_check_inputs): New function.
3966         (Incremental_binary::do_file_is_unchanged): Remove.
3967         (Incremental_binary::do_file_has_changed): New function.
3968         (Incremental_binary::do_init_layout): New function.
3969         (Incremental_binary::do_reserve_layout): New function.
3970         (Incremental_binary::do_input_file_count): New function.
3971         (Incremental_binary::do_get_input_reader): Change signature.
3972         (Incremental_binary::input_args_map_): New data member.
3973         (Incremental_binary::library_map_): New data member.
3974         (Incremental_binary::script_map_): New data member.
3975         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3976         new data members.
3977         (Sized_incremental_binary::output_section): New function.
3978         (Sized_incremental_binary::inputs_reader): Add const.
3979         (Sized_incremental_binary::symtab_reader): Add const.
3980         (Sized_incremental_binary::relocs_reader): Add const.
3981         (Sized_incremental_binary::got_plt_reader): Add const.
3982         (Sized_incremental_binary::get_symtab_view): New function.
3983         (Sized_incremental_binary::Inputs_reader): New typedef.
3984         (Sized_incremental_binary::Input_entry_reader): New typedef.
3985         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3986         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3987         (Sized_incremental_binary::do_file_has_changed): New function.
3988         (Sized_incremental_binary::do_init_layout): New function.
3989         (Sized_incremental_binary::do_reserve_layout): New function.
3990         (Sized_input_reader::Inputs_reader): Remove.
3991         (Sized_input_reader::Input_entry_reader): Remove.
3992         (Sized_input_reader::do_arg_serial): New function.
3993         (Sized_input_reader::do_get_unused_symbol_count): New function.
3994         (Sized_input_reader::do_get_unused_symbol): New function.
3995         (Sized_incremental_binary::do_input_file_count): New function.
3996         (Sized_incremental_binary::do_get_input_reader): Change signature;
3997         use index instead of filename.
3998         (Sized_incremental_binary::section_map_): New data member.
3999         (Sized_incremental_binary::input_entry_readers_): New data member.
4000         (class Sized_incr_relobj): New class.
4001         (class Sized_incr_dynobj): New class.
4002         (make_sized_incremental_object): New function.
4003         (class Incremental_library): New class.
4004         * layout.cc (Free_list::num_lists): New static data member.
4005         (Free_list::num_nodes): New static data member.
4006         (Free_list::num_removes): New static data member.
4007         (Free_list::num_remove_visits): New static data member.
4008         (Free_list::num_allocates): New static data member.
4009         (Free_list::num_allocate_visits): New static data member.
4010         (Free_list::init): New function.
4011         (Free_list::remove): New function.
4012         (Free_list::allocate): New function.
4013         (Free_list::dump): New function.
4014         (Free_list::print_stats): New function.
4015         (Layout_task_runner::run): Resize output file for incremental updates.
4016         (Layout::Layout): Initialize new data members.
4017         (Layout::set_incremental_base): New function.
4018         (Layout::init_fixed_output_section): New function.
4019         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4020         incremental updates.
4021         (Layout::create_gold_note): Do not create gold note section for
4022         incremental updates.
4023         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4024         for incremental updates.
4025         (Layout::set_section_offsets): For incremental updates, allocate space
4026         from free list.
4027         (Layout::create_symtab_sections): Layout with offsets relative to
4028         start of section; for incremental updates, allocate space from free
4029         list.
4030         (Layout::create_shdrs): For incremental updates, allocate space from
4031         free list.
4032         (Layout::finish_dynamic_section): For incremental updates, do not
4033         check --as-needed (fixed in subsequent patch).
4034         * layout.h (class Free_list): New class.
4035         (Layout::set_incremental_base): New function.
4036         (Layout::incremental_base): New function.
4037         (Layout::init_fixed_output_section): New function.
4038         (Layout::allocate): New function.
4039         (Layout::incremental_base_): New data member.
4040         (Layout::free_list_): New data member.
4041         * main.cc (main): Print Free_list statistics.
4042         * object.cc (Relobj::finalize_incremental_relocs): Add
4043         clear_counts parameter; clear counts only when clear_counts is set.
4044         (Sized_relobj::Sized_relobj): Initialize new base class.
4045         (Sized_relobj::do_layout): Don't report special sections.
4046         (Sized_relobj::do_for_all_local_got_entries): New function.
4047         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4048         symtab_off to all symbol table offsets.
4049         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4050         * object.h (class Got_offset_list): Move to top of file.
4051         (Object::Object): Allow case where input_file == NULL.
4052         (Object::~Object): Likewise.
4053         (Object::input_file): Assert that input_file != NULL.
4054         (Object::lock): Allow case where input_file == NULL.
4055         (Object::unlock): Likewise.
4056         (Object::is_locked): Likewise.
4057         (Object::token): Likewise.
4058         (Object::release): Likewise.
4059         (Object::is_incremental): New function.
4060         (Object::get_mtime): New function.
4061         (Object::for_all_local_got_entries): New function.
4062         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4063         (Object::set_is_in_system_directory): New function.
4064         (Object::is_in_system_directory): New function.
4065         (Object::do_is_incremental): New function.
4066         (Object::do_get_mtime): New function.
4067         (Object::do_for_all_local_got_entries): New function.
4068         (Object::is_in_system_directory_): New data member.
4069         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4070         (class Sized_relobj_base): New class.
4071         (class Sized_relobj): Derive from Sized_relobj_base.
4072         (class Sized_relobj::Symbols): Redeclare from base class.
4073         (class Sized_relobj::local_got_offset_list): Remove.
4074         (class Sized_relobj::Output_sections): Redeclare from base class.
4075         (class Sized_relobj::do_for_all_local_got_entries): New function.
4076         (class Sized_relobj::write_local_symbols): Add offset parameter.
4077         (class Sized_relobj::local_symbol_offset_): Update comment.
4078         (class Sized_relobj::local_dynsym_offset_): Update comment.
4079         * options.cc (Input_arguments::add_file): Remove const.
4080         * options.h (Input_file_argument::Input_file_argument):
4081         Initialize arg_serial_ (all constructors).
4082         (Input_file_argument::set_arg_serial): New function.
4083         (Input_file_argument::arg_serial): New function.
4084         (Input_file_argument::arg_serial_): New data member.
4085         (Input_arguments::Input_arguments): Initialize file_count_.
4086         (Input_arguments::add_file): Remove const.
4087         (Input_arguments::number_of_input_files): New function.
4088         (Input_arguments::file_count_): New data member.
4089         (Command_line::number_of_input_files): Call
4090         Input_arguments::number_of_input_files.
4091         * output.cc (Output_segment_headers::Output_segment_headers):
4092         Set current size.
4093         (Output_section::Input_section::current_data_size): New function.
4094         (Output_section::Output_section): Initialize new data members.
4095         (Output_section::add_input_section): Don't do merge sections for
4096         an incremental link; allocate space from free list for an
4097         incremental update.
4098         (Output_section::add_output_section_data): Allocate space from
4099         free list for an incremental update.
4100         (Output_section::update_data_size): New function.
4101         (Output_section::set_fixed_layout): New function.
4102         (Output_section::reserve): New function.
4103         (Output_segment::set_section_addresses): Remove const.
4104         (Output_segment::set_section_list_addresses): Remove const; allocate
4105         space from free list for an incremental update.
4106         (Output_segment::set_offset): Adjust size of RELRO segment for an
4107         incremental update.
4108         * output.h (Output_data::current_data_size): Move here from
4109         child classes.
4110         (Output_data::pre_finalize_data_size): New function.
4111         (Output_data::update_data_size): New function.
4112         (Output_section_headers::update_data_size): new function.
4113         (Output_section_data_build::current_data_size): Move to Output_data.
4114         (Output_data_strtab::update_data_size): New function.
4115         (Output_section::current_data_size): Move to Output_data.
4116         (Output_section::set_fixed_layout): New function.
4117         (Output_section::has_fixed_layout): New function.
4118         (Output_section::reserve): New function.
4119         (Output_section::update_data_size): New function.
4120         (Output_section::has_fixed_layout_): New data member.
4121         (Output_section::free_list_): New data member.
4122         (Output_segment::set_section_addresses): Remove const.
4123         (Output_segment::set_section_list_addresses): Remove const.
4124         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4125         New function.
4126         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4127         New function.
4128         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4129         parameter when calling Add_symbols constructor; store argument
4130         serial number for members of a lib group.
4131         (Add_symbols::locks): Allow case where token == NULL.
4132         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4133         (Read_member::~Read_member): New function.
4134         (Read_member::is_runnable): New function.
4135         (Read_member::locks): New function.
4136         (Read_member::run): New function.
4137         (Check_script::~Check_script): New function.
4138         (Check_script::is_runnable): New function.
4139         (Check_script::locks): New function.
4140         (Check_script::run): New function.
4141         (Check_library::~Check_library): New function.
4142         (Check_library::is_runnable): New function.
4143         (Check_library::locks): New function.
4144         (Check_library::run): New function.
4145         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4146         (Add_symbols::library_): New data member.
4147         (class Read_member): New class.
4148         (class Check_script): New class.
4149         (class Check_library): New class.
4150         * reloc.cc (Read_relocs::is_runnable): Allow case where
4151         token == NULL.
4152         (Read_relocs::locks): Likewise.
4153         (Scan_relocs::locks): Likewise.
4154         (Relocate_task::locks): Likewise.
4155         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4156         to clear counters.
4157         (Sized_relobj::incremental_relocs_scan): Fix comment.
4158         (Sized_relobj::do_relocate): Pass output file offset to
4159         write_local_symbols.
4160         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4161         from class declaration.
4162         * script.cc (read_input_script): Allocate Script_info; pass
4163         argument serial number to report_script.
4164         * script.h (class Script_info): Move to incremental.h.
4165         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4166         * symtab.h (Symbol_table::add_from_incrobj): New function.
4167         (Symbol_table::set_file_offset): New function.
4168
4169 2011-04-05  Cary Coutant  <ccoutant@google.com>
4170
4171         * incremental-dump.cc (dump_incremental_inputs): Change signature
4172         to take a Sized_incremental_binary; change caller.  Use readers
4173         in Sized_incremental_binary.
4174         * incremental.cc
4175         (Sized_incremental_binary::find_incremental_inputs_sections):
4176         Rename do_find_incremental_inputs_sections to this.
4177         (Sized_incremental_binary::setup_readers): New function.
4178         (Sized_incremental_binary::do_check_inputs): Check
4179         has_incremental_info_ flag; move setup code to setup_readers;
4180         use input readers.
4181         (Sized_incremental_binary::do_file_is_unchanged): New function.
4182         (Sized_incremental_binary::do_get_input_reader): New function.
4183         * incremental.h (class Incremental_binary): Move to end of file.
4184         (Incremental_binary::file_is_unchanged): New function.
4185         (Incremental_binary::do_file_is_unchanged): New function.
4186         (Incremental_binary::Input_reader): New class.
4187         (Incremental_binary::get_input_reader): New function.
4188         (class Sized_incremental_binary): Move to end of file.
4189         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4190         input section reader classes.
4191         (Sized_incremental_binary::has_incremental_info): New function.
4192         (Sized_incremental_binary::inputs_reader): New function.
4193         (Sized_incremental_binary::symtab_reader): New function.
4194         (Sized_incremental_binary::relocs_reader): New function.
4195         (Sized_incremental_binary::got_plt_reader): New function.
4196         (Sized_incremental_binary::do_file_is_unchanged): New function.
4197         (Sized_incremental_binary::Sized_input_reader): New class.
4198         (Sized_incremental_binary::get_input_reader): New function.
4199         (Sized_incremental_binary::find_incremental_inputs_sections):
4200         Rename do_find_incremental_inputs_sections to this.
4201         (Sized_incremental_binary::setup_readers): New function.
4202         (Sized_incremental_binary::has_incremental_info_): New data member.
4203         (Sized_incremental_binary::inputs_reader_): New data member.
4204         (Sized_incremental_binary::symtab_reader_): New data member.
4205         (Sized_incremental_binary::relocs_reader_): New data member.
4206         (Sized_incremental_binary::got_plt_reader_): New data member.
4207         (Sized_incremental_binary::current_input_file_): New data member.
4208
4209 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4210
4211         PR gold/12640
4212         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4213         violation.
4214
4215 2011-03-30  Cary Coutant  <ccoutant@google.com>
4216
4217         * archive.cc (Archive::include_member): Adjust call to report_object.
4218         (Add_archive_symbols::run): Add script_info to call to
4219         report_archive_begin.
4220         (Lib_group::include_member): Adjust call to report_object.
4221         (Add_lib_group_symbols::run): Adjust call to report_object.
4222         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4223         blocks.  Add object count for script input files.
4224         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4225         script_info parameter; change all callers.
4226         (Incremental_inputs::report_object): Add script_info parameter;
4227         change all callers.
4228         (Incremental_inputs::report_script): Store backpointer to
4229         incremental info entry.
4230         (Output_section_incremental_inputs::set_final_data_size): Record
4231         additional information for scripts.
4232         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4233         * incremental.h (Incremental_script_entry::add_object): New function.
4234         (Incremental_script_entry::get_object_count): New function.
4235         (Incremental_script_entry::get_object): New function.
4236         (Incremental_script_entry::objects_): New data member; adjust
4237         constructor.
4238         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4239         (Incremental_inputs::report_object): Add script_info parameter.
4240         (Incremental_inputs_reader::get_object_count): New function.
4241         (Incremental_inputs_reader::get_object_offset): New function.
4242         * options.cc (Input_arguments::add_file): Return reference to
4243         new input argument.
4244         * options.h (Input_argument::set_script_info): New function.
4245         (Input_argument::script_info): New function.
4246         (Input_argument::script_info_): New data member; adjust all
4247         constructors.
4248         (Input_file_group::add_file): Return reference to new input argument.
4249         (Input_file_lib::add_file): Likewise.
4250         (Input_arguments::add_file): Likewise.
4251         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4252         * script.cc (Parser_closure::Parser_closure): Add script_info
4253         parameter; adjust all callers.
4254         (Parser_closure::script_info): New function.
4255         (Parser_closure::script_info_): New data member.
4256         (read_input_script): Report scripts earlier to incremental info.
4257         (script_add_file): Set script_info in Input_argument.
4258         (script_add_library): Likewise.
4259         * script.h (Script_options::Script_info): Rewrite class.
4260
4261 2011-03-29  Cary Coutant  <ccoutant@google.com>
4262
4263         * archive.cc (Library_base::should_include_member): Move
4264         method here from class Archive.
4265         (Archive::Archive): Initialize base class.
4266         (Archive::should_include_member): Move to base class.
4267         (Archive::do_for_all_unused_symbols): New function.
4268         (Add_archive_symbols::run): Remove redundant access to
4269         incremental_inputs.
4270         (Lib_group::Lib_group): Initialize base class.
4271         (Lib_group::do_filename): New function.
4272         (Lib_group::include_member): Pass pointer to Lib_group to
4273         report_object.
4274         (Lib_group::do_for_all_unused_symbols): New function.
4275         (Add_lib_group_symbols::run): Report archive information for
4276         incremental links.
4277         * archive.h (class Library_base): New base class.
4278         (class Archive): Derive from Library_base.
4279         (Archive::filename): Move to base class.
4280         (Archive::set_incremental_info): Likewise.
4281         (Archive::incremental_info): Likewise.
4282         (Archive::Should_include): Likewise.
4283         (Archive::should_include_member): Likewise.
4284         (Archive::Armap_entry): Remove.
4285         (Archive::Unused_symbol_iterator): Remove.
4286         (Archive::unused_symbols_begin): Remove.
4287         (Archive::unused_symbols_end): Remove.
4288         (Archive::do_filename): New function.
4289         (Archive::do_get_mtime): New function.
4290         (Archive::do_for_all_unused_symbols): New function.
4291         (Archive::task_): Move to base class.
4292         (Archive::incremental_info_): Likewise.
4293         (class Lib_group): Derive from Library_base.
4294         (Lib_group::do_filename): New function.
4295         (Lib_group::do_get_mtime): New function.
4296         (Lib_group::do_for_all_unused_symbols): New function.
4297         (Lib_group::task_): Move to base class.
4298         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4299         function.
4300         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4301         function.
4302         * incremental.cc (Incremental_inputs::report_archive_begin):
4303         Use Library_base; call library's get_mtime; add incremental inputs
4304         entry before members.
4305         (class Unused_symbol_visitor): New class.
4306         (Incremental_inputs::report_archive_end): Use Library_base; use
4307         visitor class to record unused symbols; don't add incremental inputs
4308         entry after members.
4309         (Incremental_inputs::report_object): Use Library_base.
4310         * incremental.h
4311         (Incremental_archive_entry::Incremental_archive_entry): Remove
4312         unused Archive parameter.
4313         (Incremental_inputs::report_archive_begin): Use Library_base.
4314         (Incremental_inputs::report_archive_end): Likewise.
4315         (Incremental_inputs::report_object): Likewise.
4316         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4317         function.
4318         * object.h (Object::for_all_global_symbols): New function.
4319         (Object::do_for_all_global_symbols): New function.
4320         (Sized_relobj::do_for_all_global_symbols): New function.
4321         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4322         function.
4323         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4324         function.
4325
4326 2011-03-27  Ian Lance Taylor  <iant@google.com>
4327
4328         * archive.cc (Archive::interpret_header): Return -1 if something
4329         goes wrong.  Change callers accordingly.
4330
4331 2011-03-25  Cary Coutant  <ccoutant@google.com>
4332
4333         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4334         * testsuite/Makefile.in: Regenerate.
4335
4336 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4337
4338         * plugin.cc (get_view): New.
4339         (Plugin::load): Pass get_view to the plugin.
4340         (Plugin_manager::get_view): New.
4341
4342 2011-03-21  Ian Lance Taylor  <iant@google.com>
4343
4344         * testsuite/final_layout.sh: Rewrite to not use dc.
4345         * testsuite/relro_test.sh: Fail if dc is not present.
4346
4347 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4348
4349         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4350         Change == to -eq.
4351         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4352         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4353         Change == to -eq.
4354         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4355         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4356
4357 2011-03-14  Ian Lance Taylor  <iant@google.com>
4358
4359         * script-sections.cc (Sort_output_sections::script_compare):
4360         Rename from is_before, change return type.
4361         (Sort_output_sections::operator()): Adjust accordingly.
4362
4363 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4364
4365         PR gold/12572
4366         * testsuite/odr_violation2.cc: Add comment to make all error line
4367         numbers double digits.
4368         * testsuite/debug_msg.sh: Adjust expected errors.
4369
4370 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4371
4372         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4373         but mark earlier ones as non-canonical
4374         (offset_to_iterator): Update search target and example
4375         (do_addr2line): Return extra lines in a vector*
4376         (format_file_lineno): Extract from do_addr2line
4377         (one_addr2line): Add vector* out-param
4378         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4379         when a lineno entry appeared last for its instruction
4380         (Dwarf_line_info): Add vector* out-param
4381         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4382         * symtab.cc (Odr_violation_compare): Include the lineno in the
4383         comparison again.
4384         (linenos_from_loc): New. Combine the canonical line for an
4385         address with its other lines.
4386         (True_if_intersect): New. Helper functor to make
4387         std::set_intersection a query.
4388         (detect_odr_violations): Compare sets of lines instead of just
4389         one line for each function. This became less deterministic, but
4390         has fewer false positives.
4391         * symtab.h: Declarations.
4392         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4393         mix an optimized and non-optimized object in the same binary
4394         (odr_violation2.so): Same.
4395         * testsuite/Makefile.in: Regenerate from Makefile.am.
4396         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4397         * testsuite/debug_msg.sh: Update line numbers and add
4398         assertions.
4399         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4400         non-optimized context.
4401         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4402         isn't inlined, and use OdrDerived in an optimized context.
4403         * testsuite/odr_header1.h: Defines OdrDerived, where
4404         optimization will change the
4405         first-instruction-in-the-destructor's file and line number.
4406         * testsuite/odr_header2.h: Defines OdrBase.
4407
4408 2011-03-09  Ian Lance Taylor  <iant@google.com>
4409
4410         * fileread.cc (File_read::clear_views): Don't delete the whole
4411         file view.
4412
4413 2011-03-08  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12525
4416         * fileread.cc: #include <climits>.
4417         (GOLD_IOV_MAX): Define.
4418         (File_read::read_multiple): Limit number of entries by iov_max.
4419         * fileread.h (class File_read): Always set max_readv_entries to
4420         128.
4421
4422 2011-03-07  Ian Lance Taylor  <iant@google.com>
4423
4424         PR gold/12525
4425         * options.h (class General_options): Add -dy and -dn.
4426
4427 2011-03-02  Cary Coutant  <ccoutant@google.com>
4428
4429         * testsuite/script_test_9.t: Add TLS segment.
4430
4431 2011-03-02  Simon Baldwin  <simonb@google.com>
4432
4433         * configure.ac: Add check for gnu_indirect_function support in
4434         the toolchain building binutils.
4435         * configure: Rebuild.
4436
4437 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4438
4439         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4440         plugin only symbols.
4441         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4442         in plugin files as not needed in the symbol table.
4443
4444 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4445
4446         * output.cc (Output_section::add_input_section): Delay fill
4447         generation for section ordering.
4448
4449 2011-02-09  Ian Lance Taylor  <iant@google.com>
4450
4451         PR gold/12316
4452         * object.h (class Sized_relobj): Remove clear_local_symbols.
4453         * reloc.cc (Sized_relobj::do_relocate): Don't call
4454         clear_local_symbols.
4455
4456 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4457
4458         * plugin.cc (is_visible_from_outside): Return true for symbols
4459         in the -u option.
4460
4461 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4462
4463         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4464         filename.
4465
4466 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4467
4468         * icf.h (is_section_foldable_candidate): Change type of parameter
4469         to std::string.
4470         * icf.cc (Icf::find_identical_sections): Change type of local variable
4471         section_name to be std::string.
4472         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4473
4474 2011-01-25  Ian Lance Taylor  <iant@google.com>
4475
4476         * script.cc (script_add_extern): Rewrite to use
4477         add_symbol_reference.
4478
4479 2011-01-25  Doug Kwan  <dougkwan@google.com>
4480
4481         * icf.cc (get_section_contents): Always lock section's object.
4482
4483 2011-01-24  Ian Lance Taylor  <iant@google.com>
4484
4485         * options.h (class General_options): Accept
4486         --no-detect-odr-violations.
4487
4488 2011-01-24  Ian Lance Taylor  <iant@google.com>
4489
4490         * version.cc (version_string): Bump to 1.11.
4491
4492 2011-01-24  Ian Lance Taylor  <iant@google.com>
4493
4494         * plugin.cc (class Plugin_rescan): Define new class.
4495         (Plugin_manager::claim_file): Set any_claimed_.
4496         (Plugin_manager::save_archive): New function.
4497         (Plugin_manager::save_input_group): New function.
4498         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4499         necessary.
4500         (Plugin_manager::new_undefined_symbol): New function.
4501         (Plugin_manager::rescan): New function.
4502         (Plugin_manager::rescannable_defines): New function.
4503         (Plugin_manager::add_input_file): Set any_added_.
4504         * plugin.h (class Plugin_manager): define new fields rescannable_,
4505         undefined_symbols_, any_claimed_, and any_added_.  Declare
4506         Plugin_rescan as friend.  Declare new functions.
4507         (Plugin_manager::Rescannable): Define type.
4508         (Plugin_manager::Rescannable_list): Define type.
4509         (Plugin_manager::Undefined_symbol_list): Define type.
4510         (Plugin_manager::Plugin_manager): Initialize new fields.
4511         * archive.cc (Archive::defines_symbol): New function.
4512         (Add_archive_symbols::run): Pass archive to plugins if any.
4513         * archive.h (class Archive): Declare defines_symbol.
4514         * readsyms.cc (Input_group::~Input_group): New function.
4515         (Finish_group::run): Pass input_group to plugins if any.
4516         * readsyms.h (class Input_group): Declare destructor.
4517         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4518         any.
4519
4520 2011-01-10  Ian Lance Taylor  <iant@google.com>
4521
4522         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4523         section as relro.
4524         (Layout::set_segment_offsets): Reset increase_relro before calling
4525         set_section_addresses a second time.
4526
4527 2011-01-04  Cary Coutant  <ccoutant@google.com>
4528
4529         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4530         sections before NOBITS sections.
4531
4532 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4533
4534         * version.cc (print_version): Update copyright to 2011.
4535
4536 2010-12-23  Cary Coutant  <ccoutant@google.com>
4537
4538         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4539         of OS to this->add.  Add OD parameter to second form of the function.
4540
4541 2010-12-20  Ian Lance Taylor  <iant@google.com>
4542
4543         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4544         second of two consecutive entries with same offset.
4545
4546 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4547
4548         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4549         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4550         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4551         to avoid unneeded links against $(LDADD).
4552         * testsuite/Makefile.in: Regenerate.
4553
4554 2010-12-15  Ian Lance Taylor  <iant@google.com>
4555
4556         PR gold/12324
4557         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4558         for R_X86_64_32 and R_X86_64_PC32.
4559         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4560         ver_matching_def_pic.o.
4561         (ver_matching_def_pic.o): New target.
4562
4563 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4564
4565         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4566         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4567         Move definition before File_read::View member definitions.
4568         (File_read::View::~View): Initialize and hold lock before
4569         updating current_mapped_bytes.
4570
4571 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4572
4573         * dwarf_reader.cc: Remove outdated comment.
4574         * gold-threads.cc: Fix typo in error message.
4575         * archive.cc: Fix typos in comments.
4576         * archive.h: Likewise.
4577         * arm-reloc-property.cc: Likewise.
4578         * arm-reloc-property.h: Likewise.
4579         * arm-reloc.def: Likewise.
4580         * arm.cc: Likewise.
4581         * attributes.h: Likewise.
4582         * cref.cc: Likewise.
4583         * ehframe.cc: Likewise.
4584         * fileread.h: Likewise.
4585         * gold.h: Likewise.
4586         * i386.cc: Likewise.
4587         * icf.cc: Likewise.
4588         * incremental.h: Likewise.
4589         * int_encoding.cc: Likewise.
4590         * layout.h: Likewise.
4591         * main.cc: Likewise.
4592         * merge.h: Likewise.
4593         * object.cc: Likewise.
4594         * object.h: Likewise.
4595         * options.cc: Likewise.
4596         * readsyms.cc: Likewise.
4597         * reduced_debug_output.cc: Likewise.
4598         * reloc.cc: Likewise.
4599         * script-sections.cc: Likewise.
4600         * sparc.cc: Likewise.
4601         * symtab.h: Likewise.
4602         * target-reloc.h: Likewise.
4603         * target.cc: Likewise.
4604         * target.h: Likewise.
4605         * timer.cc: Likewise.
4606         * timer.h: Likewise.
4607         * x86_64.cc: Likewise.
4608
4609 2010-12-09  Cary Coutant  <ccoutant@google.com>
4610
4611         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4612         stack.
4613         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4614         parameter; change all callers.
4615         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4616         * options.h (warn_execstack): New option.
4617
4618 2010-12-07  Doug Kwan  <dougkwan@google.com>
4619
4620         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4621         like function call relocations.
4622
4623 2010-12-07  Ian Lance Taylor  <iant@google.com>
4624
4625         * archive.cc (Archive::get_elf_object_for_member): Permit
4626         punconfigured to be NULL.
4627         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4628         (Archive::include_member): Pass NULL to get_elf_object_for_member
4629         if we searched for the archive and this is the first included
4630         object.
4631
4632 2010-12-01  Ian Lance Taylor  <iant@google.com>
4633
4634         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4635         track_relocs_type_ field.
4636         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4637         Set track_relocs_type_.
4638         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4639         contents when using RELA relocs.
4640         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4641         reloc_map_.
4642         * reloc.cc (Track_relocs::next_addend): New function.
4643         * reloc.h (class Track_relocs): Declare next_addend.
4644
4645 2010-12-01  Ian Lance Taylor  <iant@google.com>
4646
4647         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4648         virtual destructor.
4649
4650 2010-12-01  Ian Lance Taylor  <iant@google.com>
4651
4652         * README: Update compilers known to work and fail.
4653
4654 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4655
4656         * configure.in: For --enable-gold, handle value `default' instead of
4657         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4658         not the default.
4659         * configure: Regenerate.
4660
4661 2010-11-18  Doug Kwan  <dougkwan@google.com>
4662
4663         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4664         and right_alignment to be zero.  Store result alignment only if it is
4665         greater than existing alignment.
4666
4667 2010-11-16  Cary Coutant  <ccoutant@google.com>
4668
4669         PR gold/12220
4670         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4671         Check for ".zdebug_line".
4672
4673 2010-11-16  Doug Kwan  <dougkwan@google.com>
4674             Cary Coutant  <ccoutant@google.com>
4675
4676         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4677         by reference; adjust all callers.
4678         * output.cc (Output_segment::set_section_addresses): Adjust references
4679         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4680         list is empty.
4681         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4682         end at page boundary.
4683
4684 2010-11-16  Cary Coutant  <ccoutant@google.com>
4685
4686         PR gold/12220
4687         * layout.cc (Layout::choose_output_section): Transform names of
4688         compressed sections even when using a script with a SECTIONS clause.
4689         (Layout::output_section_name): Remove code to transform
4690         compressed debug section names.
4691         * output.cc (Output_section::add_input_section): Use uncompressed
4692         section size when tracking input sections.
4693
4694 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4695
4696         * symtab.h (Symbol::NON_PIC_REF): Remove.
4697         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4698         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4699         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4700         (Symbol::use_plt_offset): Take a flags argument and pass it
4701         directly to needs_dynamic_reloc.  Restrict check for undefined
4702         weak symbols to function calls.
4703         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4704         (Target_arm::Scan::global): Use it.
4705         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4706         (Target_arm::Relocate::relocate): Likewise.
4707         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4708         parameter with an r_type parameter.  Use get_reference_flags
4709         to get the flags.
4710         (Target_arm::Relocate::relocate): Update accordingly.
4711         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4712         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4713         (Target_i386::Scan::global): Likewise.
4714         (Target_i386::Relocate::relocate): Likewise.
4715         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4716         parameter with an r_type parameter.  Use get_reference_flags
4717         to get the flags.
4718         (Target_i386::Relocate::relocate): Update accordingly.
4719         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4720         (Target_powerpc::Scan::global): Use it.
4721         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4722         (Target_powerpc::Relocate::relocate): Likewise.
4723         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4724         (Target_sparc::Scan::global): Use it.
4725         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4726         (Target_sparc::Relocate::relocate): Likewise.
4727         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4728         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4729         (Target_x86_64::Scan::global): Likewise.
4730         (Target_x86_64::Relocate::relocate): Likewise.
4731
4732 2010-11-08  Doug Kwan  <dougkwan@google.com>
4733             Cary Coutant  <ccoutant@google.com>
4734
4735         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4736         (Arm_exidx_merge_section::section_contents_): New data member.
4737         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4738         (Arm_input_section::~Arm_input_section): De-allocate memory.
4739         (Arm_input_section::original_contents_): New data member.
4740         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4741         in parameters instead of calling Object::section_contents without
4742         locking.
4743         (Arm_output_section::group_section): New parameter TASK.  Pass it
4744         to callees that need locking objects.
4745         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4746         to lock EXIDX input sections.  Fix a formatting issue.  Call
4747         Arm_exidx_merged_section::build_contents to create merged section
4748         contents.
4749         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4750         to lock object of stub table owner.
4751         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4752         TEXT_SIZE to initialize data member TEXT_SIZE_.
4753         (Arm_exidx_input_section::addralign): Fix typo in comment.
4754         (Arm_exidx_input_section::text_size): New method.
4755         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4756         that require locking objects.  Lock objects before scanning for stubs
4757         and updating local symbols.
4758         (Arm_input_section<big_endian>::init): Copy contents of original
4759         input section.
4760         (Arm_input_section<big_endian>::do_write): Use saved contents of
4761         original input section instead of calling Object::section_contents
4762         without locking.
4763         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4764         size without calling Object::section_size().
4765         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4766         for size.  Allocate a buffer for merged EXIDX entries.
4767         (Arm_exidx_merged_section::build_contents): New method.
4768         (Arm_exidx_merged_section::do_write): Move merge section contents
4769         building code to Arm_exidx_merged_section::build_contetns.  Write
4770         out contetns in buffer instead of building it on the fly.
4771         (Arm_relobj::make_exidx_input_section): Also pass text section size
4772         to Arm_exidx_input_section constructor.
4773         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4774         (Arm_dynobj::do_read_symbols): Fix memory leak.
4775         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4776         * target.h: (class Task): Add forward declaration.
4777         (Target::relax): Add new parameter TASK and pass it to
4778         Target::do_relax().
4779         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4780
4781 2010-11-05  Cary Coutant  <ccoutant@google.com>
4782
4783         PR gold/10708
4784         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4785         object when reading from the file.
4786         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4787         second layout pass.
4788         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4789         when reading section contents.
4790         (get_section_contents): Likewise.
4791         (icf::find_identical_sections): Likewise.
4792         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4793         object when reading from the file.
4794         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4795         the object when doing deferred section layout.
4796
4797 2010-11-03  Nick Clifton  <nickc@redhat.com>
4798
4799         PR gold/12001
4800         * script.h (class Symbol_assignment: name): New member.  Returns
4801         the name of the symbol.
4802         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4803         Returns true if the given symbol name is on the list of
4804         assignments wating to be processed.
4805         * archive.cc (should_incldue_member): If the symbol is undefined,
4806         check to see if it is on the list of symbols pending assignment.
4807
4808 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4809
4810         * script-sections.cc (Script_sections::find_memory_region): Check
4811         for a NULL output section pointer.
4812
4813 2010-10-29  Doug Kwan  <dougkwan@google.com>
4814
4815         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4816         Output_section::add_relaxed_input_section.
4817         * output.cc (Output_section::add_relaxed_input_section): Add new
4818         arguments LAYOUT and NAME.  Set section order index.
4819         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4820         Copy section order index.
4821         * output.h (Output_section::add_relaxed_input_section): Add new
4822         arguments LAYOUT and NAME.
4823
4824 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4825
4826         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4827         NATIVE_OR_CROSS_LINKER.
4828         * testsuite/Makefile.in: Regenerate.
4829
4830 2010-10-20  Doug Kwan  <dougkwan@google.com>
4831
4832         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4833         without SHF_LINK_ORDER flags.
4834         * layout.cc (Layout::choose_output_section): Do not filter
4835         SHF_LINK_ORDER flag in a relocatable link.
4836
4837 2010-10-17  Cary Coutant  <ccoutant@google.com>
4838
4839         * output.h (Output_segment::set_section_addresses): Change function
4840         signature.  Update all callers.
4841         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4842         sections.
4843         (Output_segment::set_section_addresses): Align after last TLS
4844         section.  Add padding before last relro section instead of after.
4845
4846 2010-10-17  Doug Kwan  <dougkwan@google.com>
4847
4848         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4849         GOT output section to be writable.
4850
4851 2010-10-14  Cary Coutant  <ccoutant@google.com>
4852
4853         * debug.h (DEBUG_INCREMENTAL): New flag.
4854         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4855         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4856         mode.
4857         * incremental.cc (report_command_line): Ignore all forms of
4858         --incremental.
4859         * layout.cc (Layout::Layout): Check parameters for incremental link
4860         mode.
4861         * options.cc (General_options::parse_incremental): New function.
4862         (General_options::parse_no_incremental): New function.
4863         (General_options::parse_incremental_full): New function.
4864         (General_options::parse_incremental_update): New function.
4865         (General_options::incremental_mode_): New data member.
4866         (General_options::finalize): Check incremental_mode_.
4867         * options.h (General_options): Update help text for --incremental.
4868         Add --no-incremental, --incremental-full, --incremental-update.
4869         (General_options::Incremental_mode): New enum type.
4870         (General_options::incremental_mode): New function.
4871         (General_options::incremental_mode_): New data member.
4872         * parameters.cc (Parameters::incremental_mode_): New data member.
4873         (Parameters::set_options): Set incremental_mode_.
4874         (Parameters::set_incremental_full): New function.
4875         (Parameters::incremental): New function.
4876         (Parameters::incremental_update): New function.
4877         (set_parameters_incremental_full): New function.
4878         * parameters.h (Parameters::set_incremental_full): New function.
4879         (Parameters::incremental): New function.
4880         (Parameters::incremental_update): New function.
4881         (Parameters::incremental_mode_): New data member.
4882         (set_parameters_incremental_full): New function.
4883         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4884         incremental link mode.
4885         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4886         (Sized_relobj::do_relocate_sections): Likewise.
4887         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4888         option.
4889         * testsuite/Makefile.in: Regenerate.
4890         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4891
4892 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4893
4894         * script-sections.h (class Script_sections): Make
4895         Sections_elements typedef public.
4896         * script-sections.cc (class Sort_output_sections): Add elements_
4897         field.  Add constructor which sets it; change all callers.
4898         (Sort_output_sections::is_before): New function.
4899         (Sort_output_sections::operator()): Call is_before.
4900         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4901         conditional.
4902         * testsuite/script_test_10.sh: New test. Test script section
4903         order.
4904         * testsuite/script_test_10.t: Likewise.
4905         * testsuite/script_test_10.s: Likewise.
4906         * testsuite/Makefile.am: Wrap the cross linker tests and the
4907         common tests into NATIVE_OR_CROSS_LINKER.
4908         (check_SCRIPTS): Add script_test_10.sh.
4909         (check_DATA): Add script_test_10.stdout.
4910         (script_test_10.o, script_test_10): New targets.
4911         (script_test_10.stdout): New target.
4912         * configure, testsuite/Makefile.in: Regenerate.
4913
4914 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4915
4916         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4917         error for the deprecated relocations.
4918         (Target_arm::Scan::global): Likewise.
4919         (Target_arm::Relocate::relocate): Likewise.
4920
4921 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4922
4923         * fileread.cc (Input_file::find_file): Initialize *found_name
4924         and *namep when using the fallback search for case 4.
4925
4926 2010-10-11  Cary Coutant  <ccoutant@google.com>
4927
4928         * options.h (class General_options): Redefine -z lazy as an alias for
4929         the negation of -z now.
4930
4931 2010-10-11  Ian Lance Taylor  <iant@google.com>
4932
4933         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4934         binding.
4935
4936 2010-10-06  Nick Clifton  <nickc@redhat.com>
4937
4938         * script-sections.cc(class Memory_region): Remove
4939         current_lma_offset_ field.  Rename current_vma_offset_ to
4940         current_offset_.  Add last_section_ field.
4941         (Memory_region::get_current_vma_address): Rename to
4942         get_current_address.
4943         (Memory_region::get_current_lma_address): Delete.
4944         (Memory_region::increment_vma_offset): Rename to
4945         increment_offset.
4946         (Memory_region::increment_lma_offset): Delete.
4947         (Memory_region::attributes_compatible): New method.  Returns
4948         true if the provided section is compatible with the region.
4949         (Memory_region::get_last_section): New method.  Returns the last
4950         section to use the region.
4951         (Memory_region::set_last_section): New method.  Stores the last
4952         section to use the region.
4953         (Script_sections::block_in_region): New method.  Returns true if
4954         a block of memory is contained within a region.
4955         (Script_sections::find_memory_region): New method.  Locates a
4956         memory region to be used to set a VMA or LMA address.
4957         (Output_section_definition::set_section_addresses): Add code to
4958         check for addresses set by memory regions.
4959         (Output_segment::set_section_addresses): Remove memory region
4960         walking code.
4961         (Script_sections::create_segment): Add a warning if a header
4962         segment is created outside of any region.
4963         * script-sections.h (class Script_sections): Add prototypes for
4964         find_memory_region and block_in_region methods.
4965         * testsuite/memory_test.s: Use .long instead of .word.
4966         * testsuite/memory_test.t: Add some more output sections.
4967         * testsuite/memory_test.sh: Update expected output.
4968
4969 2010-10-02  Doug Kwan  <dougkwan@google.com>
4970
4971         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4972         defintion to symtab.h
4973         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4974         declaration to defintion.
4975
4976 2010-10-01  Nick Clifton  <nickc@redhat.com>
4977
4978         * expression.cc (eval): Replace dummy argument with NULL.
4979         (eval_maybe_dot): Check for a NULL result section pointer.
4980         (Symbol_expression::value): Likewise.
4981         (Dot_expression::value): Likewise.
4982         (BINARY_EXPRESSION): Likewise.
4983         (Max_expression::value): Likewise.
4984         (Min_expression::value): Likewise.
4985         (Absolute_expression::value): Likewise.
4986         (Addr_expression::value_from_output_section): Likewise.
4987         (Loaddddr_expression::value_from_output_section): Likewise.
4988         (Segment_start_expression::value): Likewise.
4989         * script-sections.cc
4990         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4991         argument with NULL.
4992         (Sections_elememt_dot_assignment::set_section_addresses):
4993         Likewise.
4994         (Output_data_expression::do_write_to_buffer): Likewise.
4995         (Output_section_definition::finalize_symbols): Likewise.
4996         (Output_section_definition::set_section_addresses): Likewise.
4997
4998 2010-09-30  Doug Kwan  <dougkwan@google.com>
4999
5000         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5001
5002 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5003
5004         * target.h (Target::can_icf_inline_merge_sections): New virtual
5005         function.
5006         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5007         virtual function.
5008         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5009         virtual function.
5010         * icf.cc (get_section_contents): Inline merge sections only when
5011         target allows it.
5012
5013 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5014
5015         * configure: Regenerate.
5016
5017 2010-09-17  Ian Lance Taylor  <iant@google.com>
5018
5019         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5020         * testsuite/Makefile.am (memory_test.o): New target.
5021         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5022         memory_test.t.
5023         * testsuite/Makefile.in: Rebuild.
5024
5025 2010-09-17  Doug Kwan  <dougkwan@google.com>
5026
5027         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5028         defintion if relocation uses GOT entries of the symbol.
5029         * testsuite/icf_safe_test.sh: Fix test.
5030         * testsuite/icf_safe_so_test.sh: Fix test.
5031
5032 2010-09-16  Cary Coutant  <ccoutant@google.com>
5033
5034         * script_sections.cc (class Memory_region): Remove "NULL" from
5035         vector initializations.
5036
5037 2010-09-15  Cary Coutant  <ccoutant@google.com>
5038
5039         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5040         Resolve forwarding symbols.
5041
5042 2010-09-15  Doug Kwan  <dougkwan@google.com>
5043
5044         * gold/testsuite/script_test_3.t: Add ARM special sections.
5045         * gold/testsuite/script_test_4.t: Same.
5046         * gold/testsuite/script_test_5.t: Same.
5047         * gold/testsuite/script_test_6.t: Same.
5048         * gold/testsuite/script_test_7.t: Same.
5049         * gold/testsuite/script_test_7.t: Same.
5050         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5051
5052 2010-09-14  Cary Coutant  <ccoutant@google.com>
5053
5054         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5055         (Target_x86_64::Relocate::relocate_tls): Replace check for
5056         saw_tls_block_reloc_ with test for executable section.
5057
5058 2010-09-12  Cary Coutant  <ccoutant@google.com>
5059
5060         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5061         position-independent executables to shared libraries need dynamic
5062         relocations.
5063         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5064         position-independent executables.
5065         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5066         * testsuite/Makefile.in: Regenerate.
5067
5068 2010-09-10  Nick Clifton  <nickc@redhat.com>
5069
5070         PR gold/11997
5071         * testsuite/memory_test.t: Discard any sections that are not
5072         needed.
5073
5074 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5075
5076         PR gold/11996
5077         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5078         "This::" to work around a bug in gcc 4.2.
5079
5080         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5081
5082 2010-09-09  Rafael Espindola  <espindola@google.com>
5083
5084         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5085         sections with different PF_X flags in the same segment.
5086         (Layout::find_first_load_seg): Search all segments to find the first
5087         one.
5088         * options.h (rosegment): New.
5089
5090 2010-09-08  Rafael Espindola  <espindola@google.com>
5091
5092         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5093
5094 2010-09-08  Doug Kwan  <dougkwan@google.com>
5095
5096         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5097         (Arm_relobj::do_relocate_sections): Add new parameter for output
5098         file to match the parent.
5099         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5100         of local symbols instead of input values.  Update code to track
5101         changes in gold::relocate_section.
5102         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5103         (Sized_relobj::compute_final_local_value_internal): New methods.
5104         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5105         body into private version of Sized_relobj::compute_final_local_value.
5106         Call the inline method.
5107         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5108         merged symbol value if there is one.
5109         (Symbol_value::has_output_value): New method defintiion.
5110         (Sized_relobj::Compute_final_local_value_status): New enum type.
5111         (Sized_relobj::compute_final_local_value): New methods.
5112         (Sized_relobj::compute_final_local_value_internal): New methods.
5113         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5114         and arm_cortex_a8.sh.
5115         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5116         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5117         New tests.
5118         * Makefile.in: Regenerate.
5119         * testsuite/arm_bl_out_of_range.s: Update test.
5120         * testsuite/thumb_bl_out_of_range.s: Ditto.
5121         * testsuite/thumb_blx_out_of_range.s: Ditto.
5122         * testsuite/arm_branch_out_of_range.sh: New file.
5123         * testsuite/arm_cortex_a8.sh: Ditto.
5124         * testsuite/arm_cortex_a8_b.s: Ditto.
5125         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5126         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5127         * testsuite/arm_cortex_a8_bl.s: Ditto.
5128         * testsuite/arm_cortex_a8_blx.s: Ditto.
5129         * testsuite/arm_cortex_a8_local.s: Ditto.
5130         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5131         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5132
5133 2010-09-08  Rafael Espindola  <espindola@google.com>
5134
5135         * Makefile.am (memory_test.stdout): Run readelf with -W.
5136         * Makefile.in: Regenerate.
5137         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5138         64 bit output.
5139
5140 2010-09-08  Rafael Espindola  <espindola@google.com>
5141
5142         * script-sections.cc (Script_sections::add_memory_region): Convert
5143         field precision to int.
5144         * script.cc (script_set_section_region, script_set_section_region):
5145         Convert field precision to int.
5146
5147 2010-09-08  Rafael Espindola  <espindola@google.com>
5148
5149         * arm.cc (do_finalize_sections): Create the __exidx_start and
5150         __exdix_end symbols even when the section is missing.
5151
5152 2010-09-08  Nick Clifton  <nickc@redhat.com>
5153
5154         * README: Remove claim that MEMORY is not supported.
5155         * expression.cc (script_exp_function_origin)
5156         (script_exp_function_length): Move from here to ...
5157         * script.cc: ... here.
5158         (script_set_section_region, script_add_memory)
5159         (script_parse_memory_attr, script_include_directive): New
5160         functions.
5161         * script-sections.cc
5162         (class Memory_region): New class.
5163         (class Output_section_definition): Add set_memory_region,
5164         set_section_vma, set_section_lma and get_section_name methods.
5165         (class Script_Sections): Add add_memory_region,
5166         find_memory_region, find_memory_region_origin,
5167         find_memory_region_length and set_memory_region methods.
5168         Have set_section_addresses method walk the list of set memory
5169         regions.
5170         Extend the print methos to display memory regions.
5171         * script-sections.h: Add prototypes for new methods.
5172         Add enum for MEMORY region attributes.
5173         * yyscript.y: Add support for parsing MEMORY regions.
5174         * script-c.h: Add prototypes for new functions.
5175         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5176         * testsuite/Makefile.in: Regenerate.
5177         * testsuite/memory_test.sh: New script.
5178         * testsuite/memory_test.s: New assembler source file.
5179         * testsuite/memory_test.t: New linker script.
5180
5181 2010-08-27  Doug Kwan  <dougkwan@google.com>
5182
5183         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5184         reference override an existing dynamic weak reference.
5185         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5186         * testsuite/Makefile.in: Regenerate.
5187         * testsuite/dyn_weak_ref.sh: New file.
5188         * testsuite/dyn_weak_ref_1.c: Ditto.
5189         * testsuite/dyn_weak_ref_2.c: Ditto.
5190
5191 2010-08-27  Ian Lance Taylor  <iant@google.com>
5192
5193         * incremental.h (class Incremental_input_entry): Add virtual
5194         destructor.
5195
5196 2010-08-27  Ian Lance Taylor  <iant@google.com>
5197
5198         * testsuite/start_lib_test_3.c: Mark t3 as used.
5199
5200 2010-08-27  Nick Clifton  <nickc@redhat.com>
5201
5202         * options.cc (version_script): Fix small typo in previous
5203         whitespace tidyup.
5204
5205 2010-08-25  Nick Clifton  <nickc@redhat.com>
5206
5207         * archive.cc: Formatting fixes: Remove whitespace between
5208         typename and following asterisk.  Remove whitespace between
5209         function name and opening parenthesis.
5210         * archive.h: Likewise.
5211         * arm.cc: Likewise.
5212         * attributes.cc: Likewise.
5213         * attributes.h: Likewise.
5214         * common.cc: Likewise.
5215         * copy-relocs.cc: Likewise.
5216         * dirsearch.h: Likewise.
5217         * dynobj.cc: Likewise.
5218         * ehframe.cc: Likewise.
5219         * ehframe.h: Likewise.
5220         * expression.cc: Likewise.
5221         * fileread.cc: Likewise.
5222         * fileread.h: Likewise.
5223         * gc.h: Likewise.
5224         * gold-threads.cc: Likewise.
5225         * gold.cc: Likewise.
5226         * i386.cc: Likewise.
5227         * icf.h: Likewise.
5228         * incremental-dump.cc: Likewise.
5229         * incremental.cc: Likewise.
5230         * layout.cc: Likewise.
5231         * layout.h: Likewise.
5232         * main.cc: Likewise.
5233         * merge.cc: Likewise.
5234         * merge.h: Likewise.
5235         * object.cc: Likewise.
5236         * object.h: Likewise.
5237         * options.cc: Likewise.
5238         * options.h: Likewise.
5239         * output.cc: Likewise.
5240         * output.h: Likewise.
5241         * plugin.cc: Likewise.
5242         * plugin.h: Likewise.
5243         * powerpc.cc: Likewise.
5244         * reloc.cc: Likewise.
5245         * script-c.h: Likewise.
5246         * script-sections.cc: Likewise.
5247         * script.cc: Likewise.
5248         * stringpool.cc: Likewise.
5249         * symtab.cc: Likewise.
5250         * symtab.h: Likewise.
5251         * target.cc: Likewise.
5252         * timer.cc: Likewise.
5253         * timer.h: Likewise.
5254         * version.cc: Likewise.
5255         * x86_64.cc: Likewise.
5256
5257 2010-08-24  Nick Clifton  <nickc@redhat.com>
5258
5259         PR 11899
5260         * layout.cc (segment_precedes): Sort segments by their physical
5261         addresses, if they have been set.
5262
5263 2010-08-23  Cary Coutant  <ccoutant@google.com>
5264
5265         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5266         symbols data.
5267         (Lib_group::include_member): Unlock object after deleting its
5268         symbols data.
5269         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5270         the bug fixed here.
5271
5272 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5273             Cary Coutant  <ccoutant@google.com>
5274
5275         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5276         constructor, and set_blocker.
5277         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5278         readsyms_blocker_.
5279         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5280         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5281         * testsuite/Makefile.am (start_lib_test): New test case.
5282         * testsuite/Makefile.in: Regenerate.
5283         * testsuite/start_lib_test_main.c: New file.
5284         * testsuite/start_lib_test_1.c: New file.
5285         * testsuite/start_lib_test_2.c: New file.
5286         * testsuite/start_lib_test_3.c: New file.
5287
5288 2010-08-19  Ian Lance Taylor  <iant@google.com>
5289
5290         * Makefile.in: Rebuild with automake 1.11.1.
5291         * aclocal.m4: Likewise.
5292         * testsuite/Makefile.in: Likewise.
5293
5294 2010-08-19  Ian Lance Taylor  <iant@google.com>
5295
5296         PR 10893
5297         * i386.cc (class Output_data_plt_i386): Update declarations.
5298         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5299         local_ifuncs_ fields.
5300         (Target_i386::do_plt_section_for_global): New function.
5301         (Target_i386::do_plt_section_for_local): New function.
5302         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5303         parameter; change all callers.  Initialize global_ifuncs_ and
5304         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5305         __rel_iplt_end.
5306         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5307         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5308         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5309         symbols.
5310         (Target_i386::make_plt_section): New function, broken out of
5311         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5312         (Target_i386::make_plt_entry): Call make_plt_section.
5313         (Target_i386::make_local_ifunc_plt_entry): New function.
5314         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5315         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5316         R_386_IRELATIVE to switch.
5317         (Target_i386::Scan::global): Likewise.
5318         (Target_i386::Relocate::relocate): Likewise.
5319         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5320         switch.
5321         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5322         (Target_x86_64::do_plt_section_for_global): New function.
5323         (Target_x86_64::do_plt_section_for_local): New function.
5324         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5325         parameter; change all callers.  If doing a static link define
5326         __rela_iplt_start and __rela_iplt_end.
5327         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5328         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5329         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5330         to point to .plt.
5331         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5332         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5333         switch.
5334         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5335         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5336         R_X86_64_IRELATIVE to switch.
5337         (Target_x86_64::Scan::global): Likewise.
5338         (Target_x86_64::Relocate::relocate): Likewise.
5339         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5340         switch.
5341         * target.h (class Target): Add plt_section_for_global and
5342         plt_section_for_local functions.  Add do_plt_section_for_global
5343         and do_plt_section_for_local virtual functions.
5344         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5345         clarifying comments.
5346         (Symbol::use_plt_offset): Handle IFUNC symbol.
5347         * object.cc (Sized_relobj::Sized_relobj): Initialize
5348         local_plt_offsets_.
5349         (Sized_relobj::local_has_plt_offset): New function.
5350         (Sized_relobj::local_plt_offset): New function.
5351         (Sized_relobj::set_local_plt_offset): New function.
5352         (Sized_relobj::do_count): Handle IFUNC symbol.
5353         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5354         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5355         is_ifunc_symbol functions.
5356         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5357         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5358         local_plt_offsets_ field.
5359         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5360         * output.h (class Output_section_data): Add non-const
5361         output_section function.
5362         (class Output_data_got): Update declarations.
5363         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5364         Add use_plt_offset parameter to global and local constructors.
5365         Change all callers.  Change local_sym_index_ field to 31 bits.
5366         Change GSYM_CODE and CONSTANT_CODE accordingly.
5367         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5368         doing a static link don't set sh_link field.
5369         (Output_data_got::Got_entry::write): Use PLT offset if
5370         appropriate.
5371         (Output_data_got::add_global_plt): New function.
5372         (Output_data_got::add_local_plt): New function.
5373         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5374         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5375         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5376         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5377         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5378         IFUNC conditional.
5379         * testsuite/ifunc-sel.h: New file.
5380         * testsuite/ifuncmain1.c: New file.
5381         * testsuite/ifuncmain1vis.c: New file.
5382         * testsuite/ifuncmod1.c: New file.
5383         * testsuite/ifuncdep2.c: New file.
5384         * testsuite/ifuncmain2.c: New file.
5385         * testsuite/ifuncmain3.c: New file.
5386         * testsuite/ifuncmod3.c: New file.
5387         * testsuite/ifuncmain4.c: New file.
5388         * testsuite/ifuncmain5.c: New file.
5389         * testsuite/ifuncmod5.c: New file.
5390         * testsuite/ifuncmain6pie.c: New file.
5391         * testsuite/ifuncmod6.c: New file.
5392         * testsuite/ifuncmain7.c: New file.
5393         * configure, testsuite/Makefile.in: Rebuild.
5394
5395 2010-08-18  Ian Lance Taylor  <iant@google.com>
5396
5397         * incremental.cc
5398         (Output_section_incremental_inputs::write_input_files): Add cast
5399         to avoid signed/unsigned comparison warning.
5400         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5401
5402 2010-08-12  Cary Coutant  <ccoutant@google.com>
5403
5404         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5405
5406 2010-08-13  Ian Lance Taylor  <iant@google.com>
5407
5408         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5409
5410 2010-08-12  Cary Coutant  <ccoutant@google.com>
5411             Doug Kwan  <dougkwan@google.com>
5412
5413         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5414         defintion overrides non-weak undef, remember that the original undef
5415         is not weak.
5416         * symtab.cc (Symbol_table::sized_write_global): For undef without
5417         an original weak binding, set binding to global in output.
5418         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5419         * testsuite/Makefile.in: Regenerate.
5420         * testsuite/strong_ref_weak_def.sh: New file.
5421         * testsuite/strong_ref_weak_def_1.c: Ditto.
5422         * testsuite/strong_ref_weak_def_2.c: Ditto.
5423
5424 2010-08-12  Cary Coutant  <ccoutant@google.com>
5425
5426         * testsuite/incremental_test.sh: Rewrite.
5427         * testsuite/incremental_test_1.c: Rewrite.
5428         * testsuite/incremental_test_2.c: Rewrite.
5429
5430 2010-08-12  Cary Coutant  <ccoutant@google.com>
5431
5432         * arm.cc (Target_arm::got_size): Add const.
5433         (Target_arm::got_entry_count): New function.
5434         (Target_arm::plt_entry_count): New function.
5435         (Target_arm::first_plt_entry_offset): New function.
5436         (Target_arm::plt_entry_size): New function.
5437         (Output_data_plt_arm::entry_count): New function.
5438         (Output_data_plt_arm::first_plt_entry_offset): New function.
5439         (Output_data_plt_arm::get_plt_entry_size): New function.
5440         * i386.cc (Target_i386::got_size): Add const.
5441         (Target_i386::got_entry_count): New function.
5442         (Target_i386::plt_entry_count): New function.
5443         (Target_i386::first_plt_entry_offset): New function.
5444         (Target_i386::plt_entry_size): New function.
5445         (Output_data_plt_i386::entry_count): New function.
5446         (Output_data_plt_i386::first_plt_entry_offset): New function.
5447         (Output_data_plt_i386::get_plt_entry_size): New function.
5448         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5449         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5450         * incremental.cc: Include target.h.
5451         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5452         parameter.  Adjust all callers.  Find incremental_got_plt section.
5453         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5454         section.
5455         (Output_section_incremental_inputs::set_final_data_size): Calculate
5456         size of incremental_got_plt section.
5457         (Output_section_incremental_inputs::do_write): Write the
5458         incremental_got_plt section.
5459         (Got_plt_view_info): New struct.
5460         (Local_got_offset_visitor): New class.
5461         (Global_got_offset_visitor): New class.
5462         (Global_symbol_visitor_got_plt): New class.
5463         (Output_section_incremental_inputs::write_got_plt): New function.
5464         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5465         Add parameter.  Adjust all callers.
5466         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5467         (Incremental_inputs::got_plt_section): New function.
5468         (Incremental_inputs::got_plt_section_): New data member.
5469         (Incremental_got_plt_reader): New class.
5470         * layout.cc (Layout::create_incremental_info_sections): Add the
5471         incremental_got_plt section.
5472         * object.h (Got_offset_list::get_list): New function.
5473         (Got offset_list::for_all_got_offsets): New function.
5474         (Sized_relobj::local_got_offset_list): New function.
5475         * powerpc.cc (Target_powerpc::got_size): Add const.
5476         (Target_powerpc::got_entry_count): New function.
5477         (Target_powerpc::plt_entry_count): New function.
5478         (Target_powerpc::first_plt_entry_offset): New function.
5479         (Target_powerpc::plt_entry_size): New function.
5480         (Output_data_plt_powerpc::entry_count): New function.
5481         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5482         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5483         * sparc.cc (Target_sparc::got_size): Add const.
5484         (Target_sparc::got_entry_count): New function.
5485         (Target_sparc::plt_entry_count): New function.
5486         (Target_sparc::first_plt_entry_offset): New function.
5487         (Target_sparc::plt_entry_size): New function.
5488         (Output_data_plt_sparc::entry_count): New function.
5489         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5490         (Output_data_plt_sparc::get_plt_entry_size): New function.
5491         * symtab.h (Symbol::got_offset_list): New function.
5492         (Symbol_table::for_all_symbols): New function.
5493         * target.h (Sized_target::got_entry_count): New function.
5494         (Sized_target::plt_entry_count): New function.
5495         (Sized_target::plt_entry_size): New function.
5496         * x86_64.cc (Target_x86_64::got_size): Add const.
5497         (Target_x86_64::got_entry_count): New function.
5498         (Target_x86_64::plt_entry_count): New function.
5499         (Target_x86_64::first_plt_entry_offset): New function.
5500         (Target_x86_64::plt_entry_size): New function.
5501         (Output_data_plt_x86_64::entry_count): New function.
5502         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5503         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5504
5505 2010-08-12  Cary Coutant  <ccoutant@google.com>
5506
5507         * archive.cc: Include incremental.h.
5508         (Archive::Archive): Initialize incremental_info_.
5509         (Archive::include_member): Record archive members in incremental info.
5510         (Add_archive_symbols::run): Record begin and end of an archive in
5511         incremental info.
5512         (Lib_group::include_member): Record objects in incremental info.
5513         * archive.h (Incremental_archive_entry): Forward declaration.
5514         (Archive::set_incremental_info): New member function.
5515         (Archive::incremental_info): New member function.
5516         (Archive::Unused_symbol_iterator): New class.
5517         (Archive::unused_symbols_begin): New member function.
5518         (Archive::unused_symbols_end): New member function.
5519         (Archive::incremental_info_): New data member.
5520         * incremental-dump.cc (find_input_containing_global): New function.
5521         (dump_incremental_inputs): Dump new incremental info sections.
5522         * incremental.cc: Include symtab.h.
5523         (Output_section_incremental_inputs): New class.
5524         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5525         new incremental info sections.
5526         (Sized_incremental_binary::do_check_inputs): Likewise.
5527         (Incremental_inputs::report_archive): Remove.
5528         (Incremental_inputs::report_archive_begin): New function.
5529         (Incremental_inputs::report_archive_end): New function.
5530         (Incremental_inputs::report_object): New function.
5531         (Incremental_inputs::finalize_inputs): Remove.
5532         (Incremental_inputs::report_input_section): New function.
5533         (Incremental_inputs::report_script): Rewrite.
5534         (Incremental_inputs::finalize): Do nothing but finalize string table.
5535         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5536         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5537         (Incremental_inputs::create_data_sections): New function.
5538         (Incremental_inputs::relocs_entsize): New function.
5539         (Output_section_incremental_inputs::set_final_data_size): New function.
5540         (Output_section_incremental_inputs::do_write): New function.
5541         (Output_section_incremental_inputs::write_header): New function.
5542         (Output_section_incremental_inputs::write_input_files): New function.
5543         (Output_section_incremental_inputs::write_info_blocks): New function.
5544         (Output_section_incremental_inputs::write_symtab): New function.
5545         * incremental.h (Incremental_script_entry): Forward declaration.
5546         (Incremental_object_entry): Forward declaration.
5547         (Incremental_archive_entry): Forward declaration.
5548         (Incremental_inputs): Forward declaration.
5549         (Incremental_inputs_header_data): Remove.
5550         (Incremental_inputs_header): Remove.
5551         (Incremental_inputs_header_write): Remove.
5552         (Incremental_inputs_entry_data): Remove.
5553         (Incremental_inputs_entry): Remove.
5554         (Incremental_inputs_entry_write): Remove.
5555         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5556         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5557         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5558         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5559         Likewise.
5560         (Incremental_input_entry): New class.
5561         (Incremental_script_entry): New class.
5562         (Incremental_object_entry): New class.
5563         (Incremental_archive_entry): New class.
5564         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5565         (Incremental_inputs::report_inputs): Remove.
5566         (Incremental_inputs::report_archive): Remove.
5567         (Incremental_inputs::report_archive_begin): New function.
5568         (Incremental_inputs::report_archive_end): New function.
5569         (Incremental_inputs::report_object): Change prototype.
5570         (Incremental_inputs::report_input_section): New function.
5571         (Incremental_inputs::report_script): Change prototype.
5572         (Incremental_inputs::get_reloc_count): New function.
5573         (Incremental_inputs::set_reloc_count): New function.
5574         (Incremental_inputs::create_data_sections): New function.
5575         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5576         (Incremental_inputs::inputs_section): New function.
5577         (Incremental_inputs::symtab_section): New function.
5578         (Incremental_inputs::relocs_section): New function.
5579         (Incremental_inputs::get_stringpool): Add const.
5580         (Incremental_inputs::command_line): Add const.
5581         (Incremental_inputs::inputs): Remove.
5582         (Incremental_inputs::command_line_key): New function.
5583         (Incremental_inputs::input_file_count): New function.
5584         (Incremental_inputs::input_files): New function.
5585         (Incremental_inputs::relocs_entsize): New function.
5586         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5587         (Incremental_inputs::finalize_inputs): Remove.
5588         (Incremental_inputs::Input_info): Remove.
5589         (Incremental_inputs::lock_): Remove.
5590         (Incremental_inputs::inputs_): Change type.
5591         (Incremental_inputs::inputs_map_): Remove.
5592         (Incremental_inputs::current_object_entry_): New data member.
5593         (Incremental_inputs::inputs_section_): New data member.
5594         (Incremental_inputs::symtab_section_): New data member.
5595         (Incremental_inputs::relocs_section_): New data member.
5596         (Incremental_inputs::reloc_count_): New data member.
5597         (Incremental_inputs_reader): New class.
5598         (Incremental_symtab_reader): New class.
5599         (Incremental_relocs_reader): New class.
5600         * layout.cc (Layout::finalize): Move finalization of incremental info
5601         and creation of incremental info sections to follow finalization of
5602         symbol table.  Set offsets for postprocessing sections.
5603         (Layout::create_incremental_info_sections): Call
5604         Incremental_inputs::create_data_sections.  Add incremental symtab
5605         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5606         sections to layout after input sections.
5607         * layout.h (struct Timespec): Forward declaration.
5608         (Layout::incremental_inputs): Add const.
5609         (Layout::create_incremental_info_sections): Add parameter.
5610         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5611         * object.cc: Include incremental.h.
5612         (Relobj::finalize_incremental_relocs): New function.
5613         (Sized_relobj::do_layout): Record input sections in incremental info.
5614         * object.h (Object::output_section): New function.
5615         (Object::output_section_offset): Moved from Relobj.
5616         (Object::get_incremental_reloc_base): New function.
5617         (Object::get_incremental_reloc_count): New function.
5618         (Object::do_output_section): New function.
5619         (Object::do_output_section_offset): Moved from Relobj.
5620         (Object::do_get_incremental_reloc_base): New function.
5621         (Object::do_get_incremental_reloc_count): New function.
5622         (Object::Object): Initialize new data members.
5623         (Relobj::output_section): Renamed do_output_section and moved to
5624         protected.
5625         (Relobj::output_section_offset): Moved to Object.
5626         (Relobj::do_get_incremental_reloc_base): New function.
5627         (Relobj::do_get_incremental_reloc_count): New function.
5628         (Relobj::allocate_incremental_reloc_counts): New function.
5629         (Relobj::count_incremental_reloc): New function.
5630         (Relobj::finalize_incremental_relocs): New function.
5631         (Relobj::next_incremental_reloc_index): New function.
5632         (Relobj::reloc_counts_): New data member.
5633         (Relobj::reloc_bases_): New data member.
5634         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5635         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5636         (Sized_relobj::incremental_relocs_scan): New function.
5637         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5638         (Sized_relobj::incremental_relocs_write): New function.
5639         (Sized_relobj::incremental_relocs_write_reltype): New function.
5640         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5641         incremental link.
5642         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5643         archives and object files elsewhere.
5644         (Add_symbols::run): Report object files here.
5645         (Finish_group::run): Report end of archive at end of group.
5646         * reloc.cc: Include layout.h, incremental.h.
5647         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5648         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5649         (Sized_relobj::incremental_relocs_scan): New function.
5650         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5651         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5652         (Sized_relobj::incremental_relocs_write): New function.
5653         (Sized_relobj::incremental_relocs_write_reltype): New function.
5654         * script.cc (read_input_script): Rewrite test for incremental link.
5655         Change call to Incremental_inputs::report_script.
5656         * symtab.h (Symbol_table::first_global_index): New function.
5657         (Symbol_table::output_count): New function.
5658
5659 2010-08-12  Doug Kwan  <dougkwan@google.com>
5660
5661         * arm.cc (Target_arm::merge_object_attributes): Check command line
5662         options --no-wchar-size-warning and --no-enum-size-warning.
5663         * options.h (General_options): Add ld-compatible options
5664         --no-enum-size-warning and --no-wchar-size-warning.
5665
5666 2010-08-04  Ian Lance Taylor  <iant@google.com>
5667
5668         * x86_64.cc (Target_x86_64::Scan::local): Use
5669         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5670         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5671         (Target_x86_64::Scan::global): Likewise.
5672         (Target_x86_64::Relocate::relocate): Likewise.
5673         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5674         Likewise.
5675
5676 2010-08-03  Cary Coutant  <ccoutant@google.com>
5677
5678         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5679         to reserve space in merged_strings vector. Keep total input size
5680         for stats.
5681         (Output_merge_string::do_print_merge_stats): Print total input size.
5682         * merge.h (Output_merge_string): Add input_size_ field.
5683         * stringpool.cc (Stringpool_template::string_length): Move
5684         implementations out of Stringpool_template class and place in
5685         stringpool.h.
5686         * stringpool.h (string_length): Move out of Stringpool_template.
5687
5688 2010-08-03  Ian Lance Taylor  <iant@google.com>
5689
5690         PR 11712
5691         * layout.cc (relaxation_loop_body): If address of load segment is
5692         set, adjust address to include headers if possible.
5693
5694 2010-08-03  Ian Lance Taylor  <iant@google.com>
5695
5696         * version.cc (version_string): Bump to 1.10.
5697
5698 2010-08-03  Ian Lance Taylor  <iant@google.com>
5699
5700         PR 11805
5701         * layout.h (enum Output_section_order): Define.
5702         (class Layout): Update declarations.
5703         * layout.cc (Layout::get_output_section): Add order parameter.
5704         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5705         is_first_non_relro parameters.  Change all callers.
5706         (Layout::choose_output_section): Likewise.
5707         (Layout::add_output_section_data): Likewise.
5708         (Layout::make_output_section): Likewise.  Set order.
5709         (Layout::default_section_order): New function.
5710         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5711         * output.cc (Output_section::Output_section): Initialize order_.
5712         Don't initialize deleted fields.
5713         (Output_segment::Output_segment): Don't initialize deleted
5714         fields.
5715         (Output_segment::add_output_section_to_load): New function
5716         replacing add_output_section.  Change all callers to call this or
5717         add_output_section_to_nonload.
5718         (Output_segment::add_output_section_to_nonload): New function.
5719         (Output_segment::remove_output_section): Rewrite.
5720         (Output_segment::add_initial_output_data): Likewise.
5721         (Output_segment::has_any_data_sections): Likewise.
5722         (Output_segment::is_first_section_relro): Likewise.
5723         (Output_segment::maximum_alignment): Likewise.
5724         (Output_segment::has_dynamic_reloc): New function replacing
5725         dynamic_reloc_count.  Change all callers.
5726         (Output_segment::has_dynamic_reloc_list): New function replacing
5727         dynamic_reloc_count_list.  Change all callers.
5728         (Output_segment::set_section_addresses): Rewrite.
5729         (Output_segment::set_offset): Rewrite.
5730         (Output_segment::find_first_and_last_list): Remove.
5731         (Output_segment::set_tls_offsets): Rewrite.
5732         (Output_segment::first_section_load_address): Likewise.
5733         (Output_segment::output_section_count): Likewise.
5734         (Output_segment::section_with_lowest_load_address): Likewise.
5735         (Output_segment::write_section_headers): Likewise.
5736         (Output_segment::print_sections_to_map): Likewise.
5737         * output.h (class Output_data): Remove dynamic_reloc_count_
5738         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5739         (Output_data::add_dynamic_reloc): Rewrite.
5740         (Output_data::has_dynamic_reloc): New function.
5741         (Output_data::dynamic_reloc_count): Remove.
5742         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5743         is_last_relro_, is_first_non_relro_, is_interp_,
5744         is_dynamic_linker_section_ fields.  Add order and set_order
5745         functions.  Remove is_relro_local, set_is_relro_local,
5746         is_last_relro, set_is_last_relro, is_first_non_relro,
5747         set_is_first_non_relro functions, is_interp, set_is_interp,
5748         is_dynamic_linker_section, and set_is_dynamic_linker_section
5749         functions.
5750         (class Output_segment): Change Output_data_list from std::list to
5751         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5752         output_bss_ fields.  Update declarations.
5753
5754 2010-08-02  Ian Lance Taylor  <iant@google.com>
5755
5756         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5757         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5758         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5759
5760 2010-08-02  Ian Lance Taylor  <iant@google.com>
5761
5762         PR 11855
5763         * script.cc (Script_options::Script_options): Initialize
5764         symbol_definitions_ and symbol_references_.
5765         (Script_options::add_symbol_assignment): Update
5766         symbol_definitions_ and symbol_references_.
5767         (Script_options::add_symbol_reference): New function.
5768         (script_symbol): New function.
5769         * script.h (class Script_options): Add symbol_definitions_ and
5770         symbol_references_ fields.
5771         (Script_options::referenced_const_iterator): New type.
5772         (Script_options::referenced_begin): New function.
5773         (Script_options::referenced_end): New function.
5774         (Script_options::is_referenced): New function.
5775         (Script_options::any_unreferenced): New function.
5776         * script-c.h (script_symbol): Declare.
5777         * yyscript.y (exp): Call script_symbol.
5778         * symtab.cc: Include "script.h".
5779         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5780         Change all callers.  Check symbols referenced by scripts.
5781         (Symbol_table::add_undefined_symbols_from_command_line): Add
5782         layout parameter.  Change all callers.
5783         (Symbol_table::do_add_undefined_symbols_from_command_line):
5784         Likewise.  Break out loop body.  Check symbols referenced by
5785         scripts.
5786         (Symbol_table::add_undefined_symbol_from_command_line): New
5787         function broken out of
5788         do_add_undefined_symbols_from_command_line.
5789         * symtab.h (class Symbol_table): Update declarations.
5790         * archive.cc: Include "layout.h".
5791         (Archive::should_include_member): Add layout parameter.  Change
5792         all callers.  Check for symbol mentioned in expression.
5793         * archive.h (class Archive): Update declaration.
5794         * object.cc (Sized_relobj::do_should_include_member): Add layout
5795         parameter.
5796         * object.h (Object::should_include_member): Add layout parameter.
5797         Change all callers.
5798         (Object::do_should_include_member): Add layout parameter.
5799         (class Sized_relobj): Update declaration.
5800         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5801         parameter.
5802         * dynobj.h (class Sized_dynobj): Update declaration.
5803         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5804         layout parameter.
5805         * plugin.h (class Sized_pluginobj): Update declaration.
5806
5807 2010-08-02  Ian Lance Taylor  <iant@google.com>
5808
5809         PR 11866
5810         * output.cc (Output_segment::set_offset): Search for the first and
5811         last sections rather than assuming that the list is in order.
5812         (Output_segment::find_first_and_last_list): New function.
5813         * output.h (class Output_segment): Update declarations.
5814         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5815         (relro_strip_test_SOURCES): New variable.
5816         (relro_strip_test_DEPENDENCIES): New variable.
5817         (relro_strip_test_LDFLAGS): New variable.
5818         (relro_strip_test_LDADD): New variable.
5819         (relro_strip_test.so): New target.
5820
5821 2010-08-02  Ian Lance Taylor  <iant@google.com>
5822
5823         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5824         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5825         (Target_i386::got_tlsdesc_section): New function.
5826         (Target_i386::got_section): Create space for GOT entries for
5827         TLSDESC relocations.
5828         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5829         R_386_TLS_GOTDESC.
5830         (Target_i386::Scan::global): Likewise.
5831         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5832         using TLSDESC GOT.
5833         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5834         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5835         (Target_x86_64::got_tlsdesc_section): New function.
5836         (Target_x86_64::got_section): Create space for GOT entries for
5837         TLSDESC relocations.
5838         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5839         R_386_TLS_GOTDESC.
5840         (Target_x86_64::Scan::global): Likewise.
5841         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5842         using TLSDESC GOT.
5843
5844 2010-08-02  Ian Lance Taylor  <iant@google.com>
5845
5846         * testsuite/final_layout.sh: Use dc to convert from hex to
5847         decimal.
5848
5849 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5850
5851         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5852         paramter to the call to gold::gc_process_relocs.
5853         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5854         paramter to the call to gold::gc_process_relocs.
5855         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5856         parameter to the call to gold::gc_process_relocs.
5857         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5858         template parameter to the call to gold::gc_process_relocs.
5859         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5860         paramter to the call to gold::gc_process_relocs.
5861         * gc.h (get_embedded_addend_size): New function.
5862         (gc_process_relocs): Save the size of the reloc for use by ICF.
5863         * icf.cc (get_section_contents): Get the addend from the text section
5864         for SHT_REL relocation sections.
5865         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5866         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5867         * int_encoding.h (read_from_pointer): New overloaded function.
5868         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5869         * testsuite/icf_sht_rel_addend_test.sh: New file.
5870         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5871         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5872
5873 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5874
5875         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5876         * Makefile.in: Regenerate.
5877         * testsuite/Makefile.in: Regenerate.
5878
5879 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5880
5881         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5882         * gold/testsuite/debug_msg.cc: Likewise.
5883         * gold/testsuite/odr_violation1.cc
5884         * gold/testsuite/odr_violation2.cc
5885
5886 2010-07-21  Cary Coutant  <ccoutant@google.com>
5887
5888         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5889         string, and length fields.
5890         (Output_merge_string::Merged_strings_list): New type.
5891         (Output_merge_string::Merged_strings_lists): New typedef.
5892         (Output_merge_string): Replace merged_strings_ with
5893         merged_strings_lists_.
5894         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5895         Merged_strings_list per input object and section.  Don't store pointer
5896         to the string.  Don't store length with each merged string entry.
5897         (Output_merge_string::finalize_merged_data): Loop over list of merged
5898         strings lists.  Recompute length of each merged string.
5899
5900 2010-07-15  Cary Coutant  <ccoutant@google.com>
5901
5902         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5903         here.
5904
5905 2010-07-14  Ian Lance Taylor  <iant@google.com>
5906
5907         * descriptors.cc (Descriptors::open): Report correct name in error
5908         message.
5909
5910 2010-07-13  Doug Kwan  <dougkwan@google.com>
5911
5912         * arm.cc (Arm_input_section::Arm_input_section): For a
5913         SHT_ARM_EXIDX section, always keeps the input sections.
5914         (Arm_input_section::set_exidx_section_link): New method.
5915         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5916         has_errors_ to false.
5917         (Arm_exidx_input_section::has_errors,
5918         Arm_exidx_input_section::set_has_errors): New methods.
5919         (Arm_exidx_input_section::has_errors_): New data member.
5920         (Arm_relobj::get_exidx_shndx_list): New method.
5921         (Arm_output_section::append_text_sections_to_list): Do not skip
5922         section without SHF_EXECINSTR.
5923         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5924         errors.
5925         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5926         section header.  Make error messages more verbose.  Check for
5927         a non-executable section linked to an EXIDX section.
5928         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5929         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5930         check that there is no deferred EXIDX section if we exit early.
5931         Instead of not making an EXIDX section in case of an error, make one
5932         and set the has_errors flag of it.
5933         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5934         in a relocatable link.
5935         (Target_arm::do_relax): Look for the EXIDX output section instead of
5936         assuming that it is called .ARM.exidx.
5937         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5938         section list.  Do not check for SHF_EXECINSTR section flags but
5939         skip any input section with errors.
5940         * output.cc (Output_section::Output_section): Initialize
5941         always_keeps_input_sections_ to false.
5942         (Output_section::add_input_section): Check for
5943         always_keeps_input_sections_.
5944         *  output.h (Output_section::always_keeps_input_sections,
5945         Output_section::set_always_keeps_input_sections): New methods.
5946         (Output_section::always_keeps_input_sections): New data member.
5947
5948 2010-07-13  Rafael Espindola  <espindola@google.com>
5949
5950         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5951         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5952
5953 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5954             Ian Lance Taylor  <iant@google.com>
5955
5956         * output.h (Output_section_lookup_maps::add_merge_section):
5957         Correct check of whether value was inserted.
5958         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5959         (Output_section_lookup_maps::add_relaxed_input_section):
5960         Likewise.
5961         * arm.cc (Target_arm::got_section): Remove used local os.
5962         * i386.cc (Target_i386::got_section): Likewise.
5963         * x86_64.cc (Target_x86_64::got_section): Likewise.
5964         * sparc.cc (Target_sparc::got_section): Likewise.
5965         (Target_sparc::relocate): Remove unused local have_got_offset.
5966         * powerpc.cc (Target_powerpc::relocate): Likewise.
5967
5968 2010-07-13  Ian Lance Taylor  <iant@google.com>
5969
5970         * compressed_output.cc (zlib_decompress): Fix signature in
5971         !HAVE_ZLIB_H case.
5972
5973         * archive.cc (Archive::include_member): Unlock an external member
5974         of a thin archive.  Don't bother to delete an object we know is
5975         NULL.
5976
5977 2010-07-12  Cary Coutant  <ccoutant@google.com>
5978
5979         * compressed_output.cc (zlib_decompress): New function.
5980         (get_uncompressed_size): New function.
5981         (decompress_input_section): New function.
5982         * compressed_output.h (get_uncompressed_size): New function.
5983         (decompress_input_section): New function.
5984         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5985         Handle compressed debug sections.
5986         * layout.cc (is_compressed_debug_section): New function.
5987         (Layout::output_section_name): Map compressed section names to
5988         canonical names.
5989         * layout.h (is_compressed_debug_section): New function.
5990         (is_debug_info_section): Recognize compressed debug sections.
5991         * merge.cc: Include compressed_output.h.
5992         (Output_merge_data::do_add_input_section): Handle compressed
5993         debug sections.
5994         (Output_merge_string::do_add_input_section): Handle compressed
5995         debug sections.
5996         * object.cc: Include compressed_output.h.
5997         (Sized_relobj::Sized_relobj): Initialize new data members.
5998         (build_compressed_section_map): New function.
5999         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6000         * object.h (Object::section_is_compressed): New method.
6001         (Object::do_section_is_compressed): New method.
6002         (Sized_relobj::Compressed_section_map): New type.
6003         (Sized_relobj::do_section_is_compressed): New method.
6004         (Sized_relobj::compressed_sections_): New data member.
6005         * output.cc (Output_section::add_input_section): Handle compressed
6006         debug sections.
6007         * reloc.cc: Include compressed_output.h.
6008         (Sized_relobj::write_sections): Handle compressed debug sections.
6009
6010 2010-07-08  Cary Coutant  <ccoutant@google.com>
6011
6012         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6013         weak when resolving to a dynamic def.
6014         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6015         for weak undef/dynamic def cases. Adjust callers.
6016         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6017         undef_binding_weak_.
6018         (Symbol_table::sized_write_globals): Adjust symbol binding.
6019         (Symbol_table::sized_write_symbol): Add binding parameter.
6020         * symtab.h (Symbol::set_undef_binding): New method.
6021         (Symbol::is_undef_binding_weak): New method.
6022         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6023         (Symbol_table::should_override): Add new parameter.
6024         (Symbol_table::sized_write_symbol): Add new parameter.
6025
6026         * testsuite/weak_undef_file1.cc: Add new test case.
6027         * testsuite/weak_undef_file2.cc: Fix header comment.
6028         * testsuite/weak_undef_test.cc: Add new test case.
6029
6030 2010-06-29  Doug Kwan  <dougkwan@google.com>
6031
6032         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6033         Initialize USE_SYMBOL_.
6034         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6035         definition.
6036         (Arm_reloc_property::uses_symbol_): New data member declaration.
6037         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6038         uses symbol value and symbol is undefined but not weakly undefined.
6039
6040 2010-06-28  Rafael Espindola  <espindola@google.com>
6041
6042         * plugin.cc (Plugin::load): Use dlerror.
6043
6044 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6045
6046         * symtab.cc (detect_odr_violations): When reporting an ODR
6047         violation, report an object where the symbol is defined.
6048
6049 2010-06-25  Doug Kwan  <dougkwan@google.com>
6050
6051         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6052         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6053         definition.
6054         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6055         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6056         target hook to detect function points.
6057         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6058         * icf.h (Icf::check_section_for_function_pointers): Change type of
6059         parameter SECTION_NAME to const reference to std::string.  Use
6060         target hook to determine if section may have unsafe pointers.
6061         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6062         method definition.
6063
6064 2010-06-21  Rafael Espindola  <espindola@google.com>
6065
6066         * fileread.cc (Input_file::find_fie): New
6067         (Input_file::open): Use Input_file::find_fie.
6068         * fileread.h (Input_file::find_fie): New
6069         * plugin.cc (set_extra_library_path): New.
6070         (Plugin::load): Add set_extra_library_path to the transfer vector.
6071         (Plugin_manager::set_extra_library_path): New.
6072         (Plugin_manager::add_input_file): Use the extra search path if set.
6073         (set_extra_library_path(): New.
6074         * plugin.h (Plugin_manager): Add set_extra_library_path and
6075         extra_search_path_.
6076
6077 2010-06-19  Cary Coutant  <ccoutant@google.com>
6078
6079         * layout.cc (gdb_sections): Add .debug_types.
6080         (lines_only_debug_sections): Likewise.
6081
6082 2010-06-18  Rafael Espindola  <espindola@google.com>
6083
6084         * plugin.cc (add_input_file,add_input_library)
6085         (Plugin_manager::add_input_file): Make filename arguments const.
6086         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6087         const.
6088
6089 2010-06-16  Doug Kwan  <dougkwan@google.com>
6090
6091         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6092         .ARM.attributes section if we have not merged any input
6093         attributes sections.
6094
6095 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6096
6097         * arm.cc: Allow combining objects with no EABI version
6098         information.
6099
6100 2010-06-15  Rafael Espindola  <espindola@google.com>
6101
6102         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6103
6104 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6105
6106         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6107         (struct iovec): Correct !HAVE_READV definition.
6108
6109 2010-06-10  Cary Coutant  <ccoutant@google.com>
6110
6111         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6112         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6113         reloc sections.
6114         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6115
6116         PR 11683
6117         * symtab.h (Symbol::is_placeholder): New member function.
6118         * target-reloc.h (relocate_section): Check for placeholder symbols.
6119
6120         * testsuite/Makefile.am (plugin_test_8): New test.
6121         (plugin_test_9): New test.
6122         * testsuite/Makefile.in: Regenerate.
6123
6124 2010-06-09  Nick Clifton  <nickc@redhat.com>
6125
6126         * yyscript.y (input_list_element): Allow strings prefixed with
6127         the '-' character.  Treat these as libraries.
6128         * script.cc (script_add_library): New function.  Adds a library
6129         specified by "-l<name>" found in an input script.
6130         * script-c.h: Add prototype for script_add_library.
6131
6132 2010-06-07  Doug Kwan  <dougkwan@google.com>
6133
6134         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6135         Restrict stub-group size to be within long conditional branch
6136         range when working around cortex-A8 erratum.
6137
6138 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6139
6140         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6141         #ifdef typo.
6142
6143 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6144
6145         PR gold/11658
6146         * output.cc
6147         (Output_section::Input_section_sort_entry::compare_section_ordering):
6148         Change to return non-zero correctly.
6149         (Output_section::Input_section_sort_section_order_index_compare
6150         ::operator()): Change to fix ambiguity in comparisons.
6151
6152 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6153
6154         * gold.h (is_wildcard_string): New function.
6155         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6156         (Layout::layout_eh_frame): Ditto.
6157         (Layout::find_section_order_index): New method.
6158         (Layout::read_layout_from_file): New method.
6159         * layout.h (Layout::find_section_order_index): New method.
6160         (Layout::read_layout_from_file): New method.
6161         (Layout::input_section_position_): New private member.
6162         (Layout::input_section_glob_): New private member.
6163         * main.cc (main): Call read_layout_from_file here.
6164         * options.h (--section-ordering-file): New option.
6165         * output.cc (Output_section::input_section_order_specified_): New
6166         member.
6167         (Output_section::Output_section): Initialize new member.
6168         (Output_section::add_input_section): Add new parameter.
6169         Keep input sections when --section-ordering-file is used.
6170         (Output_section::set_final_data_size): Sort input sections when
6171         section ordering file is specified.
6172         (Output_section::Input_section_sort_entry): Add new parameter.
6173         Check sorting type.
6174         (Output_section::Input_section_sort_entry::compare_section_ordering):
6175         New method.
6176         (Output_section::Input_section_sort_compare::operator()): Change to
6177         consider section_order_index.
6178         (Output_section::Input_section_sort_init_fini_compare::operator()):
6179         Change to consider section_order_index.
6180         (Output_section::Input_section_sort_section_order_index_compare
6181         ::operator()): New method.
6182         (Output_section::sort_attached_input_sections): Change to sort
6183         according to section order when specified.
6184         (Output_section::add_input_section<32, true>): Add new parameter.
6185         (Output_section::add_input_section<64, true>): Add new parameter.
6186         (Output_section::add_input_section<32, false>): Add new parameter.
6187         (Output_section::add_input_section<64, false>): Add new parameter.
6188         * output.h (Output_section::add_input_section): Add new parameter.
6189         (Output_section::input_section_order_specified): New
6190         method.
6191         (Output_section::set_input_section_order_specified): New method.
6192         (Input_section::Input_section): Initialize section_order_index_.
6193         (Input_section::section_order_index): New method.
6194         (Input_section::set_section_order_index): New method.
6195         (Input_section::section_order_index_): New member.
6196         (Input_section::Input_section_sort_section_order_index_compare): New
6197         struct.
6198         (Output_section::input_section_order_specified_): New member.
6199         * script-sections.cc (is_wildcard_string): Delete and move modified
6200         method to gold.h.
6201         (Output_section_element_input::Output_section_element_input): Modify
6202         call to is_wildcard_string.
6203         (Output_section_element_input::Input_section_pattern
6204         ::Input_section_pattern): Ditto.
6205         (Output_section_element_input::Output_section_element_input): Ditto.
6206         * testsuite/Makefile.am (final_layout): New test case.
6207         * testsuite/Makefile.in: Regenerate.
6208         * testsuite/final_layout.cc: New file.
6209         * testsuite/final_layout.sh: New file.
6210
6211 2010-06-01  Rafael Espindola  <espindola@google.com>
6212
6213         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6214
6215 2010-06-01  Rafael Espindola  <espindola@google.com>
6216
6217         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6218         visibility of symbols.
6219
6220 2010-05-27  Doug Kwan  <dougkwan@google.com>
6221
6222         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6223         from start of output section instead of address for a local symbol
6224         in a merged or relaxed section when doing a relocatable link.
6225
6226 2010-05-26  Rafael Espindola  <espindola@google.com>
6227
6228         PR 11604
6229         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6230         adding sections the garbage collector removed.
6231         * gold/testsuite/Makefile.am: Add test.
6232         * gold/testsuite/Makefile.in: Regenerate.
6233         * gold/testsuite/plugin_test_7.sh: New.
6234         * gold/testsuite/plugin_test_7_1.c: New.
6235         * gold/testsuite/plugin_test_7_2.c: New.
6236
6237 2010-05-26  Rafael Espindola  <espindola@google.com>
6238
6239         * script-sections.cc (Output_section_definition::set_section_addresses):
6240         Check for --section-start.
6241
6242 2010-05-26  Doug Kwan  <dougkwan@google.com>
6243
6244         * arm.cc (Arm_scan_relocatable_relocs): New class.
6245         (Target_arm::relocate_special_relocatable): New method.
6246         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6247         (Arm_relocate_functions::thumb_branch_common): Same.
6248         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6249         instead of Default_scan_relocatable_relocs.
6250         * target-reloc.h (relocate_for_relocatable): Let target handle
6251         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6252         * target.h (Sized_target::relocate_special_relocatable): New method.
6253
6254 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6255
6256         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6257
6258 2010-05-23  Doug Kwan  <dougkwan@google.com>
6259
6260         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6261         instead of a cast.
6262         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6263         with a direct branch, not a conditional branch, to a stub.
6264         * merge.cc (Output_merge_base::record_input_section): New method
6265         defintion.
6266         (Output_merge_data::do_add_input_section): Record input section if
6267         keeps-input-sections flag is set.
6268         (Output_merge_string::do_add_input_section): Ditto.
6269         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6270         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6271         INPUT_SECTIONS_.
6272         (Output_merge_base::keeps_input_sections,
6273         Output_merge_base::set_keeps_input_sections,
6274         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6275         method definitions.
6276         (Output_merge_base::Input_sections): New type declaration.
6277         (Output_merge_base::input_sections_begin,
6278         Output_merge_base::input_sections_end,
6279         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6280         (Output_merge_base::bool keeps_input_sections_,
6281         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6282         Output_merge_base::input_sections_): New data members.
6283         (Output_merge_data::do_set_keeps_input_sections): New method
6284         defintion.
6285         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6286         * output.cc (Output_section::Input_section::relobj): Move method
6287         defintion from class declaration to here and handle merge sections.
6288         (Output_section::Input_section::shndx): Ditto.
6289         (Output_section::Output_section): Remove initializations of removed
6290         data members and initialize new data member LOOKUP_MAPS_.
6291         (Output_section::add_input_section): Set keeps-input-sections flag
6292         for a newly created merge output section as appropriate.  Adjust code
6293         to use Output_section_lookup_maps class.
6294         (Output_section::add_relaxed_input_section): Adjst code for lookup
6295         maps code refactoring.
6296         (Output_section::add_merge_input_section): Add a new parameter
6297         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6298         class.  If adding input section to a newly created merge output
6299         section fails, remove the new merge section.
6300         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6301         Adjust code for use of the Output_section_lookup_maps class.
6302         (Output_section::find_merge_section): Ditto.
6303         (Output_section::build_lookup_maps): New method defintion.
6304         (Output_section::find_relaxed_input_section): Adjust code to use
6305         Output_section_lookup_maps class.
6306         (Output_section::get_input_sections): Export merge sections.  Adjust
6307         code to use Output_section_lookup_maps class.
6308         (Output_section:::add_script_input_section): Adjust code to use
6309         Output_section_lookup_maps class.  Update lookup maps for merge
6310         sections also.
6311         (Output_section::discard_states): Use Output_section_lookup_maps.
6312         (Output_section::restore_states): Same.
6313         * output.h (Merge_section_properties): Move class defintion out of
6314         Output_section.
6315         (Output_section_lookup_maps): New class.
6316         (Output_section::Input_section::is_merge_section): New method
6317         defintion.
6318         (Output_section::Input_section::relobj): Move defintion out of class
6319         defintion.  Declare method only.
6320         (Output_section::Input_section::shndx): Ditto.
6321         (Output_section::Input_section::output_merge_base): New method defintion.
6322         (Output_section::Input_section::u2_.pomb): New union field.
6323         (Output_section::Merge_section_by_properties_map,
6324         Output_section::Output_section_data_by_input_section_map,
6325         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6326         Remove types.
6327         (Output_section::add_merge_input_section): Add new parameter
6328         KEEPS_INPUT_SECTIONS.
6329         (Output_section::build_lookup_maps): New method declaration.
6330         (Output_section::merge_section_map_,
6331         Output_section::merge_section_by_properties_map_,
6332         Output_section::relaxed_input_section_map_,
6333         Output_section::is_relaxed_input_section_map_valid_): Remove data
6334         members.
6335         (Output_section::lookup_maps_): New data member.
6336
6337 2010-05-21  Doug Kwan  <dougkwan@google.com>
6338
6339         PR gold/11619
6340         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6341         avoid a compilation error.
6342
6343 2010-05-19  Rafael Espindola  <espindola@google.com>
6344
6345         * script-sections.cc (Output_section_definition::allocate_to_segment):
6346         Update the phdrs_list even when the output section is NULL.
6347         * testsuite/Makefile.am: Add test.
6348         * testsuite/Makefile.in: Regenerate.
6349         * testsuite/script_test_9.cc: New.
6350         * testsuite/script_test_9.sh: New.
6351         * testsuite/script_test_9.t: New.
6352
6353 2010-05-19  Doug Kwan  <dougkwan@google.com>
6354
6355         * arm.cc (Arm_input_section::original_size): New method.
6356         (Arm_input_section::do_addralign): Add a cast.
6357         (Arm_input_section::do_output_offset): Remove static cast.
6358         (Arm_input_section::original_addralign,
6359          Arm_input_section::original_size_): Change type to uint32_t.
6360         (Arm_input_section::init): Add safe casts for section alignment
6361         and size.
6362         (Arm_input_section::set_final_data_size): Do not set address and
6363         offset of stub table.
6364         (Arm_output_section::fix_exidx_coverage): Change use of of
6365         Output_section::Simple_input_section to that of
6366         Output_section::Input_section.
6367         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6368         except for the first pass.
6369         * output.cc (Output_section::get_input_sections): Change type of
6370         input_sections to std::list<Input_section>.
6371         (Output_section::add_script_input_section): Rename from
6372         Output_section::add_simple_input_section.  Change type of SIS
6373         parameter from Simple_input_section to Input_section.
6374         * output.h (Output_section::Simple_input_section): Remove class.
6375         (Output_section::Input_section): Change class visibility to public.
6376         (Output_section::Input_section::addralign): Use stored alignments
6377         for special input sections if set.
6378         (Output_section::Input_section::set_addralign): New method.
6379         (Output_section::get_input_sections): Change parameter type from
6380         list of Simple_input_section to list of Input_section.
6381         (Output_section::add_script_input_section): Rename from
6382         Output_section::add_simple_input_section. Change first parameter's
6383         type from Simple_input_section to Input_section and remove the
6384         second and third parameters.
6385         * script-sections.cc (Input_section::Input_section_list): Change
6386         type to list of Output_section::Input_section/
6387         (Input_section_info::Input_section_info): Change parameter type of
6388         INPUT_SECTION to Output_section::Input_section.
6389         (Input_section_info::input_section): Change return type.
6390         (Input_section_info::input_section_): Change type to
6391         Output_section::Input_section.
6392         (Output_section_element_input::set_section_addresses): Adjust code
6393         to use Output_section::Input_section instead of
6394         Output_section::Simple_input_section.  Adjust code for renaming
6395         of Output_section::add_simple_input_section.
6396         (Orphan_output_section::set_section_addresses): Ditto.
6397
6398 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6399
6400         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6401         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6402
6403 2010-05-18  Rafael Espindola  <espindola@google.com>
6404
6405         * options.cc (General_options::finalize): Handle -nostdlib.
6406         * options.h (nostdlib): New option.
6407         * script.cc (script_add_search_dir): Handle -nostdlib.
6408
6409 2010-05-12  Doug Kwan  <dougkwan@google.com>
6410
6411         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6412         attributes section only if there no attributes section after merging.
6413         (Target_arm::merge_object_attributes): Move value of
6414         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6415         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6416         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6417         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6418         and arm_attr_merge_7.stdout.
6419         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6420         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6421         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6422         arm_attr_merge_7b.o): New rules.
6423         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6424         arm_attr_merge_7
6425         * testsuite/Makefile.in: Regenerate.
6426         * testsuite/arm_attr_merge.sh: New file.
6427         * testsuite/arm_attr_merge_[67][ab].s: Same.
6428
6429 2010-05-05  Nick Clifton  <nickc@redhat.com>
6430
6431         * po/es.po: Updated Spanish translation.
6432
6433 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6434
6435         * Makefile.am (install-exec-local): Properly install gold as
6436         default cross linker.
6437         * Makefile.in: Regenerated.
6438
6439 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6440             Nick Clifton  <nickc@redhat.com>
6441
6442         * configure.ac (install_as_default): Define and set to false
6443         unless --enable-gold or --enable-gold=both/gold has been
6444         specified.
6445         * configure: Regenerate.
6446
6447         * Makefile.am (install-exec-local): Install the executable as
6448         'ld.gold'.  If install_as_default is true then also install it as
6449         'ld'.
6450         * Makefile.in: Regenerated.
6451
6452 2010-04-24  Ian Lance Taylor  <iant@google.com>
6453
6454         * layout.cc (Layout::layout_reloc): In relocatable link don't
6455         combine reloc sections for grouped sections.
6456
6457 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6458
6459         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6460         sections that are not ordinary to icf.
6461         * icf.cc (get_section_contents): Handle relocation pointing to section
6462         with no object or shndx information.
6463         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6464         * testsuite/Makefile.in: Regenerate.
6465         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6466         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6467
6468 2010-04-22  Ian Lance Taylor  <iant@google.com>
6469
6470         * expression.cc (Expression::Expression_eval_info): Add
6471         result_alignment_pointer field.
6472         (Expression::eval_with_dot): Add result_alignment_pointer
6473         parameter.  Change all callers.
6474         (Expression::eval_maybe_dot): Likewise.
6475         (class Binary_expression): Add alignment_pointer parameter to
6476         left_value and right_value.  Change all callers.
6477         (BINARY_EXPRESSION): Set result alignment.
6478         (class Trinary_expression): Add alignment_pointer parameter to
6479         arg2_value and arg3_value.  Change all callers.
6480         (Trinary_cond::value): Set result alignment.
6481         (Max_expression::value, Min_expression::value): Likewise.
6482         (Align_expression::value): Likewise.
6483         * script-sections.cc (class Sections_element): Add dot_alignment
6484         parameter to set_section_addresses virtual function.  Update
6485         instantiations.
6486         (class Output_section_element): Likewise.
6487         (Script_sections::create_segments): Add dot_alignment parameter.
6488         Change all callers.
6489         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6490         (Script_sections::set_phdrs_clause_addresses): Likewise.
6491         * script-sections.h: Update declarations.
6492         * script.h: Update declarations.
6493         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6494         min_p_align.
6495         * testsuite/script_test_3.t: Set large alignment.
6496         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6497         segment has expected alignment.
6498
6499 2010-04-22  Nick Clifton  <nickc@redhat.com>
6500
6501         * po/gold.pot: Updated by the Translation project.
6502         * po/vi.po: Updated Vietnamese translation.
6503
6504 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6505
6506         * testsuite/Makefile.am (check_PROGRAMS): Add
6507         icf_virtual_function_folding_test.
6508         * testsuite/Makefile.in: Regenerated.
6509
6510 2010-04-15  Andrew Haley  <aph@redhat.com>
6511
6512         * options.h (merge_exidx_entries): New option.
6513         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6514         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6515         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6516         (Target_arm::merge_exidx_entries): New function.
6517         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6518         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6519         to Arm_exidx_fixup constructor.
6520         Add new arg, merge_exidx_entries.
6521         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6522         Arm_output_section::fix_exidx_coverage.
6523
6524 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6525
6526         * icf.cc (get_section_contents): Check for preemptible functions.
6527         Ignore addend when appropriate.
6528         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6529         section folded.
6530         (add_from_relobj): Check for section folded.
6531         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6532         * symtab.h (should_add_dynsym_entry): Add new parameter.
6533         * target-reloc.h (scan_relocs): Check for section folded.
6534         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6535         Check reloc types for function pointers in shared objects.
6536         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6537         case.
6538         (icf_preemptible_functions_test): New test case.
6539         (icf_string_merge_test): New test case.
6540         * testsuite.Makefile.in: Regenerate.
6541         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6542         bar_glob.  Refactor code.
6543         * testsuite/icf_preemptible_functions_test.cc: New file.
6544         * testsuite/icf_preemptible_functions_test.sh: New file.
6545         * testsuite/icf_string_merge_test.cc: New file.
6546         * testsuite/icf_string_merge_test.sh: New file.
6547         * testsuite/icf_virtual_function_folding_test.cc: New file.
6548         * testsuite/icf_virtual_function_folding_test.sh: New file.
6549
6550 2010-04-14  Doug Kwan  <dougkwan@google.com>
6551
6552         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6553         for local symbol recounting if we remove a section due to ICF.
6554         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6555         there are no regular objects in input.
6556
6557 2010-04-13  Doug Kwan  <dougkwan@google.com>
6558
6559         * arm.cc (Arm_input_section::set_final_data_size): Compute
6560         accurate final data size instead of using current data size.
6561
6562 2010-04-09  Doug Kwan  <dougkwan@google.com>
6563
6564         * layout.cc (Layout::choose_output_section): Handle script section
6565         types.
6566         (Layout::make_output_section_for_script): Add section type parameter.
6567         Handle script section types.
6568         * layout.h (Layout::make_output_section_for_script): Add section
6569         type parameter.
6570         * output.cc (Output_section::Output_section): Initialize data member
6571         is_noload_.
6572         (Output_section::do_reset_address_and_file_offset): Do not set address
6573         to 0 if section is a NOLOAD section.
6574         * output.h (Output_section::is_noload): New method.
6575         (Output_section::set_is_noload): Ditto.
6576         (Output_section::is_noload_): New data member.
6577         * script-c.h (Script_section_type): New enum type.
6578         (struct Parser_output_section_header): Add new file section_type.
6579         * script-sections.cc (Sections_element::output_section_name): Add
6580         parameter for returning script section type.
6581         (Output_section_definition::output_section_name): Ditto.
6582         (Output_section_definition::section_type)P; New method.
6583         (Output_section_definiton::script_section_type_name): Ditto.
6584         (Output_section_definition::script_section_type_): New data member.
6585         (Output_section_definition::Output_section_definition): Initialize
6586         data member Output_section_definition::script_section_type_.
6587         (Output_section_definition::create_sections): Pass script section type
6588         to Layout::make_output_section_for_script.
6589         (Output_section_definition::output_section_name): Return script
6590         section type to caller.
6591         (Output_section_definition::set_section_address): Do not advance
6592         dot value and load address if section type is NOLOAD.  Set address
6593         of NOLOAD sections regardless of section flags.
6594         (Output_section_definition::print): Print section type if it is
6595         not SCRIPT_SECTION_TYPE_NONE.
6596         (Output_section_definition::section_type): New method.
6597         (Output_section_definition::script_section_type_name): Ditto.
6598         (Script_sections::output_section_name): Add new parameter
6599         PSECTION_TYPE for returning script section type.  Pass it to
6600         section elements.  Handle discard sections.
6601         (Sort_output_sections::operator()): Handle NOLOAD sections.
6602         * script-sections.h (Script_sections::Section_type): New enum type.
6603         (Script_sections::output_section_name): Add a new parameter for
6604         returning script section type.
6605         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6606         INFO and NOLOAD.
6607         * yyscript.y (union): Add new field SECTION_TYPE.
6608         (COPY, DSECT, INFO, NOLOAD): New tokens.
6609         (opt_address_and_section_type): Change type to output_section_header.
6610         (section_type): New non-terminal
6611         (section_header): Handle section type.
6612         (opt_address_and_section_type): Return section type value.
6613
6614 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6615
6616         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6617         * testsuite/plugin_common_test_2.c (foo): Likewise.
6618
6619 2010-04-08  Doug Kwan  <dougkwan@google.com>
6620
6621         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6622         Output_merge_data.
6623         * output.cc (Output_section::add_merge_input_section): Simplify
6624         code and return status of Output_merge_base::add_input_section.
6625         Update merge section map only if Output_merge_base::add_input_section
6626         returns true.
6627
6628 2010-04-07  Doug Kwan  <dougkwan@google.com>
6629
6630         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6631         if section is marked as containing instructions but has no mapping
6632         symbols.
6633         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6634         correct section index.
6635         (Arm_relobj::find_linked_text_section): Ditto.
6636
6637 2010-04-07  Cary Coutant  <ccoutant@google.com>
6638
6639         * archive.cc (include_member): Destroy Read_symbols_data object before
6640         releasing file.
6641         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6642         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6643         (Read_symbols_data::~Read_symbols_data) New destructor.
6644         (Section_relocs::Section_relocs) New constructor.
6645         (Section_relocs::~Section_relocs) New destructor.
6646         (Read_relocs_data::Read_relocs_data) New constructor.
6647         (Read_relocs_data::~Read_relocs_data) New destructor.
6648         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6649         pointers to NULL after deleting.
6650
6651 2010-04-07  Doug Kwan  <dougkwan@google.com>
6652
6653         * arm.cc: Replace "endianity" with "endianness" in comments.
6654         (Arm_exidx_cantunwind): Ditto.
6655         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6656         (Arm_relobj::merge_flags_and_attributes): New method.
6657         (Arm_relobj::merge_flags_and_attributes_): New data member.
6658         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6659         (Arm_relobj::scan_sections_for_stubs): Ditto.
6660         (Arm_relobj::do_read_symbols): Check to see if we really want to
6661         merge processor-specific flags and attributes.  Exit early if
6662         an object is empty except for section names and the undefined symbol.
6663         (Target_arm::do_finalize_sections): Move check for ELF format to
6664         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6665         attributes from a regular object only when we have determined that
6666         it is aapropriate.  Do not create an .ARM.attributes section in
6667         output if there is no regular input object.
6668         (Target_arm::merge_processor_specific_flags): Check
6669         --warn-mismatch before printing any error.
6670         (Target_arm::merge_object_attributes): Ditto.
6671         * gold.cc (queue_middle_tasks): Handle the case in which there is
6672         no regular object in input.
6673         * options.cc (General_options::parse_EB): New method.
6674         (General_options::parse_EL): Same.
6675         (General_options::General_options): Initialize endianness_.
6676         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6677         New options.
6678         (General_options::Endianness): New enum.
6679         (General_options::endianness): New method.
6680         (General_options::endianness_): New data member.
6681         * parameters.cc (Parameters::set_options): Check target endianness.
6682         (Parameters::set_target_once): Ditto.
6683         (Parameters::check_target_endianness): New method.
6684         (parameters_force_valid_target): If either -EL or -EB is specified,
6685         use it to define endianness of default target.
6686         * parameters.h (Parameters::check_target_endianness): New method
6687         declaration.
6688         * target.h (class Target): Change "endianity" to "endianness"
6689         in comments.
6690
6691 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6692
6693         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6694         * configure: Regenerate.
6695         * Makefile.in: Regenerate.
6696         * testsuite/Makefile.in: Regenerate.
6697
6698 2010-04-06  Cary Coutant  <ccoutant@google.com>
6699
6700         gcc PR lto/42757
6701         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6702         prevailing definitions of common symbols.
6703         * testsuite/plugin_test_6.sh: New test case.
6704         * testsuite/plugin_common_test_1.c: New test case.
6705         * testsuite/plugin_common_test_2.c: New test case.
6706         * testsuite/Makefile.am (plugin_test_6): New test case.
6707         * testsuite/Makefile.in: Regenerate.
6708
6709 2010-04-06  Nick Clifton  <nickc@redhat.com>
6710
6711         * po/vi.po: New Vietnamese translation.
6712
6713 2010-03-30  Doug Kwan  <dougkwan@google.com>
6714
6715         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6716
6717 2010-03-25  Doug Kwan  <dougkwan@google.com>
6718
6719         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6720         to avoid a conversion warning on a 32-bit host.
6721
6722 2010-03-24  Ian Lance Taylor  <iant@google.com>
6723
6724         * testsuite/script_test_3.t: Add a TLS segment.
6725         * testsuite/Makefile.am (check_PROGRAMS): Add
6726         tls_phdrs_script_test.
6727         (tls_phdrs_script_test_SOURCES): Define.
6728         (tls_phdrs_script_test_DEPENDENCIES): Define.
6729         (tls_phdrs_script_test_LDFLAGS): Define.
6730         (tls_phdrs_script_test_LDADD): Define.
6731         * testsuite/Makefile.in: Rebuild.
6732
6733 2010-03-23  Cary Coutant  <ccoutant@google.com>
6734
6735         * fileread.cc (find_or_make_view): Fix comment.
6736
6737 2010-03-23  Ian Lance Taylor  <iant@google.com>
6738
6739         * script-sections.cc (class Orphan_section_placement): Define
6740         PLACE_TLS and PLACE_TLS_BSS.
6741         (Orphan_section_placement::Orphan_section_placement): Initialize
6742         new places.
6743         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6744         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6745         (tls_script_test_SOURCES): Define.
6746         (tls_script_test_DEPENDENCIES): Define.
6747         (tls_script_test_LDFLAGS): Define.
6748         (tls_script_test_LDADD): Define.
6749         * testsuite/Makefile.in: Rebuild.
6750
6751 2010-03-22  Doug Kwan  <dougkwan@google.com>
6752
6753         * arm.cc (Arm_relocate_functions::abs8,
6754         Arm_relocate_functions::abs16): Use correct check for overflow
6755         specified in the ARM ELF specs.
6756         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6757         target of a BLX instruction specially.
6758         (Reloc_stub::stub_type_for_reloc): Ditto.
6759         (Relocate::relocate): Use symbolic names instead of numeric relocation
6760         codes to report error.
6761         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6762         workaround.
6763         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6764         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6765         thumb2_blx_out_of_range.stdout
6766         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6767         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6768         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6769         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6770         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6771         thumb2_blx_in_range, thumb2_blx_in_range.o,
6772         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6773         thumb2_blx_out_of_range.o): New rules.
6774         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6775         thumb2_blx_in_range and thumb2_blx_out_of_range.
6776         * testsuite/Makefile.in: Regenerate.
6777         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6778         * testsuite/thumb_blx_in_range.s: New file.
6779         * testsuite/thumb_blx_out_of_range.s: New file.
6780
6781 2010-03-22  Rafael Espindola  <espindola@google.com>
6782
6783         * archive.cc (Should_include): Move to archive.h.
6784         (should_include_member): Make it a member of Archive.
6785         (Lib_group): New.
6786         (Add_lib_group_symbols): New.
6787         * archive.h: Include options.h.
6788         (Archive_member): Moved from Archive.
6789         (Should_include): Moved from archive.cc.
6790         (Lib_group): New.
6791         (Add_lib_group_symbols): New.
6792         * dynobj.cc (do_should_include_member): New.
6793         * dynobj.h (do_should_include_member): New.
6794         * gold.cc (queue_initial_tasks): Update call to queue.
6795         * main.cc (main): Print lib group stats.
6796         * object.cc (do_should_include_member): New.
6797         * object.h: Include archive.h.
6798         (Object::should_include_member): New.
6799         (Object::do_should_include_member): New.
6800         (Sized_relobj::do_should_include_member): New.
6801         * options.cc (General_options::parse_start_lib): New.
6802         (General_options::parse_end_lib): New.
6803         (Input_arguments::add_file): Handle lib groups.
6804         (Input_arguments::start_group): Check we are not in a lib.
6805         (Input_arguments::start_lib): New.
6806         (Input_arguments::end_lib): New.
6807         * options.h (General_options): Add start_lib and end_lib.
6808         (Input_argument::lib_): New.
6809         (Input_argument::lib): New.
6810         (Input_argument::is_lib): New.
6811         (Input_file_lib): New.
6812         (Input_arguments::in_lib_): New.
6813         (Input_arguments::in_lib): New.
6814         (Input_arguments::start_lib): New.
6815         (Input_arguments::end_lib_): New.
6816         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6817         in unused members as preempted.
6818         (Sized_pluginobj::do_should_include_member): New.
6819         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6820         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6821         return the blocker.
6822         (Read_symbols::do_whole_lib_group): New.
6823         (Read_symbols::do_lib_group): New.
6824         (Read_symbols::do_read_symbols): Handle lib groups.
6825         (Read_symbols::get_name): Handle lib groups.
6826         * readsyms.h (Read_symbols): Add an archive member pointer.
6827         (Read_symbols::do_whole_lib_group): New.
6828         (Read_symbols::do_lib_group): New.
6829         (Read_symbols::member_): New.
6830         * script.cc (read_input_script): Update call to queue_soon.
6831
6832 2010-03-19  Doug Kwan  <dougkwan@google.com>
6833
6834         * arm.cc (Stub_table::Stub_table): Initialize new data members
6835         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6836         (Stub_table::add_reloc_stub): Assign stub offset and update
6837         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6838         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6839         New data members.
6840         (Stub_table::update_data_size_and_addralign): Use
6841         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6842         instead of going over all reloc stubs.
6843         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6844         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6845         Stringpool_template::offset_ to size of Stringpool_char.
6846         (Stringpool_template::new_key_offset): Remove code to initialize
6847         Stringpool_template::offset_.
6848         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6849         Stringpool_template::offset_ to zero.
6850
6851 2010-03-15  Doug Kwan  <dougkwan@google.com>
6852
6853         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6854         offset_.
6855         (Stringpool_template::new_key_offset): New method.
6856         (Stringpool_template::add_string): Assign offsets when adding new
6857         strings.
6858         (Stringpool_template::set_string_offsets): Do not set string offsets
6859         when not optimizing.
6860         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6861         member size_.
6862         (Chunked_vector::clear): Clear size_.
6863         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6864         (Chunked_vector::size): Return size_.
6865         (Chunked_vector::push_back): Use size_ to find insert position.
6866         (Chunked_vector::size_): New data member.
6867         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6868         (Stringpool_template::new_key_offset): New method declaration.
6869         (Stringpool_template::offset_): New data member.
6870
6871 2010-03-15   Rafael Espindola  <espindola@google.com>
6872
6873         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6874         Add_symbols' constructor.
6875         * readsyms.h (Add_symbols): Remove the input_group member.
6876
6877 2010-03-10  Ian Lance Taylor  <iant@google.com>
6878
6879         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6880         target to ask whether a reference to a symbol requires a stack
6881         split.
6882         * target.h (Target::is_call_to_non_split): New function.
6883         (Target::do_is_call_to_non_split): Declare virtual function.
6884         * target.cc: Include "symtab.h".
6885         (Target::do_is_call_to_non_split): New function.
6886         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6887
6888 2010-03-10  Cary Coutant  <ccoutant@google.com>
6889
6890         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6891         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6892         (File_read::open[2]): Add whole_file_view_ to list of views.
6893         (File_read::make_view): Remove test of whole_file_view_.
6894         (File_read::find_or_make_view): Create whole_file_view_ if
6895         necessary.
6896         (File_read::clear_views): Replace bool parameter with enum;
6897         adjust all callers.  Don't delete views with permanent data;
6898         do delete cached views and views from archives if
6899         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6900         if clearing the corresponding view.
6901         * fileread.h (File_read::Clear_views_mode): New enum.
6902         (File_read::View::is_permanent_view): New method.
6903         (File_read::clear_views): Replace bool parameter
6904         with enum; adjust all callers.
6905         * options.h (General_options): Change keep_files_mapped option;
6906         add map_whole_files.
6907         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6908         releasing the file.
6909         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6910         the file.
6911
6912 2010-03-10  David S. Miller  <davem@davemloft.net>
6913
6914         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6915
6916 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6917
6918         * icf.cc (get_section_contents): Add '@' marker after processing the
6919         merge reloc.
6920
6921 2010-03-08  Doug Kwan  <dougkwan@google.com>
6922
6923         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6924         due to a conversion warning.
6925         (Arm_relobj::update_output_local_symbol_count): Check for local
6926         symbol with unset output index.
6927
6928 2010-03-05  Ian Lance Taylor  <iant@google.com>
6929
6930         * options.h (class General_options): Add --spare-dynamic-tags.
6931         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6932         --spare-dynamic-tags.
6933
6934 2010-03-05  Ian Lance Taylor  <iant@google.com>
6935
6936         * incremental.cc: Include "libiberty.h".
6937
6938 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6939
6940         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6941         function, is_info_ member.
6942         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6943         (Versions::Versions): Update caller.
6944         (Versions::define_base_version): Likewise.
6945         (Versions::add_def): Likewise.
6946
6947 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6948
6949         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6950         (Scan::possible_function_pointer_reloc): New function.
6951         (Scan::local_reloc_may_be_function_pointer): Change to call
6952         possible_function_pointer_reloc.
6953         (Scan::global_reloc_may_be_function_pointer): Ditto.
6954         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6955         relocations in ".data.rel.ro._ZTV" section.
6956         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6957         * testsuite/icf_safe_so_test.cc: Ditto.
6958         * testsuite/icf_safe_test.cc: Ditto.
6959         * testsuite/icf_safe_test.sh: Ditto.
6960
6961 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6962             Ian Lance Taylor  <iant@google.com>
6963
6964         * target-reloc.h (relocate_section): Check the symbol table index
6965         for -1U before setting the local symbol index.
6966         (scan_relocatable_relocs): If copying the relocation, record that
6967         the local symbol is required.
6968         * object.h (Symbol_value::is_output_symtab_index_set): New
6969         function.
6970         (Symbol_value::may_be_discarded_from_output_symtab): New
6971         function.
6972         (Symbol_value::has_output_symtab_entry): New function.
6973         (Symbol_value::needs_output_symtab_entry): Remove.
6974         (Symbol_value::output_symtab_index): Make sure the symbol index is
6975         set.
6976         (Symbol_value::set_output_symtab_index): Make sure the symbol
6977         index is not set.  Make sure the new index is valid.
6978         (Symbol_value::set_must_have_output_symtab_entry): New function.
6979         (Symbol_value::has_output_dynsym_entry): New function.
6980         (Symbol_value::set_output_dynsym_index): Make sure the new index
6981         is valid.
6982         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6983         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6984         local symbol if permitted.
6985         (Sized_relobj::do_finalize_local_symbols): Call
6986         is_output_symtab_index_set rather than needs_output_symtab_entry.
6987         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6988         rather than needs_output_symtab_entry.  Call
6989         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6990         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6991         is_output_symtab_index_set rather than needs_output_symtab_entry.
6992         * testsuite/discard_locals_relocatable_test.c: New file.
6993         * testsuite/discard_locals_test.sh: Test -r.
6994         * testsuite/Makefile.am (check_DATA): Add
6995         discard_locals_relocatable_test1.syms,
6996         discard_local_relocatable_test2.syms.
6997         (MOSTLYCLEANFILES): Likewise.  Also add
6998         discard_locals_relocatable_test1.lout and
6999         discard_locals_relocatable_test2.out.
7000         (discard_locals_relocatable_test1.syms): New target.
7001         (discard_locals_relocatable_test.o): New target.
7002         (discard_locals_relocatable_test1.out): New target.
7003         (discard_locals_relocatable_test2.syms): New target.
7004         (discard_locals_relocatable_test2.out): New target.
7005         (various): Add missing ../ld-new dependencies.
7006         * testsuite/Makefile.in: Rebuild.
7007
7008 2010-03-03  Nick Clifton  <nickc@redhat.com>
7009
7010         * po/fi.po: New Finnish translation.
7011
7012 2010-03-01  Doug Kwan  <dougkwan@google.com>
7013
7014         * layout.cc (Layout::Layout): Force section types of .init_array*,
7015         .preinit_array* and .fini_array* sections.
7016         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7017         Fix check of return value of std::string::find.().
7018         (Output_section::Input_section_sort_compare::operator()): Remove
7019         comment about .init_array.
7020         (Output_section::Input_section_sort_init_fini_compare::operator()):
7021         New method.
7022         (Output_section::sort_attached_input_sections): Handle .init_array
7023         and .fini_array specially.
7024         * output.h (Output_section::Inut_section_sort_compare): Update
7025         comment.
7026         (Output_section::Input_section_sort_init_fini_compare): New struct.
7027
7028 2010-02-26  Doug Kwan  <dougkwan@google.com>
7029
7030         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7031         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7032         * testsuite/debug_msg.sh: Avoid matching source line number for
7033         use of global variable undef_int.
7034
7035 2010-02-26  Doug Kwan  <dougkwan@google.com>
7036
7037         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7038         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7039         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7040         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7041         * options.cc (General_options::General_options): Initialize member
7042         fix_v4bx_.
7043         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7044         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7045         and rm_no_fix_v4bx.stdout
7046         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7047         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7048         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7049         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7050         and arm_no_fix_v4bx.
7051         * Makefile.in: Regenerate.
7052         * testsuite/arm_fix_v4bx.s: New file.
7053         * testsuite/arm_fix_v4bx.sh: Ditto.
7054
7055 2010-02-24  Doug Kwan  <dougkwan@google.com>
7056
7057         * arm.cc (Target_arm::got_section): Make the .got section the first
7058         non RELRO section in the data segment.
7059         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7060         suffixes of section names.
7061
7062 2010-02-24  Doug Kwan  <dougkwan@google.com>
7063
7064         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7065         flags and attributes merging if an input file is a binary file.
7066         * fileread.cc (Input_file::open): Record format of original file.
7067         * fileread.h (Input_file::Format): New enum type.
7068         (Input_file::Input_file): Initialize data member format_.
7069         (Input_file::format): New method definition.
7070         (Input_file::format_):: New data member.
7071
7072 2010-02-24  Doug Kwan  <dougkwan@google.com>
7073
7074         * arm.cc (Arm_output_data_got): New class.
7075         (ARM_TCB_SIZE): New constant
7076         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7077         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7078         If user uses a script with a SECTIONS clause, issue only a warning
7079         for a misplaced EXIDX input section.  Otherwise, issue an error.
7080         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7081         garbage collection.
7082         (Target_arm::got_mode_index_entry): Handle static linking.
7083         (Target_arm::Scan::local): Ditto.
7084         (Target_arm::Scan::global): Ditto.
7085         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7086         all incorrectly implemented relocations.
7087         (Target_arm::fix_exidx_coverage): Pass layout to
7088         Arm_output_section::fix_exidx_coverage.
7089         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7090         from ".ARM.exidx." and ".ARM.extab.".
7091
7092 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7093
7094         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7095         section if it does not already exist.
7096         * attributes.cc (Attributes_section_data::Attributes_section_data):
7097         Don't crash if size is zero.
7098
7099 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7100             Ian Lance Taylor  <iant@google.com>
7101
7102         * gold.cc (queue_middle_tasks): If no input files were opened,
7103         exit.
7104         * workqueue.h (Task_function::Task_function): Assert that there is
7105         a blocker.
7106
7107 2010-02-22  Doug Kwan  <dougkwan@google.com>
7108
7109         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7110         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7111         types to avoid warnings due to different uint64_t implementations
7112         on different hosts.
7113
7114 2010-02-21  Doug Kwan  <dougkwan@google.com>
7115
7116         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7117         handling of the maximum backward branch offset.
7118         (Arm_relocate_functions::thumb_branch_common): Ditto.
7119         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7120         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7121         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7122         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7123         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7124         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7125         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7126         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7127         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7128         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7129         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7130         thumb2_bl_out_of_range.o): New rules.
7131         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7132         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7133         thumb2_bl_out_of_range
7134         * testsuite/Makefile.in: Regenerate.
7135         * testsuite/arm_bl_in_range.s: New file.
7136         * testsuite/arm_bl_out_of_range.s: Ditto.
7137         * testsuite/arm_branch_in_range.sh: Ditto.
7138         * testsuite/arm_branch_range.t: Ditto.
7139         * testsuite/thumb2_branch_range.t: Ditto.
7140         * testsuite/thumb_bl_in_range.s: Ditto.
7141         * testsuite/thumb_bl_out_of_range.s: Ditto.
7142         * testsuite/thumb_branch_range.t: Ditto.
7143
7144 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7145
7146         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7147         Add reloc offset information.
7148         * icf.cc (get_section_contents): Change iterators to point to the new
7149         vectors. Add reloc offset information to the contents.
7150         * icf.h (Icf::Sections_reachable_info): New typedef.
7151         (Icf::Sections_reachable_list): New typedef.
7152         (Icf::Offset_info): New typedef.
7153         (Icf::Reloc_info): New struct typedef.
7154         (Icf::Reloc_info_list): New typedef.
7155         (Icf::symbol_reloc_list): Delete method.
7156         (Icf::addend_reloc_list): Delete method.
7157         (Icf::section_reloc_list): Delete method.
7158         (Icf::reloc_info_list): New method.
7159         (Icf::reloc_info_list_): New member.
7160
7161 2010-02-19  Doug Kwan  <dougkwan@google.com>
7162
7163         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7164         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7165         * arm.cc (Arm_relocation_functions): New forward declaration.
7166         (Target_arm::Target_arm): Initialize new data members
7167         got_mod_index_offset_ and tls_base_symbol_defined_.
7168         (Target_arm::Relocate::relocate_tls): New method.
7169         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7170          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7171         New methods.
7172         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7173         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7174         (Target_arm::got_mod_index_offset_,
7175         Target_arm::tls_base_symbol_defined_): New data members.
7176         (Target_arm::Scan::local, Target::Scan::global,
7177         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7178         relocations.
7179
7180 2010-02-18  Doug Kwan  <dougkwan@google.com>
7181
7182         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7183         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7184         text section as a parameter becuase some broken tools may not set
7185         the link in section header.
7186         (Target_arm::has_got_section): New method.
7187         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7188         without any mapping symbol as data only.  Remove warning.
7189         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7190         link in its section header, try to discover the link by inspecting the
7191         REL31 relocation at the beginning of the section.
7192         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7193         in error message.
7194         (Target_arm::Scan::global): Treat any reference to the symbol
7195         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7196
7197 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7198
7199         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7200         (Scan::global_reloc_may_be_function_pointer): New function.
7201         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7202         (Scan::global_reloc_may_be_function_pointer): New function.
7203         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7204         (Scan::global_reloc_may_be_function_pointer): New function.
7205         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7206         (Scan::global_reloc_may_be_function_pointer): New function.
7207         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7208         (Scan::global_reloc_may_be_function_pointer): New function.
7209         (Scan::possible_function_pointer_reloc): New function.
7210         (Target_x86_64::can_check_for_function_pointers): New function.
7211         * gc.h (gc_process_relocs): Scan relocation types to determine if
7212         function pointers were taken for targets that support it.
7213         * icf.cc (Icf::find_identical_sections): Include functions for
7214         folding in safe ICF whose pointer is not taken.
7215         * icf.h (Secn_fptr_taken_set): New typedef.
7216         (fptr_section_id_): New member.
7217         (section_has_function_pointers): New function.
7218         (set_section_has_function_pointers): New function.
7219         (check_section_for_function_pointers): New function.
7220         * options.h: Fix comment for safe ICF option.
7221         * target.h (can_check_for_function_pointers): New function.
7222         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7223         Modify icf_safe_test for X86-64.
7224         * testsuite/Makefile.in: Regenerate.
7225         * testsuite/icf_safe_so_test.cc: New file.
7226         * testsuite/icf_safe_so_test.sh: New file.
7227         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7228         (main): Change to take pointer to function kept_func_3.
7229         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7230         folding is done correctly for X86-64.
7231
7232 2010-02-12  David S. Miller  <davem@davemloft.net>
7233
7234         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7235         is_symbolless parameter.
7236         (Output_reloc<SHT_REL>::is_symbolless): New.
7237         (Output_reloc<SHT_REL>::is_symbolless_): New.
7238         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7239         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7240         (Output_reloc<SHT_RELA>::is_symbolless): New.
7241         (Output_data_reloc::add_global): Handle is_symbolless.
7242         (Output_data_reloc::add_global_relative): Likewise.
7243         (Output_data_reloc::add_local): Likewise.
7244         (Output_data_reloc::add_local_relative): Likewise.
7245         (Output_data_reloc::add_symbolless_global_addend): New.
7246         (Output_data_reloc::add_symbolless_local_addend): New.
7247         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7248         is_symbolless.
7249         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7250         instead of ->is_relative_
7251         (Output_reloc::write): Likewise.
7252         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7253         (Output_reloc::write_rel): Simplify.
7254
7255         * sparc.cc (Target_sparc::Scan::local): Use
7256         ->add_symbolless_local_addend as needed.
7257         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7258         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7259         based upon relocation offset.
7260
7261 2010-02-11  Doug Kwan  <dougkwan@google.com>
7262
7263         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7264         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7265         beginning of function.
7266         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7267         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7268         parameter is_32bit in calls to should_apply_static_reloc.
7269         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7270         (check_DATA): Add arm_abs_global.stdout.
7271         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7272         arm_abs_global.stdout): New rules.
7273         (MOSTLLYCLEANFILES): Add arm_abs_global
7274         * Makefile.in: Regenerate.
7275         * testsuite/arm_abs_global.s: New file.
7276         * testsuite/arm_abs_global.sh: Ditto.
7277         * testsuite/arm_abs_lib.s: Ditto.
7278
7279 2010-02-11  Ian Lance Taylor  <iant@google.com>
7280
7281         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7282         Read_relocs task.
7283         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7284         Allocate_commons_task first.
7285         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7286         task, rather than symtab_lock_.
7287         (Gc_process_relocs::~Gc_process_relocs): New function.
7288         (Gc_process_relocs::is_runnable): Check this_blocker_.
7289         (Gc_process_relocs::locks): Use next_blocker_ rather than
7290         blocker_.
7291         (Scan_relocs::~Scan_relocs): New function.
7292         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7293         symtab_lock_.
7294         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7295         next_blocker_.
7296         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7297         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7298         constructor accordingly.
7299         (class Gc_process_relocs): Likewise.
7300         (class Scan_relocs): Likewise.
7301         * common.h (class Allocate_commons_task): Remove symtab_lock_
7302         field, and corresponding constructor parameter.
7303         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7304         symtab_lock_.
7305         (Allocate_commons_task::locks): Likewise.
7306
7307 2010-02-11  Ian Lance Taylor  <iant@google.com>
7308
7309         * gold-threads.h (class Once): Define.
7310         (class Initialize_lock): Rewrite as child of Once.
7311         * gold-threads.cc (class Once_initialize): Define.
7312         (once_pointer_control): New static variable.
7313         (once_pointer, once_arg): New static variables.
7314         (c_run_once): New static function.
7315         (Once::Once, Once::run_once, Once::internal_run): New functions.
7316         (class Initialize_lock_once): Remove.
7317         (initialize_lock_control): Remove.
7318         (initialize_lock_pointer): Remove.
7319         (initialize_lock_once): Remove.
7320         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7321         (Initialize_lock::initialize): Rewrite.
7322         (Initialize_lock::do_run_once): New function.
7323         * archive.cc (Archive::interpret_header): Only clear name if it is
7324         not already empty.
7325         * fileread.cc: Include "gold-threads.h"
7326         (file_counts_lock): New static variable.
7327         (file_counts_initialize_lock): Likewise.
7328         (File_read::release): Only increment counts when using --stats.
7329         Use a lock around the increment.
7330         * parameters.cc (class Set_parameters_target_once): Define.
7331         (set_parameters_target_once): New static variable.
7332         (Parameters::Parameters): Move here from parameters.h.
7333         (Parameters::set_target): Rewrite.
7334         (Parameters::set_target_once): New function.
7335         (Parameters::clear_target): Move here and rewrite.
7336         * parameters.h (class Parameters): Update declarations.  Add
7337         set_parameters_target_once_ field.
7338         (Parameters::Parameters): Move to parameters.cc.
7339         (Parameters::clear_target): Likewise.
7340         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7341         task.
7342         (Start_group::~Start_group): New function.
7343         (Start_group::is_runnable): New function.
7344         (Start_group::locks, Start_group::run): New functions.
7345         (Finish_group::run): Change saw_undefined to size_t.
7346         * readsyms.h (class Start_group): Define.
7347         (class Finish_group): Change saw_undefined_ field to size_t.
7348         (Finish_group::Finish_group): Remove saw_undefined and
7349         this_blocker parameters.  Change all callers.
7350         (Finish_group::set_saw_undefined): New function.
7351         (Finish_group::set_blocker): New function.
7352         * symtab.h (class Symbol_table): Change saw_undefined to return
7353         size_t.  Change saw_undefined_ field to size_t.
7354         * target-select.cc (Set_target_once::do_run_once): New function.
7355         (Target_selector::Target_selector): Initialize set_target_once_
7356         field.  Don't initialize lock_ and initialize_lock_ fields.
7357         (Target_selector::instantiate_target): Rewrite.
7358         (Target_selector::set_target): New function.
7359         * target-select.h (class Set_target_once): Define.
7360         (class Target_selector): Update declarations.  Make
7361         Set_target_once a friend.  Remove lock_ and initialize_lock_
7362         fields.  Add set_target_once_ field.
7363
7364 2010-02-10  Ian Lance Taylor  <iant@google.com>
7365
7366         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7367         queueing any tasks.
7368         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7369         (queue_middle_tasks): Add all blockers before queueing any tasks.
7370         (queue_final_tasks): Likewise.
7371         * token.h (Task_token::add_blockers): New function.
7372         * object.h (Input_objects::number_of_relobjs): New function.
7373
7374 2010-02-10  Ian Lance Taylor  <iant@google.com>
7375
7376         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7377         shared, not if not position independent.
7378         * x86_64.cc (Relocate::relocate_tls): Likewise.
7379         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7380         (tls_pie_pic_test): New target.
7381         * testsuite/Makefile.in: Rebuild.
7382
7383         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7384         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7385         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7386         * testsuite/Makefile.in: Rebuild.
7387
7388 2010-02-09  David S. Miller  <davem@davemloft.net>
7389
7390         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7391         R_SPARC_RELATIVE using ->add_local_relative().
7392         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7393
7394         * output.h (Output_data_dynamic::add_section_size): New method
7395         that takes two Output_data objects.
7396         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7397         entry param.  Handle it in initializers.
7398         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7399         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7400         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7401         arg.
7402         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7403         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7404         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7405         for dynrel_includes_plt.
7406         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7407         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7408         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7409         before .rela.plt
7410         (Target_sparc::do_finalize_sections): Update to pass true for
7411         dynrel_includes_plt.
7412         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7413         output before .rela.plt
7414         (Target_powerpc::do_finalize_sections): Update to pass true for
7415         dynrel_includes_plt when 32-bit.
7416
7417 2010-02-08  Doug Kwan  <dougkwan@google.com>
7418
7419         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7420         method.
7421         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7422         Arm_relobj::scan_section_for_cortex_a8_stubs,
7423         Arm_relobj::do_relocation_section): Instead of calling
7424         Output_section::output_address, use faster
7425         Arm_relobj::simple_input_section_output_address.
7426
7427 2010-02-08  David S. Miller  <davem@davemloft.net>
7428
7429         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7430         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7431         relocation helper function.
7432
7433         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7434         just like R_SPARC_GOT{10,13,22}.
7435         (Target_sparc::Scan::local): Likewise.
7436         (Target_sparc::Relocate:relocate): Likewise.
7437
7438 2010-02-06  Ian Lance Taylor  <iant@google.com>
7439
7440         * configure.ac: Rewrite targetobjs duplicate removal code to use
7441         only shell constructs.
7442         * configure: Rebuild.
7443
7444 2010-02-05  Doug Kwan  <dougkwan@google.com>
7445
7446         PR 11247
7447         * arm.cc (Arm_relobj::section_is_scannable): New method.
7448         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7449         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7450
7451 2010-02-04  Doug Kwan  <dougkwan@google.com>
7452
7453         PR 11247
7454         * arm-reloc-property.cc (cstdio): Include.
7455         * configure.ac (targetobjs): Remove duplicates.
7456         * configure: Regenerate.
7457         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7458         big and little endian version for a given address size.
7459
7460 2010-02-03  Doug Kwan  <dougkwan@google.com>
7461
7462         * arm-reloc-property.cc
7463         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7464         definition.
7465         * arm-reloc-property.h
7466         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7467         New method definition.
7468         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7469         declaration.
7470         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7471         overflow to N.
7472         (GOT_PREL): Change implemented to Y.
7473         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7474         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7475         (Arm_relocate_functions::movw_abs_nc): Remove method.
7476         (Arm_relocate_functions::movt_abs): Ditto.
7477         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7478         (Arm_relocate_functions::thm_movt_abs): Ditto.
7479         (Arm_relocate_functions::movw_rel_nc): Ditto.
7480         (Arm_relocate_functions::movw_rel): Ditto.
7481         (Arm_relocate_functions::movt_rel): Ditto.
7482         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7483         (Arm_relocate_functions:thm_movw_rel): Ditto.
7484         (Arm_relocate_functions:thm_movt_rel): Ditto.
7485         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7486         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7487         New method definitions.
7488         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7489         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7490         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7491         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7492         (Target_arm::Relocate::relocate): Check for non-static or
7493         unimplemented relocation code and exit early.  Change calls to
7494         Target_arm::reloc_uses_thumb_bit and
7495         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7496         instead.  Refactor code to handle similar relocations to increase
7497         code sharing.  Remove check for unsupported relocation code in switch
7498         statement.
7499         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7500         relocation property table to find out size.  Change error message to
7501         print out the name of a relocation code instead of the numeric value.
7502         (Target_arm::scan_reloc_for_stub): Use relocation property table
7503         instead of calling Target_arm::reloc_uses_thumb_bit().
7504
7505 2010-02-02  Doug Kwan  <dougkwan@google.com>
7506
7507         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7508         types of relaxed input section.
7509
7510 2010-02-02  Doug Kwan  <dougkwan@google.com>
7511
7512         * Makefile.am (HFILES): Add arm-reloc-property.h.
7513         (DEFFILES): New.
7514         (TARGETSOURCES): Add arm-reloc-property.cc
7515         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7516         (libgold_a_SOURCES): $(DEFFILES)
7517         * Makefile.in: Regenerate.
7518         * arm-reloc-property.cc: New file.
7519         * arm-reloc-property.h: New file.
7520         * arm-reloc.def: New file.
7521         * arm.cc: Update comments.
7522         (arm-reloc-property.h): New included header.
7523         (arm_reloc_property_table): New global variable.
7524         (Target_arm::do_select_as_default_target): New method definition.
7525         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7526         arm-reloc-property to targ_extra_obj.
7527         * parameters.cc (set_parameters_target): Call
7528         Target::select_as_default_target().
7529         * target.h (Target::select_as_default_target): New method definition.
7530         (Target::do_select_as_default_target): Same.
7531
7532 2010-02-01  Doug Kwan  <dougkwan@google.com>
7533
7534         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7535         first_output_text_section_.
7536         (Arm_exidx_fixup::first_output_text_section): New method definition.
7537         (Arm_exidx_fixup::first_output_text_section_): New data member.
7538         (Arm_exidx_fixup::process_exidx_section): Record the first text
7539         output section seen.
7540         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7541         and entsize in output section header.
7542
7543 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7544
7545         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7546         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7547         (Arm_relocate_functions::thm_alu11): New Method.
7548         (Arm_relocate_functions::thm_pc8): New Method.
7549         (Arm_relocate_functions::thm_pc12): New Method.
7550         (Target_arm::Scan::local): Handle the relocations.
7551         (Target_arm::Scan::global): Likewise.
7552         (Target_arm::Relocate::relocate): Likewise.
7553         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7554
7555 2010-01-29  Doug Kwan  <dougkwan@google.com>
7556
7557         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7558         of relocation types as ld.
7559
7560 2010-01-29  Doug Kwan  <dougkwan@google.com>
7561
7562         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7563         to public.
7564         (Arm_relocate_functions::thumb_branch_common): Ditto.
7565         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7566         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7567         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7568         Arm_relocate_functions::jump24): Remove.
7569         (Target_arm::Relocate::relocate): Adjust code to call
7570         Arm_relocation_functions::arm_branch_common and
7571         Arm_relocation_functions::thumb_branch_common instead of their removed
7572         wrappers.  Merge switch-cases together to reduce source code size.
7573
7574 2010-01-29  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7577         output_local_symbol_count_needs_update_.
7578         (Arm_relobj::output_local_symbol_count_needs_update,
7579          Arm_relobj::set_output_local_symbol_count_needs_update,
7580          Arm_relobj::update_output_local_symbol_count): New methods.
7581         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7582         member.
7583         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7584         of pointed function as in a R_ARM_PREL31 relocation.
7585         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7586         for output local symbol count updating.
7587         (Target_arm::do_relax): Update output local symbol counts in objects
7588         if necessary.
7589         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7590
7591 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7592
7593         * arm.cc: Added support for the ARM relocations:
7594         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7595         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7596         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7597         movw_prel_nc).
7598         (Arm_relocate_functions::movw_rel): New method.
7599         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7600         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7601         thm_movw_prel_nc).
7602         (Arm_relocate_functions::thm_movw_rel): New method.
7603         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7604         thm_movt_prel).
7605         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7606         relocations.
7607         (Target_arm::Scan::global): Likewise.
7608         (Target_arm::Relocate::relocate): Likewise.
7609         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7610         Likewise.
7611
7612 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7613
7614         * arm.cc: Added support for ARM group relocations.
7615         (Target_arm::reloc_needs_sym_origin): New method.
7616         (Arm_relocate_functions::calc_grp_kn): New method.
7617         (Arm_relocate_functions::calc_grp_residual): New method.
7618         (Arm_relocate_functions::calc_grp_gn): New method.
7619         (Arm_relocate_functions::arm_grp_alu): New Method.
7620         (Arm_relocate_functions::arm_grp_ldr): New Method.
7621         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7622         (Arm_relocate_functions::arm_grp_ldc): New Method.
7623         (Target_arm::Scan::local): Handle the ARM group relocations.
7624         (Target_arm::Scan::global): Likewise.
7625         (Target_arm::Relocate::relocate): Likewise.
7626         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7627         Likewise.
7628
7629 2010-01-26  Doug Kwan  <dougkwan@google.com>
7630
7631         * arm.cc (set): Include.
7632         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7633         pointer type.
7634         (Arm_output_section::Text_section_list): New type.
7635         (Arm_output_section::append_text_sections_to_list): New method.
7636         (Arm_output_section::fix_exidx_coverage): Ditto.
7637         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7638         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7639         Relobj::set_section_offset() instead of
7640         Sized_relobj::invalidate_section_offset().
7641         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7642         parameter for section headers. Ignore relocation sections for
7643         unallocated sections and EXIDX sections.
7644         (Target_arm::fix_exidx_coverage): New method.
7645         (Target_arm::output_section_address_less_than): New type.
7646         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7647         linked text section instead of the EXIDX section.
7648         (Arm_output_section::create_stub_group): Add an assertion to check
7649         that this is not an EXIDX output section.
7650         (Arm_output_section::append_text_sections_to_list): New method.
7651         (Arm_output_section::fix_exidx_coverage): Ditto.
7652         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7653         Arm_relobj::section_needs_reloc_stub_scanning.
7654         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7655         first pass.
7656         (Target_arm::fix_exidx_coverage): New method.
7657         * object.h (Relobj::set_output_section): New method.
7658         (Sized_relobj::invalidate_section_offset): Remove method.
7659         (Sized_relobj::do_invalidate_section_offset): Remove method.
7660         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7661
7662 2010-01-25  Doug Kwan  <dougkwan@google.com>
7663
7664         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7665         Fix warning due to signed and unsigned comparison on a 32-bit host.
7666
7667 2010-01-22  Doug Kwan  <dougkwan@google.com>
7668
7669         * arm.cc (Target_arm::do_relax): Record an output section for section
7670         offset adjustment it contains any stub table that has changed.
7671         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7672         offsets in an output section if necessary.
7673         * output.cc (Output_section::Output_section): Initialize
7674         section_offsets_need_adjustments_.
7675         (Output_section::add_input_section_for_script): Renamed to
7676         Output_section::add_simple_input_section.
7677         (Output_section::save_states): Add a comment.
7678         (Output_section::discard_states): New method defintion.
7679         (Output_section::adjust_section_offsets): Same.
7680         * output.h (Output_section::add_input_section_for_script): Renamed to
7681         Output_section::add_simple_input_section.
7682         (Output_section::discard_states): New method declaration.
7683         (Output_section::adjust_section_offsets): Same.
7684         (Output_section::section_offsets_need_adjustment,
7685         Output_section::set_section_offsets_need_adjustment): New method
7686         definitions.
7687         (Output_section::section_offsets_need_adjustment_): New data member.
7688         * script-sections.cc
7689         (Output_section_element_input::set_section_address): Adjust code for
7690         renaming of Output_section::add_input_section_for_script.
7691         (Orphan_output_section::set_section_address): Same.
7692
7693 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7694
7695         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7696         Fix_v4bx enum values .
7697         * gold/options.h (General_options): New option definitions.
7698         (General_options::fix_v4bx): New method.
7699         (General_options::Fix_v4bx): New enum.
7700         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7701         (General_options::parse_fix_v4bx_interworking): New method.
7702
7703 2010-01-22  Doug Kwan  <dougkwan@google.com>
7704
7705         * arm.cc (Arm_exidx_fixup): New class.
7706
7707 2010-01-21  Doug Kwan  <dougkwan@google.com>
7708
7709         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7710         classes.
7711         (Arm_exidx_section_offset_map): New type.
7712
7713 2010-01-21  Doug Kwan  <dougkwan@google.com>
7714
7715         * arm.cc (Arm_exidx_input_section): New class.
7716         (Arm_relobj::exidx_input_section_by_link,
7717         Arm_relobj::exidx_input_section_by_shndx,
7718         Arm_relobj::make_exidx_input_section): New methods.
7719         (read_arm_attributes_section): Remove.
7720         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7721         information about them.
7722         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7723         to here.
7724
7725 2010-01-20  Doug Kwan  <dougkwan@google.com>
7726
7727         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7728         Input_section_specifier to Section_id.
7729         (Target_arm::new_arm_input_section: Adjust code for change of key
7730         type.
7731         (Target_arm::find_arm_input_section): Ditto.
7732         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7733         (Section_id): Remove.
7734         (Garbage_collection::Section_id_hash): Remove.
7735         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7736         (Section_id): Remove.
7737         (Icf::Section_id_hash): Remove.
7738         * object.h (Section_id, Const_section_id, Section_id_hash,
7739         Const_section_id_hash): New type definitions.
7740         * output.cc (Output_section::add_relaxed_input_section): Change to
7741         use Const_section_id instead of Input_section_specifier as key type.
7742         (Output_section::add_merge_input_section): Ditto.
7743         (Output_section::build_relaxation_map): Change to use Section_id
7744         instead of Input_section_specifier as key type.
7745         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7746         Ditto.
7747         (Output_section::convert_input_sections_to_relaxed_sections): Change
7748         to use Const_section_id instead of Input_section_specifier as key type.
7749         (Output_section::find_merge_section): Ditto.
7750         (Output_section::find_relaxed_input_section): Ditto.
7751         * output.h (Input_section_specifier): Remove class.
7752         (Output_section::Output_section_data_by_input_section_map): Change
7753         key type to Const_section_id.
7754         (Output_section::Output_relaxed_input_section_by_input_section_map):
7755         Ditto.
7756         (Output_section::Relaxation_map): Change key type to Section_id.
7757
7758 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7759
7760         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7761         (class Arm_v4bx_stub): New class.
7762         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7763         (Stub_factory::make_arm_v4bx_stub): New method.
7764         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7765         (Stub_table::empty): Handle v4bx stubs.
7766         (Stub_table::add_arm_v4bx_stub): New method.
7767         (Stub_table::find_arm_v4bx_stub): New method.
7768         (Arm_relocate_functions::v4bx): New method.
7769         (Target_arm::fix_v4bx): New method.
7770         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7771         (Stub_table::relocate_stubs): Likewise.
7772         (Stub_table::do_write): Likewise.
7773         (Stub_table::update_data_size_and_addralign): Likewise.
7774         (Stub_table::finalize_stubs):  Likewise.
7775         (Target_arm::Scan::local): Likewise.
7776         (Target_arm::Scan::global): Likewise.
7777         (Target_arm::do_finalize_sections): Likewise.
7778         (Target_arm::Relocate::relocate): Likewise.
7779         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7780         Likewise.
7781         (Target_arm::scan_reloc_for_stub): Likewise.
7782         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7783
7784 2010-01-19  Ian Lance Taylor  <iant@google.com>
7785
7786         * output.cc (Output_section_headers::do_sized_write): Write large
7787         segment count to sh_info field.
7788         (Output_file_header::do_sized_write): For large segment count,
7789         write PN_XNUM to e_phnum field.
7790
7791 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7792
7793         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7794         (Arm_relocate_functions::thm_jump8): New function.
7795         (Arm_relocate_functions::thm_jump11): New function.
7796         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7797         R_ARM_THM_JUMP11.
7798         (Target_arm::Scan::global): Likewise.
7799         (Target_arm::Relocate::relocate): Likewise.
7800         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7801         Likewise.
7802
7803 2010-01-14  Doug Kwan  <dougkwan@google.com>
7804
7805         * arm.cc (map, utility): Include headers.
7806         (Target_arm::apply_cortex_a8_workaround): New method.
7807         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7808         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7809         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7810         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7811         the --[no-]fix-cortex-a8 command line options.
7812         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7813         (Target_arm::relocate_stub): Use addend in instruction template.
7814         * options.h (DEFINE_bool): Set the user-set flag.
7815         (General_options): Add --[no-]-fix-cortex options.
7816         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7817         : Update fast look-up map after conversion.
7818
7819 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7820
7821         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7822         in the first pass of do_layout.
7823
7824 2010-01-13  Doug Kwan  <dougkwan@google.com>
7825
7826         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7827         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7828         apparent compiler problem of not folding static constant integral
7829         data members of elfcpp::Elf_sizes<32>.
7830
7831 2010-01-13  Doug Kwan  <dougkwan@google.com>
7832
7833         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7834         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7835         Arm_relobj::scan_section_for_cortex_a8_erratum,
7836         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7837         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7838         sections to scan for relocation stubs into a new method
7839         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7840         relocation and Cortex-A8 stub scanning.
7841         (Target_arm::do_relax): Force stubs to be after stubbed sections
7842         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7843         the beginning of a new relaxation pass.  Update a comment.
7844         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7845
7846 2010-01-12  Ian Lance Taylor  <iant@google.com>
7847
7848         * target-reloc.h (visibility_error): New inline function.
7849         (relocate_section): Call visibility_error.
7850         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7851         (MOSTLYCLEANFILES): Likewise.
7852         (protected_4_pic.o, protected_3.err): New targets.
7853         * testsuite/protected_4.cc: New file.
7854
7855 2010-01-12  Doug Kwan  <dougkwan@google.com>
7856
7857         * arm.cc (Cortex_a8_reloc): New class.
7858         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7859         and cortex_a8_relocs_info_.
7860         (Target_arm::fix_cortex_a8): New method definition.
7861         (Target_arm::Cortex_a8_relocs_info): New type.
7862         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7863         New data member declarations.
7864         (Target_arm::scan_reloc_for_stub): Record information about
7865         relocations for THUMB branches that might be exempted from the
7866         Cortex-A8 workaround.
7867         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7868         at the beginning of a relaxation pass.
7869
7870 2010-01-12  Doug Kwan  <dougkwan@google.com>
7871
7872         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7873         (Arm_relobj::Mapping_symbol_position,
7874          Arm_reloj::Mapping_symbol_position_less,
7875          Arm_relobj::Mapping_symbols_info): New types.
7876         (Target_arm::is_mapping_symbol_name): New method definition.
7877         (Arm_relobj::do_count_local_symbols): Save information about mapping
7878         symbols.
7879
7880 2010-01-11  Doug Kwan  <dougkwan@google.com>
7881
7882         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7883         Arm_relocate_functions::thumb32_branch_upper,
7884         Arm_relocate_functions::thumb32_branch_lower,
7885         Arm_relocate_functions::thumb32_cond_branch_offset,
7886         Arm_relocate_functions::thumb32_cond_branch_upper,
7887         Arm_relocate_functions::thumb32_cond_branch_lower,
7888         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7889         branch offset encoding.
7890         (Arm_relocate_functions::thumb_branch_common): Use new branch
7891         offset encoding methods to avoid code duplication.
7892         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7893         (Stub_addend_reader::operator()): Use new branch encoding method
7894         to avoid code duplication.
7895
7896 2010-01-11  Doug Kwan  <dougkwan@google.com>
7897
7898         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7899         (Target_arm::do_finalize_sections): Define special EXIDX section
7900         symbols only if referenced.
7901         * gc.h (Garbage_collection::add_reference): New method.
7902         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7903         code duplication.
7904
7905 2010-01-11  Ian Lance Taylor  <iant@google.com>
7906
7907         * script.cc (Version_script_info::build_expression_list_lookup):
7908         Change complaing about duplicate wildcard match from error to
7909         warning.
7910
7911         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7912         of 2009-12-30.
7913         (Version_script_info::Version_script_info): Initialize globs_,
7914         default_version_, default_is_global_, and exact_.  Don't
7915         initialize globals_ or locals_.
7916         (Version_script_info::build_lookup_tables): Build local symbols
7917         first.
7918         (Version_script_info::unquote): New function.
7919         (Version_script_info::add_exact_match): New function.
7920         (Version_script_info::build_expression_list_lookup): Remove lookup
7921         parameter.  Add is_global parameter.  Change all callers.  Handle
7922         wildcard pattern specially.  Unquote pattern.  Call
7923         add_exact_match.
7924         (Version_script_info::get_name_to_match): New function.
7925         (Version_script_info::get_symbol_version): New function.
7926         (Version_script_info::get_symbol_version_helper): Remove.
7927         (Version_script_info::check_unmatched_names): Call unquote.
7928         * script.h (class Version_script_info): Change get_symbol_version
7929         to be non-inline and add is_global parameter; change all callers.
7930         Rewrite symbol_is_local.  Update declarations.  Define struct
7931         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7932         Remove globals_ and locals_ members.  Add exact_, globs_,
7933         default_version_, is_global_.
7934         (Version_script_info::Glob): Remove pattern, add expression and
7935         is_global.  Update constructor.  Change all callers.
7936         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7937         default version.
7938         (Versions::symbol_section_contents): If a symbol is undefined, or
7939         defined in a dynamic object, set the version index to
7940         VER_NDX_LOCAL.
7941         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7942         symbol_is_local.
7943         (Symbol_table::add_from_pluginobj): Likewise.
7944         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7945
7946 2010-01-11  Doug Kwan  <dougkwan@google.com>
7947
7948         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7949         (incremental_dump_LDADD): Add linking option for libintl.
7950         * Makefile.in: Regenerate.
7951
7952 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7953
7954         PR gold/11144
7955         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7956         instead of -Ds.
7957         * testsuite/Makefile.in: Regenerated.
7958
7959 2010-01-10  Doug Kwan  <dougkwan@google.com>
7960
7961         * options.h (DEFINE_var): Use parentheses around argument varname__
7962         in macro body to avoid any unintended subsequent substitutions.
7963
7964 2010-01-10  Ian Lance Taylor  <iant@google.com>
7965
7966         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7967         candidates before doing symbol resolution.
7968
7969         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7970         ODR candidates if only one is weak.
7971
7972 2010-01-08  Ian Lance Taylor  <iant@google.com>
7973
7974         * script.cc (Version_script_info::build_expression_list_lookup):
7975         Don't warn about ambiguous version, just record the ambiguity.
7976         (Version_script_info::get_symbol_version_helper): Give error if
7977         version is ambiguous.
7978
7979 2010-01-08  Doug Kwan  <dougkwan@google.com>
7980
7981         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7982         prev_data_size_ and prev_addralign_.  Remove initializer for
7983         deleted data member has_been_changed_.
7984         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7985         to determine if the table is empty.
7986         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7987         Remove.
7988         (Stub_table::add_reloc_stub): Define method in class definition
7989         instead of just declaring it there.
7990         (Stub_table::add_cortex_a8_stub): New method definition.
7991         (Stub_table::update_data_size_and_addralign): Ditto.
7992         (Stub_table::finalize_stubs): Ditto.
7993         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7994         (Stub_table::do_addralign_): Return address alignment in the
7995         (Stub_table::do_reset_address_and_file_offset): Define method in
7996         class definition instead of declaring it there.  Set current data
7997         size to be the data size of the previous pass.
7998         (Stub_table::set_final_data_size): Use current data size as the
7999         final data size.
8000         (Stub_table::relocate_stub): Change parameter type of stub from
8001         Reloc_stub pointer to Stub pointer.
8002         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8003         (Stub_table::Cortex_a8_stub_list): New typedef.
8004         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8005          Stub_table::prev_addralign_): New data member.
8006         (Arm_relobj::Arm_relobj): Initialize data member
8007         section_has_cortex_a8_workaround_.
8008         (Arm_relobj::section_has_cortex_a8_workaround,
8009          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8010          definitions.
8011         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8012         declarations.
8013         (Target_arm::relocate_stub): Change parameter type of stub from
8014         Reloc_stub pointer to Stub pointer.
8015         (Insn_template::size, Insn_template::alignment): Handle
8016         THUMB16_SPECIAL_TYPE.
8017         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8018          Stub_table::update_data_size_and_addralign,
8019          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8020         definitions.
8021         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8022         (Stub_table::do_write): Ditto.
8023         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8024
8025 2010-01-08  Ian Lance Taylor  <iant@google.com>
8026
8027         PR 11108
8028         * symtab.h (class Symbol): Remove fields is_target_special_ and
8029         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8030         (Symbol::is_defined_in_discarded_section): New function.
8031         (Symbol::set_is_defined_in_discarded_section): New function.
8032         (Symbol::has_plt_offset): Rewrite.
8033         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8034         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8035         Don't initialize is_target_special_ or has_plt_offset_.
8036         Initialize is_defined_in_discarded_section_.
8037         (Symbol_table::add_from_relobj): If appropriate, set
8038         is_defined_in_discarded_section.
8039         * resolve.cc (Symbol::override_base_with_special): Don't test
8040         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8041         * target-reloc.h (relocate_section): Do special handling for
8042         symbols defined in discarded sections for global symbols as well
8043         as local symbols.
8044
8045 2010-01-08  Ian Lance Taylor  <iant@google.com>
8046
8047         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8048         the SHT_SYMTAB case.
8049
8050 2010-01-08  Ian Lance Taylor  <iant@google.com>
8051
8052         * object.cc (Sized_relobj::do_layout): Don't get confused if
8053         layout_eh_frame returns NULL.
8054
8055 2010-01-08  Ian Lance Taylor  <iant@google.com>
8056
8057         PR 11084
8058         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8059         dynamic symbol table, use the normal symbol table.
8060         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8061         symbol table.
8062
8063 2010-01-08  Ian Lance Taylor  <iant@google.com>
8064
8065         PR 11072
8066         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8067         sections.
8068
8069 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8070
8071         * version.cc (print_version): Change to "Copyright 2010".
8072
8073 2010-01-08  Ian Lance Taylor  <iant@google.com>
8074
8075         PR 10287
8076         PR 11063
8077         * i386.cc (class Target_i386): Change return type of plt_section
8078         to be non-const.
8079         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8080         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8081         tls_desc_rel_ field.
8082         (Output_data_plt_i386::rel_tls_desc): New function.
8083         (Target_i386::rel_tls_desc_section): New function.
8084         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8085         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8086         R_386_TLS_DESC reloc in rel_tls_desc_section.
8087         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8088         Define struct Tlsdesc_info.
8089         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8090         (Target_x86_64::do_reloc_symbol_index): New function.
8091         (Target_x86_64::add_tlsdesc_info): New function.
8092         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8093         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8094         tlsdesc_rel_ field.
8095         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8096         all callers.
8097         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8098         (Target_x86_64::rela_tlsdesc_section): New function.
8099         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8100         handling.
8101         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8102         (Target_x86_64::do_reloc_addend): New function.
8103         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8104         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8105         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8106         (Output_reloc::type): New function.
8107         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8108         (Output_reloc::is_target_specific): New function.
8109         (Output_reloc::target_arg): New function.
8110         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8111         absolute relocs and target specific relocs.
8112         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8113         add_target_specific.
8114         (class Output_data_reloc) [SHT_RELA]: Likewise.
8115         * output.cc (Output_reloc::Output_reloc): Add four new versions
8116         for absolute relocs and target specific relocs.
8117         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8118         (Output_reloc::get_symbol_index): Likewise.
8119         (Output_reloc::local_section_offset): Check that local_sym_index_
8120         is not TARGET_CODE or 0.
8121         (Output_reloc::symbol_value): Likewise.
8122         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8123         reloc.
8124         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8125         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8126         functions.
8127         * layout.cc (add_target_dynamic_tags): Use output section for
8128         DT_PLTRELSZ and DT_JMPREL.
8129
8130 2010-01-07  Ian Lance Taylor  <iant@google.com>
8131
8132         PR 11061
8133         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8134         function.
8135         (class Output_data_reloc_generic): Define.
8136         (class Output_data_reloc_base): Change base class to
8137         Output_data_reloc_generic.  Change add() method to call
8138         bump_relative_reloc_count for a relative reloc.  Remove
8139         sort_relocs_ field.
8140         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8141         to sort_relocs().
8142         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8143         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8144         appropriate.
8145         * layout.h (class Layout): Update declaration.
8146
8147 2010-01-07  Ian Lance Taylor  <iant@google.com>
8148
8149         * output.h (class Output_data): Add const version of
8150         output_section and do_output_section.
8151         (class Output_section_data): Add const version of
8152         do_output_section.
8153         (class Output_section): Likewise.
8154         * layout.cc (Layout::add_target_dynamic_tags): New function.
8155         * layout.h (class Layout): Update declarations.
8156         * arm.cc (Target_arm::do_finalize_sections): Use
8157         add_target_dynamic_tags.
8158         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8159         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8160         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8161         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8162
8163 2010-01-07  Ian Lance Taylor  <iant@google.com>
8164
8165         PR 11042
8166         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8167         object as needed.
8168
8169 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8170             Ian Lance Taylor  <iant@google.com>
8171
8172         PR 11019
8173         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8174         Xindex::read_symtab_xindex.
8175
8176 2010-01-07  Doug Kwan  <dougkwan@google.com>
8177
8178         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8179         (Insn_template::thumb16_bcond_insn): New method declaration.
8180         (Insn_template): Fix spelling.
8181         (Stub::thumb16_special): New method declaration.
8182         (Stub::do_write): Define virtual method which was previously pure
8183         virtual.
8184         (Stub::do_thumb16_special): New method declaration.
8185         (Stub::do_fixed_endian_write): New template member.
8186         (Reloc_stub::do_write): Remove.
8187         (Reloc_stub::do_fixed_endian_write): Remove.
8188         (Cortex_a8_stub): New class definition.
8189         (Stub_factory::make_cortex_a8_stub): New method definition.
8190         (Stub_factory::Stub_factory): Add missing static storage class
8191         qualifier for elf32_arm_stub_a8_veneer_blx.
8192
8193 2010-01-07  Ian Lance Taylor  <iant@google.com>
8194
8195         PR 10980
8196         * options.h (class General_options): Add --warn-unresolved-symbols
8197         and --error-unresolved-symbols.
8198         * errors.cc (Errors::undefined_symbol): Implement
8199         --warn-unresolved-symbols.
8200
8201         * options.h (class General_options): Add -z text and -z textoff.
8202         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8203
8204 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8205
8206         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8207         (Garbage_collection::cident_sections): New function.
8208         (Garbage_collection::add_cident_section): New function.
8209         (Garbage_collection::cident_sections_): New member.
8210         (gc_process_relocs): Add references to sections whose names are C
8211         identifiers.
8212         * gold.h (cident_section_start_prefix): New constant.
8213         (cident_section_stop_prefix): New constant.
8214         (is_cident): New function.
8215         * layout.cc (Layout::define_section_symbols): Replace string constants
8216         with the newly defined constants.
8217         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8218         C identifiers.
8219         * testsuite/Makefile.am: Add gc_orphan_section_test.
8220         * testsuite/Makefile.in: Regenerate.
8221         * testsuite/gc_orphan_section_test.cc: New file.
8222         * testsuite/gc_orphan_section_test.sh: New file.
8223
8224 2010-01-06  Ian Lance Taylor  <iant@google.com>
8225
8226         PR 10980
8227         * options.h (class General_options): Add --warn-shared-textrel.
8228         * layout.cc (Layout::finish_dynamic_section): Implement
8229         --warn-shared-textrel.
8230
8231         PR 10980
8232         * options.h (class General_options): Add --warn-multiple-gp.
8233
8234 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8235
8236         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8237         $(THREADSLIB) and $(LIBDL).
8238         * Makefile.in: Rebuild.
8239
8240 2010-01-06  Ian Lance Taylor  <iant@google.com>
8241
8242         PR 10980
8243         * options.cc (General_options::parse_section_start): New function.
8244         (General_options::section_start): New function.
8245         (General_options::General_options): Initialize all members.
8246         * options.h: Include <map>
8247         (class General_options): Add --section-start.  Add section_starts_
8248         member.
8249         * layout.cc (Layout::attach_allocated_section_to_segment): If
8250         --section-start was used, set the address of the segment.  Remove
8251         local sort_sections.
8252         (Layout::relaxation_loop_body): If the address of the load segment
8253         has been set by --section-start, don't use it.
8254         * output.h (Output_segment::update_flags_for_output_section): New
8255         function.
8256         * output.cc (Output_segment::add_output_section): Call
8257         update_flags_for_output_section.
8258
8259 2010-01-05  Ian Lance Taylor  <iant@google.com>
8260
8261         PR 10980
8262         * options.h (class General_options): Add --undefined-version.
8263         * script.cc (struct Version_expression): Add was_matched_by_symbol
8264         field.
8265         (Version_script_info::matched_symbol): New function.
8266         (Version_script_info::get_symbol_version_helper): Call
8267         matched_symbol.
8268         (Version_script_info::check_unmatched_names): New function.
8269         * script.h (class Version_script_info): Update declarations.
8270         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8271
8272         * options.h (class General_options): Use DEFINE_bool_alias for
8273         allow_multiple_definition.
8274         * resolve.cc (Symbol_table::should_override): Don't test
8275         allow_multiple_definition.
8276
8277         PR 10980
8278         * options.h (class General_options): Add --cref.
8279         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8280         until after printing cref table.
8281         * cref.cc: Include "symtab.h".
8282         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8283         (Cref_table_compare::operator()): New function.
8284         (Cref_inputs::gather_cref): New function.
8285         (filecol): New static const.
8286         (Cref_inputs::print_cref): New function.
8287         (Cref::print_cref): New function.
8288         * cref.h: Include <cstdio>.
8289         (class Cref): Update declarations.
8290         * mapfile.h (Mapfile::file): New function.
8291         * object.h (class Object): Define Symbols.  Declare virtual
8292         do_get_global_symbols.
8293         (Object::get_global_symbols): New function.
8294         * object.cc (Input_objects::add_object): Pass object to cref_ if
8295         --cref.
8296         (Input_objects::archive_start): Likewise.
8297         (Input_objects::archive_stop): Likewise.
8298         (Input_objects::print_cref): New function.
8299         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8300         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8301         --cref.
8302         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8303         function.
8304         * plugin.h (class Sized_pluginobj): Update declarations.
8305
8306 2010-01-05  Ian Lance Taylor  <iant@google.com>
8307
8308         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8309         to is_default_version.  Rename insdef to insdefault.
8310         (Symbol_table::add_from_relobj): Rename def to is_default_version
8311         and local to is_forced_local.
8312         (Symbol_table::add_from_pluginobj): Likewise.
8313         (Symbol_table::add_from_dynobj): Likewise.
8314         (Symbol_table::define_special_symbol): Rename insdef to
8315         insdefault.
8316
8317 2010-01-04  Ian Lance Taylor  <iant@google.com>
8318
8319         PR 10980
8320         * options.h (class General_options): Add
8321         --allow-multiple-definition and -z muldefs.
8322         * resolve.cc (Symbol_table::should_override): Don't warn about a
8323         multiple symbol definition if --allow-multiple-definition or -z
8324         muldefs.
8325
8326         PR 10980
8327         * options.h (class General_options): Add --add-needed and
8328         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8329         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8330         error if --copy-dt-needed-entries aka --add-needed is used and
8331         would cause a change in behaviour.
8332
8333         PR 10980
8334         * options.h (class General_options): Add -G as a short version of
8335         --shared.  Add no-op options -assert, -g, and -i.
8336
8337 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8338
8339         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8340         check for .text or .gnu.linkonce.t sections.
8341         * icf.cc (Icf::find_identical_sections): Ditto.
8342         Change the detection for mangled function name within the section
8343         name.
8344         * icf.h (is_section_foldable_candidate): New function.
8345
8346 2009-12-30  Ian Lance Taylor  <iant@google.com>
8347
8348         PR 10980
8349         * options.h (class General_options): Permit two dashes with
8350         --retain-symbols-file.
8351
8352 2009-12-30  Ian Lance Taylor  <iant@google.com>
8353
8354         PR 10979
8355         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8356         don't put the file header and segment headers in the text
8357         segment.
8358
8359         PR 10979
8360         * common.cc (Sort_commons::operator()): Stabilize sort when both
8361         entries are NULL.
8362         (Symbol_table::do_allocate_commons_list): When allocating common
8363         symbols, skip a symbol which is no longer common.
8364         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8365         an object before checking its type.
8366         * testsuite/common_test_2.c: New file.
8367         * testsuite/common_test_3.c: New file.
8368         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8369         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8370         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8371         (common_test_2_pic.o, common_test_2.so): New targets.
8372         (common_test_3_pic.o, common_test_3.so): New targets.
8373         * testsuite/Makefile.in: Rebuild.
8374
8375         PR 10979
8376         * script.cc (read_input_script): If we see a new SECTIONS clause,
8377         and we have added an input section, give an error.
8378         * layout.h (class Layout): Add have_added_input_section function.
8379         Add have_added_input_section_ field.
8380         * layout.cc (Layout::Layout): Initialize
8381         have_added_input_section_.
8382         (Layout::layout): Set have_added_input_section_.
8383         (Layout::layout_eh_frame): Likewise.
8384
8385 2009-12-30  Ian Lance Taylor  <iant@google.com>
8386
8387         PR 10931
8388         * options.h (class General_options): Add --sort-common option.
8389         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8390         * common.cc (Sort_common): Add sort_order parameter to
8391         constructor.  Add sort_order_ field.
8392         (Sort_commons::operator): Check sort_order_.
8393         (Symbol_table::allocate_commons): Determine the sort order.
8394         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8395         Change all callers.
8396         (Symbol_table::do_allocate_commons_list): Likewise.
8397
8398 2009-12-30  Ian Lance Taylor  <iant@google.com>
8399
8400         PR 10916
8401         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8402         symbols from this object, don't change the visibility of an
8403         undefined symbol.
8404         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8405
8406 2009-12-30  Ian Lance Taylor  <iant@google.com>
8407
8408         PR 10861
8409         * script.h (class Version_script_info): Define Language enum.
8410         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8411         new fields globals_, locals_, and is_finalized_.
8412         * script.cc: Various formatting fixes.
8413         (class Parser_closure): Change language_stack_ from a vector of
8414         std::string to one of Version_script_info::Language.  Adjust all
8415         uses accordingly.
8416         (class Lazy_demangler): Remove.
8417         (struct Version_expression): Change language from std::string to
8418         Version_script_info::Language.
8419         (Version_script_info::Version_script_info): New function.
8420         (Version_script_info::~Version_script_info): Don't call clear.
8421         (Version_script_info::finalize): New function.
8422         (Version_script_info::build_lookup_tables): New function.
8423         (Version_script_info::build_expression_list_lookup): New
8424         function.
8425         (Version_script_info::get_symbol_version_helper): Rewrite to use
8426         lookup tables.
8427         (Version_script_info::print_expression_list): Adjust to use
8428         Version_script_info::Language.
8429         (script_push_lex_into_version_mode): Check that the version script
8430         has not been finalized.
8431         (version_script_push_lang): Change language string to
8432         Version_script_info::Language.
8433         * options.cc (Command_line::version_script): New function.
8434         * options.h (class General_options): Add finalize_dynamic_list
8435         function.  Change version_script from declaration to definition.
8436         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8437         * testsuite/version_script.map: Remove duplicate def of foo.
8438         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8439         version_script.map.
8440         * testsuite/Makefile.in: Rebuild.
8441
8442 2009-12-30  Ian Lance Taylor  <iant@google.com>
8443
8444         PR 10843
8445         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8446         if the input symbol index is 0, make the output symbol index 0.
8447
8448 2009-12-30  Ian Lance Taylor  <iant@google.com>
8449
8450         PR 10670
8451         * options.h (class General_options): Add -x/--discard-all.
8452         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8453         --discard-all.  If the local symbol needs a dynamic entry, check
8454         that before handling --discard-locals.
8455
8456 2009-12-30  Ian Lance Taylor  <iant@google.com>
8457
8458         PR 10450
8459         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8460         flags to PF_R.
8461         (Output_segment::add_output_section): Don't change the flags if
8462         the type is PT_TLS.
8463
8464         PR 10450
8465         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8466         GNU hash table if they need a dynamic value.  Otherwise, don't add
8467         them if they are defined in a dynamic object or are forced local.
8468
8469 2009-12-29  Ian Lance Taylor  <iant@google.com>
8470
8471         PR 10450
8472         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8473         .gnu.hash table for a 32-bit target.
8474
8475         PR 10450
8476         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8477         regular and a dynamic object only needs a dynamic symbol table
8478         entry if it is externally visible.
8479
8480         PR 10450
8481         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8482         constructor.  Add global_offset_table_ field.
8483         (Target_i386::got_section): Set global_offset_table_.
8484         (Target_i386::do_finalize_sections): Set global_offset_table_
8485         size.
8486         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8487         in constructor.  Add global_offset_table_ field.
8488         (Target_x86_64::got_section): Set global_offset_table_.
8489         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8490         size.
8491
8492         * layout.cc (Layout::Layout): Initialize increase_relro_.
8493         (Layout::get_output_section): Add is_relro, is_last_relro, and
8494         is_first_non_relro parameters.  Change all callers.
8495         (Layout::choose_output_section): Likewise.
8496         (Layout::add_output_section_data): Likewise.
8497         (Layout::make_output_section): Likewise.
8498         (Layout::set_segment_offsets): Clear increase_relro when using a
8499         linker script.
8500         * layout.h (class Layout): Add increase_relro method.  Add
8501         increase_relro_ field.  Update declarations.
8502         * output.cc (Output_section::Output_section): Initialize
8503         is_last_relro_ and is_first_non_relro_.
8504         (Output_segment::add_output_section): Group relro sections is
8505         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8506         (Output_segment::maximum_alignment): Remove relro handling.
8507         (Output_segment::set_section_addresses): Add increase_relro
8508         parameter.  Change all callers.  Add initial alignment to align
8509         relro sections on separate page.  Remove old relro handling.
8510         (Output_segment::set_section_list_addresses): Remove in_relro
8511         parameter.  Change all callers.
8512         (Output_segment::set_offset): Add increase parameter.  Change all
8513         callers.  Remove old relro handling.
8514         * output.h (class Output_section): Add new methods: is_last_relro,
8515         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8516         Add is_last_relro_ and is_first_non_relro_ fields.
8517         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8518         Create separate .got.plt section.  Call increase_relro.
8519         * x86_64.cc (Target_x86_64::got_section): Likewise.
8520         * testsuite/relro_script_test.t: Add .got.plt.
8521
8522         PR 10450
8523         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8524         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8525         (Layout::finalize): Call set_dynamic_symbol_size.
8526         (Layout::set_dynamic_symbol_size): New function.
8527         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8528         set_dynamic_symbol_size.
8529
8530         PR 10450
8531         * output.h (class Output_section): Add is_entsize_zero_ field.
8532         * output.cc (Output_section::Output_section): Initialize
8533         is_entsize_zero_.
8534         (Output_section::set_entsize): If two different entsizes are
8535         requested, force it to zero.
8536         (Output_section::add_input_section): Set flags for .debug_str
8537         before updating section flags.  Set entsize.
8538         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8539         and SHF_STRING if all input sections have those flags.
8540
8541 2009-12-29   Rafael Espindola  <espindola@google.com>
8542
8543         * main.cc (main): Fix the sys time reporting.
8544         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8545         reporting.
8546
8547 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8548
8549         * options.cc (General_options::parse_version): Allow -v to exit
8550         without an error if there is nothing to link.
8551
8552 2009-12-29  Ian Lance Taylor  <iant@google.com>
8553
8554         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8555         using a version of gcc before 4.1.
8556         * configure: Rebuild.
8557
8558 2009-12-28  Chris Demetriou  <cgd@google.com>
8559
8560         * attributes.cc (Output_attributes_section_data::do_write): Use
8561         std::vector::front rather than std::vector::data.
8562
8563 2009-12-28  Ian Lance Taylor  <iant@google.com>
8564
8565         * symtab.h (class Symbol_table): Add enum Defined.
8566         * resolve.cc (Symbol_table::should_override): Add defined
8567         parameter.  Change all callers.  Test whether object is NULL
8568         before calling a method on it.
8569         (Symbol_table::report_resolve_problem): Add defined parameter.
8570         Change all callers.
8571         (Symbol_table::should_override_with_special): Likewise.
8572         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8573         parameter.  Change all callers.
8574         (Symbol_table::do_define_in_output_data): Likewise.
8575         (Symbol_table::define_in_output_segment): Likewise.
8576         (Symbol_table::do_define_in_output_segment): Likewise.
8577         (Symbol_table::define_as_constant): Likewise.
8578         (Symbol_table::do_define_as_constant): Likewise.
8579         * script.h (class Symbol_assignment): Add is_defsym parameter to
8580         constructor; change all callers.
8581         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8582         parameter.  Change all callers.  Add is_defsym_ field.
8583         (class Parser_closure): Add parsing_defsym parameter to
8584         constructor; change all callers.  Add parsing_defsym accessor
8585         function.  Add parsing_defsym_ field.
8586
8587 2009-12-28  Ian Lance Taylor  <iant@google.com>
8588
8589         * gold.cc (queue_middle_tasks): Fix formatting.
8590         * object.cc (Relobj::is_section_name_included): Likewise.
8591
8592 2009-12-23  Ian Lance Taylor  <iant@google.com>
8593
8594         * i386.cc (Target_i386::do_calls_non_split): Recognize
8595         -fsplit-stack prologue for a function with a static chain.
8596         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8597         -fsplit-stack prologue when using %r11.
8598
8599 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8600
8601         * options.cc (General_options::parse_version): Make -v continue and do
8602         the link like GNU ld does.
8603
8604 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8605
8606         * Makefile.am (CCFILES): Add timer.cc.
8607         (HFILES): Add timer.h.
8608         * configure.ac: Check for sysconf and times.
8609         * main.cc: include timer.h.
8610         (main): Use Timer instead of get_run_time.
8611         * timer.cc: New.
8612         * timer.h: New.
8613         * workqueue.cc: include timer.h.
8614         (Workqueue::find_and_run_task):
8615         Report user, sys and wall time.
8616         * Makefile.in: Regenerate.
8617         * config.in: Regenerate.
8618         * configure: Regenerate.
8619
8620 2009-12-16  Doug Kwan  <dougkwan@google.com>
8621
8622         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8623         sections.
8624         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8625         relaxed input sections.
8626         * output.cc (Output_section::find_relaxed_input_section): Change
8627         return type to Output_relaxed_input_section pointer.  Adjust code
8628         for new type of relaxed_input_section_map_.
8629         * output.h (Output_section::find_relaxed_input_section): Change
8630         return type to Output_relaxed_input_section pointer.
8631         (Output_section::Output_relaxed_input_section_by_input_section_map):
8632         New type.
8633         (Output_section::relaxed_input_section_map_): Change type to
8634         Output_section::Output_relaxed_input_section_by_input_section_map.
8635         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8636         input section.
8637
8638 2009-12-15  Ian Lance Taylor  <iant@google.com>
8639
8640         * layout.cc (Layout::create_shstrtab): Only write out after input
8641         sections if we are compressing debug sections.
8642
8643 2009-12-15  Ian Lance Taylor  <iant@google.com>
8644
8645         * archive.cc (Archive::add_symbols): Only look up a symbol without
8646         a version if there is, in fact, a version.
8647
8648 2009-12-14  Ian Lance Taylor  <iant@google.com>
8649
8650         Revert -Wshadow changes, all changes from:
8651         2009-12-11  Doug Kwan  <dougkwan@google.com>
8652         2009-12-11  Nick Clifton  <nickc@redhat.com>
8653         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8654
8655 2009-12-11  Doug Kwan  <dougkwan@google.com>
8656
8657         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8658         due to -Wshadow.
8659         * attributes.cc (Object_attribute::size): Ditto.
8660         (Attributes_section_data::size): Ditto.
8661         (Attributes_section_data::Attributes_section_data): Ditto.
8662         (Output_attributes_section_data::do_write): Ditto.
8663         * attributes.h (Object_attribute::set_type): Ditto.
8664         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8665
8666 2009-12-11  Nick Clifton  <nickc@redhat.com>
8667
8668         * archive.cc: Fix shadowed variable warnings.
8669         * arm.cc: Likewise.
8670         * compressed_output.cc: Likewise.
8671         * compressed_output.h: Likewise.
8672         * configure: Likewise.
8673         * dwarf_reader.cc: Likewise.
8674         * dynobj.cc: Likewise.
8675         * dynobj.h: Likewise.
8676         * ehframe.cc: Likewise.
8677         * ehframe.h: Likewise.
8678         * errors.cc: Likewise.
8679         * expression.cc: Likewise.
8680         * fileread.cc: Likewise.
8681         * fileread.h: Likewise.
8682         * freebsd.h: Likewise.
8683         * i386.cc: Likewise.
8684         * icf.cc: Likewise.
8685         * incremental.h: Likewise.
8686         * layout.cc: Likewise.
8687         * layout.h: Likewise.
8688         * mapfile.cc: Likewise.
8689         * merge.cc: Likewise.
8690         * merge.h: Likewise.
8691         * object.cc: Likewise.
8692         * object.h: Likewise.
8693         * options.h: Likewise.
8694         * output.cc: Likewise.
8695         * output.h: Likewise.
8696         * parameters.cc: Likewise.
8697         * plugin.cc: Likewise.
8698         * powerpc.cc: Likewise.
8699         * reduced_debug_output.cc: Likewise.
8700         * reduced_debug_output.h: Likewise.
8701         * reloc.cc: Likewise.
8702         * reloc.h: Likewise.
8703         * resolve.cc: Likewise.
8704         * script-sections.cc: Likewise.
8705         * script.cc: Likewise.
8706         * script.h: Likewise.
8707         * sparc.cc: Likewise.
8708         * symtab.cc: Likewise.
8709         * symtab.h: Likewise.
8710         * target-select.cc: Likewise.
8711         * target-select.h: Likewise.
8712         * token.h: Likewise.
8713         * workqueue.cc: Likewise.
8714         * workqueue.h: Likewise.
8715         * x86_64.cc: Likewise.
8716
8717 2009-12-10  Doug Kwan  <dougkwan@google.com>
8718
8719         * arm.cc (attributes.h): New include.
8720         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8721         (Arm_relobj::~Arm_relobj): Delete object pointed by
8722         attributes_section_data_.
8723         (Arm_relobj::attributes_section_data): New method definition.
8724         (Arm_relobj::attributes_section_data_): New data member declaration.
8725         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8726         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8727         attributes_section_data_.
8728         (Arm_dynobj::attributes_section_data): New method definition.
8729         (Arm_dynobj::attributes_section_data_): New data member declaration.
8730         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8731         initialization value of may_use_blx_ to false.
8732         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8733         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8734         object attributes to compute results instead of hard-coding.
8735         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8736         Target_arm::get_secondary_compatible_arch,
8737         Target_arm::set_secondary_compatible_arch
8738         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8739         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8740         New method declarations.
8741         (Target_arm::get_aeabi_object_attribute): New method definition.
8742         (Target_arm::attributes_section_data_): New data member declaration.
8743         (read_arm_attributes_section): New template definition.
8744         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8745         (Arm_dynobj::do_read_symbols): Ditto.
8746         (Target_arm::do_finalize_sections): Merge attributes sections from
8747         input.  Check for BLX use after attributes section merging.
8748         Fix __exidx_start and __exidx_end visibility.  Create an
8749         .ARM.attributes section if necessary.
8750         (Target_arm::get_secondary_compatible_arch,
8751         Target_arm::set_secondary_compatible_arch,
8752         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8753         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8754         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8755         New method definitions.
8756
8757 2009-12-09  Ian Lance Taylor  <iant@google.com>
8758
8759         * plugin.cc (Plugin::load): Don't cast from void* to a function
8760         pointer.
8761
8762 2009-12-09  Ian Lance Taylor  <iant@google.com>
8763
8764         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8765         information fields.
8766
8767 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8768
8769         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8770         Replace two_file_shared_1.so with two_file_shared_2.so.
8771         * testsuite/Makefile.in: Regenerated.
8772
8773 2009-12-08  Doug Kwan  <dougkwan@google.com>
8774
8775         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8776         (HFILES): Add attributes.h and int_encoding.h.
8777         * Makefile.in: Regenerate.
8778         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8779         function definitions to int_encoding.cc
8780         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8781         prototypes to int_encoding.h
8782         * reduced_debug_output.cc (int_encoding.h): New include.
8783         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8784         function definitions to int_encoding.cc
8785         (insert_into_vector, read_from_pointer): Move template definitions to
8786         int_encoding.h
8787         * attributes.cc: New file.
8788         * attributes.h: New file.
8789         * int_encoding.cc: New file.
8790         * int_encoding.h: New file.
8791
8792 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8793
8794         PR gold/11055
8795         * incremental-dump.cc (dump_incremental_inputs): New.
8796         (main): Use dump_incremental_inputs.
8797
8798 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8799
8800         PR gold/10893
8801         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8802         checking elfcpp::STT_FUNC.
8803         (Target_i386::Relocate::relocate): Likewise.
8804         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8805
8806         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8807         symbols from shared libraries into normal FUNC symbols.
8808
8809         * symtab.h (Symbol): Add is_func and use it.
8810
8811 2009-12-05  Doug Kwan  <dougkwan@google.com>
8812
8813         * arm.cc (Target_arm::arm_info): Initialize new fields
8814         attributes_section and attributes_vendor.
8815         * i386.cc (Target_i386::i386_info): Same.
8816         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8817         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8818         fields attributes_section and attributes_vendor.
8819         * sparc.cc (Target_sparc::sparc_info): Same.
8820         * target.h (Target::attributes_section, Target::attributes_vendor,
8821         Target::is_attributes_section, Target::attribute_arg_type,
8822         Target::attributes_order): New method definitions.
8823         (Target::Target_info::attributes_section,
8824         Target::Target_info::attributes_vendor): New fields.
8825         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8826         virtual method definitions.
8827         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8828         attributes_section and attributes_vendor.
8829         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8830
8831 2009-12-05  Doug Kwan  <dougkwan@google.com>
8832
8833         * arm.cc: Update comments about interworking and stub generation.
8834         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8835         considered as non-PIC.
8836         (Arm_relocate_functions::base_abs): Fix formatting.
8837         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8838         of function to use GOT entry address instead of offset.
8839         (Target_arm::Scan::global): Issue an error if a symbol would need a
8840         PLT does not get one because it is untyped.  Remove code to create
8841         dynamic symbols for relative branches.
8842         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8843         takes unsigned integer instead of boolean.
8844
8845 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8846
8847         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8848         (two_file_test_LDADD): Likewise.
8849         (common_test_1_LDADD): Likewise.
8850         (exception_test_LDADD) Likewise.
8851         (weak_test_LDADD): Likewise.
8852         (many_sections_test_LDADD): Likewise.
8853         (initpri1_LDADD): Likewise.
8854         (script_test_1_LDADD): Likewise.
8855         (script_test_2_LDADD): Likewise.
8856         (justsyms_LDADD): Likewise.
8857         (binary_test_LDADD): Likewise.
8858         (large_LDADD): Likewise.
8859         * testsuite/Makefile.in: Regenerated.
8860
8861 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8862
8863         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8864         (Symbol_table::override_with_special): Likewise.
8865         (Symbol_table::add_from_object): Likewise.
8866
8867 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8868
8869         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8870         Don't set the data_offset twice.
8871
8872 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8873
8874         * testsuite/Makefile.in: Regenerate.
8875
8876 2009-12-03  Doug Kwan  <dougkwan@google.com>
8877
8878         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8879         (Target_arm::do_finalize_sections): Add parameter for symbol table
8880         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8881         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8882         parameter for symbol table pointer.
8883         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8884         an additional parameter for a pointer to symbol table.
8885         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8886         parameter for a symbol table pointer.
8887         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8888         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8889         Ditto.
8890         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8891         parameter for a symbol table pointer.
8892
8893 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8894
8895         * incremental.cc (Incremental_inputs_header)
8896         (Incremental_inputs_header_write, Incremental_inputs_entry)
8897         (Incremental_inputs_entry_write): Move ...
8898         * incremental.h (Incremental_inputs_header)
8899         (Incremental_inputs_header_write, Incremental_inputs_entry)
8900         (Incremental_inputs_entry_write): here.
8901
8902 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8903
8904         * incremental.cc (make_sized_incremental_binary): Set the target.
8905         Error if it is incompatible.
8906         * output.h (Output_file): Add filename method.
8907
8908 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8909
8910         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8911         from the get_* methods.
8912
8913 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8914
8915         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8916         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8917         Write 0 for the data_offset of scripts.
8918
8919 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8920
8921         * testsuite/Makefile.am: Add the incremental_test.sh test.
8922         * testsuite/incremental_test.sh: New.
8923         * testsuite/incremental_test_1.c: New.
8924         * testsuite/incremental_test_2.c: New.
8925
8926 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8927
8928         * incremental-dump.cc (main): Fix typos.
8929
8930 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8931
8932         PR gold/11025
8933         * incremental-dump.cc (main): Use llu to print 64 bit values.
8934
8935 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8936             H.J. Lu  <hongjiu.lu@intel.com>
8937
8938         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8939         $(LIBDL).
8940         (incremental_dump_LDADD): Likewise.
8941         * Makefile.in: Regenerated.
8942
8943 2009-11-25  Doug Kwan  <dougkwan@google.com>
8944
8945         Revert:
8946
8947         2009-11-25  Doug Kwan  <dougkwan@google.com>
8948
8949                 * arm.cc (Target_arm::Target_arm): Move method definition
8950                 outside of class definition.  Add code to handle
8951                 --target1-rel, --target1-abs and --target2= options.
8952                 (Target_arm::get_reloc_reloc_type): Change method to be
8953                 non-static and const.
8954                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8955                 New data member declaration.
8956                 (Target_arm::Scan::local, Target_arm::Scan::global,
8957                 Target_arm::Relocate::relocate,
8958                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8959                 Adjust call to Target_arm::get_real_reloc_type.
8960                 (Target_arm::get_real_reloc_type): Use command line options
8961                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8962                 * options.h (--target1-rel, --target1-abs, --target2): New
8963                 ARM-only options.
8964
8965 2009-11-25  Doug Kwan  <dougkwan@google.com>
8966
8967         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8968         class definition.  Add code to handle --target1-rel, --target1-abs
8969         and --target2= options.
8970         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8971         and const.
8972         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8973         member declaration.
8974         (Target_arm::Scan::local, Target_arm::Scan::global,
8975         Target_arm::Relocate::relocate,
8976         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8977         call to Target_arm::get_real_reloc_type.
8978         (Target_arm::get_real_reloc_type): Use command line options to
8979         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8980         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8981         options.
8982
8983 2009-11-25  Doug Kwan  <dougkwan@google.com>
8984
8985         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8986         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8987         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8988         formatting.
8989         (Arm_relocate_functions::thm_call): Replace body with a call to
8990         Arm_relocate_functions::thumb_branch_common.
8991         (Arm_relocate_functions::thm_jump24,
8992         Arm_relocate_functions::thm_xpc22): New method definitions.
8993         (Arm_relocate_functions::thumb_branch_common): New method definition.
8994         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8995         operator.
8996         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8997         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8998
8999 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9000
9001         * Makefile.am: Build incremental-dump
9002         * Makefile.in: Regenerate.
9003         * incremental-dump.cc: New.
9004         * incremental.cc (Incremental_inputs_header_data,
9005         Incremental_inputs_entry_data): Move to incremental.h
9006         * incremental.h: (Incremental_inputs_header_data,
9007         Incremental_inputs_entry_data): Move from incremental.cc
9008
9009 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9010
9011         * incremental.cc (Incremental_inputs_header,
9012         Incremental_inputs_header_write, Incremental_inputs_entry,
9013         Incremental_inputs_entry_write): Add a typedef with the data type.
9014
9015 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9016
9017         * incremental.cc (Incremental_inputs_header,
9018         Incremental_inputs_header_write, Incremental_inputs_entry,
9019         Incremental_inputs_entry_write): Update comment about which
9020         type has the filed descriptions.
9021
9022 2009-11-15  Doug Kwan  <dougkwan@google.com>
9023
9024         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9025         (Arm_relocate_functions::arm_branch_common): Change method defintion
9026         in class definition to a method declaration and update list of formal
9027         parameters.
9028         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9029         Arm_relocation_functions::jump24): Adjust call to
9030         Arm_relocate_functions::arm_branch_common.  Update list of formal
9031         parameters.
9032         (Arm_relocate_functions::xpc25): New method definition.
9033         (Arm_relocate_functions::arm_branch_common): Move method defintion
9034         out from class definition.  Use stubs for mode-switching and extending
9035         branch ranges.
9036         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9037         specially.  Change code to enable use of stubs in ARM branches.
9038
9039 2009-11-10  Doug Kwan  <dougkwan@google.com>
9040
9041         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9042         in method declaration.
9043         (Target_arm::relocate_stub): New method declaration.
9044         (Target_arm::default_target): Change to return a pointer instead of
9045         a const reference.
9046         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9047         Target_arm::default_target.
9048         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9049         method definition.
9050         (Target_arm::relocate_section): Adjust view.
9051         (Target_arm::relocate_stub): New method definition.
9052
9053 2009-11-10  Doug Kwan  <dougkwan@google.com>
9054
9055         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9056         a format warning.
9057         * incremental.cc (open_incremental_binary): Initialized local
9058         variables to avoid warnings.
9059         * object.cc (make_elf_object): Ditto.
9060         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9061         a format warning.
9062
9063 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9064
9065         PR gold/10930
9066         * testsuite/plugin_test.c: Include "config.h".
9067
9068 2009-11-09  Doug Kwan  <dougkwan@google.com>
9069
9070         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9071         (arm_symbol_value): Remove.
9072         (Arm_relocate_functions::arm_branch_common,
9073         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9074         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9075         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9076         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9077         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9078         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9079         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9080         Arm_relocate_functions::thm_mobw_abs_nc,
9081         Arm_relocate_functions::thm_mov_abs,
9082         Arm_relocate_functions::movw_prel_nc,
9083         Arm_relocate_functions::thm_movt_abs,
9084         Arm_relocate_functions::movt_prel,
9085         Arm_relocate_functions::thm_movw_prel_nc,
9086         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9087         (Target_arm::Relocate::relocate): Only decompose address into two
9088         parts if relocation type uses the thumb-bit and pass the actual
9089         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9090         calls to methods in Arm_relocate_functions for this change.
9091
9092 2009-11-08  Ian Lance Taylor  <iant@google.com>
9093
9094         PR 10925
9095         * reloc.cc: Instantiate
9096         Sized_relobj::initialize_input_to_output_maps and
9097         Sized_relobj:free_input_to_output_maps.
9098
9099 2009-11-06  Ian Lance Taylor  <iant@google.com>
9100
9101         PR 10876
9102         * defstd.cc (in_segment): Set only_if_ref true for "end".
9103
9104 2009-11-06  Doug Kwan  <dougkwan@google.com>
9105
9106         * arm.cc (class Reloc_stub): Correct a comment.
9107         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9108         (Target_arm::scan_section_for_stubs): New method declaration.
9109         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9110         Change methods from private to protected.
9111         (Target_arm::do_may_relax): New method definition.
9112         (Target_arm::do_relax, Target_arm::group_sections,
9113         Target_arm::scan_reloc_for_stub,
9114         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9115         (Target_arm::arm_input_section_map_): New data member declaration.
9116         (Target_arm::scan_reloc_for_stub,
9117         Target_arm::scan_reloc_section_for_stubs,
9118         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9119         Target_arm::do_relax): New method definitions.
9120
9121 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9122
9123         * configure.ac: Check for (struct stat)::st_mtim
9124         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9125         * config.in: Regenerate.
9126         * configure: Regenerate.
9127
9128 2009-11-05  Ian Lance Taylor  <iant@google.com>
9129
9130         PR 10910
9131         * output.cc (Output_segment::add_output_section): Add missing
9132         return statement.
9133
9134 2009-11-04  Ian Lance Taylor  <iant@google.com>
9135
9136         PR 10880
9137         * object.h (class Object): Add is_needed and set_is_needed
9138         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9139         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9140         defined in a dynamic object and referenced by a regular object,
9141         set is_needed for the dynamic object.
9142         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9143         if the file is marked with as_needed and it is not needed.
9144
9145 2009-11-04  Ian Lance Taylor  <iant@google.com>
9146
9147         PR 10887
9148         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9149         tags if data is discarded by linker script.
9150         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9151         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9152         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9153         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9154
9155 2009-11-04  Ian Lance Taylor  <iant@google.com>
9156
9157         * layout.cc (Layout::get_output_section): Add is_interp and
9158         is_dynamic_linker_section parameters.  Change all callers.
9159         (Layout::choose_output_section): Likewise.
9160         (Layout::make_output_section): Likewise.
9161         (Layout::add_output_section_data): Add is_dynamic_linker_section
9162         parameter.  Change all callers.
9163         * layout.h (class Layout): Update declarations.
9164         * output.h (class Output_section): Add is_interp, set_is_interp,
9165         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9166         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9167         generate_code_fills_at_write_ to a bitfield.
9168         * output.cc (Output_section::Output_sections): Initialize new
9169         fields.
9170         (Output_segment::add_output_section): Add do_sort parameter.
9171         Change all callers.
9172
9173 2009-11-03  Ian Lance Taylor  <iant@google.com>
9174
9175         PR 10860
9176         * options.h (class General_options): Add --warn-common.
9177         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9178         merging two common symbols.
9179         (Symbol_table::should_override): Handle --warn-common when merging
9180         a common symbol with a defined symbol.  Use report_resolve_problem
9181         for multiple definitions.
9182         (Symbol_table::report_resolve_problem): New function.
9183         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9184
9185 2009-11-03  Doug Kwan  <dougkwan@google.com>
9186
9187         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9188         stub_factory_.
9189         (Target_arm::stub_factory): New method definition.
9190         (Target_arm::new_arm_input_section,
9191         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9192         Target_arm::reloc_uses_thumb_bit): New method declarations.
9193         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9194         New type definitions.
9195         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9196         member declarations.
9197         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9198         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9199         New method definitions.
9200
9201 2009-11-03  Ian Lance Taylor  <iant@google.com>
9202
9203         * options.h (class General_options): Add --warn_constructors.
9204
9205 2009-11-03  Ian Lance Taylor  <iant@google.com>
9206
9207         PR 10893
9208         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9209         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9210
9211 2009-11-03  Ian Lance Taylor  <iant@google.com>
9212
9213         PR 10895
9214         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9215         --msgid-bugs-address.
9216         (install-pdf): New target.
9217         (install-data_yes): Look up one directory to find mkinstalldirs.
9218
9219 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9220
9221         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9222         tree.
9223
9224 2009-10-30  Doug Kwan  <dougkwan@google.com>
9225
9226         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9227
9228 2009-10-30  Doug Kwan  <dougkwan@google.com>
9229
9230         * arm.cc (Stub_addend_reader): New struct template definition
9231         and partial specializations.
9232         (Stub_addend_reader::operator()): New method definition for a
9233         partially specialized template.
9234
9235 2009-10-30  Doug Kwan  <dougkwan@google.com>
9236
9237         * arm.cc (Arm_relobj::processor_specific_flags): New method
9238         definition.
9239         (Arm_relobj::do_read_symbols): New method declaration.
9240         (Arm_relobj::processor_specific_flags_): New data member declaration.
9241         (Arm_dynobj): New class definition.
9242         (Target_arm::do_finalize_sections): Add input_objects parameter.
9243         (Target_arm::do_adjust_elf_header): New method declaration.
9244         (Target_arm::are_eabi_versions_compatible,
9245         (Target_arm::merge_processor_specific_flags): New method declaration.
9246         (Target_arm::do_make_elf_object): New overloaded method definitions
9247         and declaration.
9248         (Arm_relobj::do_read_symbols): New method definition.
9249         (Arm_dynobj::do_read_symbols): Ditto.
9250         (Target_arm::do_finalize_sections): Add input_objects parameters.
9251         Merge processor-specific flags from all input objects.
9252         (Target_arm::are_eabi_versions_compatible,
9253         Target_arm::merge_processor_specific_flags,
9254         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9255         New method definitions.
9256         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9257         Input_objects pointer type parameter.
9258         * layout.cc (Layout::finalize): Pass input objects to target's.
9259         finalize_sections function.
9260         * output.cc (Output_file_header::do_sized_write): Set ELF file
9261         header's processor-specific flags.
9262         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9263         Input_objects pointer type parameter.
9264         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9265         * target.h (Input_objects): New forward class declaration.
9266         (Target::processor_specific_flags,
9267         Target::are_processor_specific_flags_sect): New method definitions.
9268         (Target::finalize_sections): Add input_objects parameter.
9269         (Target::Target): Initialize processor_specific_flags_ and
9270         are_processor_specific_flags_set_.
9271         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9272         parameter.
9273         (Target::set_processor_specific_flags): New method definition.
9274         (Target::processor_specific_flags_,
9275         Target::are_processor_specific_flags_set_): New data member
9276         declarations.
9277         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9278         Input_objects pointer type parameter.
9279
9280 2009-10-30  Doug Kwan  <dougkwan@google.com>
9281
9282         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9283
9284 2009-10-28  Ian Lance Taylor  <iant@google.com>
9285
9286         * object.h (class Relobj): Drop options parameter from
9287         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9288         do_scan_relocs, do_relocate.  Change all callers.
9289         (class Sized_relobj): Drop options parameters from
9290         do_gc_process_relocs, do_scan_relocs, do_relocate,
9291         do_relocate_sections, relocate_sections, emit_relocs_scan,
9292         emit_relocs_scan_reltype.  Change all callers.
9293         (struct Relocate_info): Remove options field and all references to
9294         it.
9295         * reloc.h (class Read_relocs): Remove options constructor
9296         parameter and options_ field.  Change all callers.
9297         (class Gc_process_relocs, class Scan_relocs): Likewise.
9298         (class Relocate_task): Likewise.
9299         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9300         all callers.
9301         (scan_relocatable_relocs): Likewise.
9302         * target.h (class Sized_target): Remove options parameter from
9303         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9304         all callers.
9305         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9306         callers.
9307         * arm.cc: Update functions to remove options parameters.
9308         * i386.cc: Likewise.
9309         * powerpc.cc: Likewise.
9310         * sparc.cc: Likewise.
9311         * x86_64.cc: Likewise.
9312         * testsuite/testfile.cc: Likewise.
9313
9314 2009-10-28  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc (Arm_relobj): New class definition.
9317         (Arm_relobj::scan_sections_for_stubs,
9318         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9319         New method definitions.
9320
9321 2009-10-28  Cary Coutant  <ccoutant@google.com>
9322
9323         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9324         (Plugin::cleanup_done_): New member.
9325         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9326         (Plugin_manager::cleanup_done_): Remove.
9327         (Plugin_manager::add_input_file): Edit error message.
9328         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9329         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9330
9331 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9332
9333         * fileread.cc: (File_read::View::~View): Use the new
9334         data_ownership_ filed.
9335         (File_read::~File_read): Dispose the new whole_file_view_.
9336         (File_read::open): Mmap the whole file if needed.
9337         (File_read::open): Use whole_file_view_ instead of contents_.
9338         (File_read::find_view): Use whole_file_view_ if applicable.
9339         (File_read::do_read): Use whole_file_view_ instead of contents_.
9340         (File_read::make_view): Use whole_file_view_ instead of contents_,
9341         update File_read::View::View call.
9342         (File_read::find_or_make_view): Update File_read::View::View
9343         call.
9344         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9345         remove contents_
9346         (File_read::View::Data_ownership): New enum.
9347         (File_read::View::View): Replace bool mapped_ with Data_ownership
9348         argument.
9349         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9350         (File_read::View::data_ownership_): New field.
9351         (File_read::contents_): Remove (replaced by whole_file_view_).
9352         (File_read::whole_file_view_): New field.
9353         * options.h (class General_options): Add --keep-files-mapped.
9354
9355 2009-10-27  Cary Coutant  <ccoutant@google.com>
9356
9357         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9358         * testsuite/Makefile.am (plugin_test_5): New test case.
9359         * testsuite/Makefile.in: Regenerate.
9360
9361 2009-10-25  Doug Kwan  <dougkwan@google.com>
9362
9363         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9364         from private to protected to allow access by child class.
9365         (Sized_relobj::do_relocate_sections): New method declaration.
9366         (Sized_relobj::relocate_sections): Virtualize.
9367         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9368         Sized_relobj::relocate_sections.  Instantiate template explicitly
9369         for different target sizes and endianity.
9370
9371 2009-10-24  Doug Kwan  <dougkwan@google.com>
9372
9373         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9374         (Arm_input_section::as_arm_input_section): New method.
9375         (Arm_output_section): New class definition.
9376         (Arm_output_section::create_stub_group,
9377         Arm_output_section::group_sections): New method definitions.
9378
9379 2009-10-22  Doug Kwan  <dougkwan@google.com>
9380
9381         * arm.cc (Arm_input_section): New class definition.
9382         (Arm_input_section::init, Arm_input_section:do_write,
9383         Arm_input_section::set_final_data_size,
9384         Arm_input_section::do_reset_address_and_file_offset): New method
9385         definitions.
9386
9387 2009-10-21  Doug Kwan  <dougkwan@google.com>
9388
9389         * arm.cc (Stub_table, Arm_input_section): New forward class
9390         declarations.
9391         (Stub_table): New class defintion.
9392         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9393         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9394         New method definition.
9395
9396 2009-10-21  Doug Kwan  <dougkwan@google.com>
9397
9398         * arm.cc: Update copyright comments.
9399         (Target_arm): New forward class template declaration.
9400         (Arm_address): New type.
9401         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9402         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9403         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9404         constants.
9405         (Insn_template): Same.
9406         (DEF_STUBS): New macro.
9407         (Stub_type): New enum type.
9408         (Stub_template): New class definition.
9409         (Stub): Same.
9410         (Reloc_stub): Same.
9411         (Stub_factory): Same.
9412         (Target_arm::Target_arm): Initialize may_use_blx_ and
9413         should_force_pic_veneer_.
9414         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9415         Target_arm::should_force_pic_veneer,
9416         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9417         Target_arm::using_thumb_only, Target_arm:;default_target): New
9418         method defintions.
9419         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9420         New data member declarations.
9421         (Insn_template::size, Insn_template::alignment): New method defintions.
9422         (Stub_template::Stub_template): New method definition.
9423         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9424         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9425         (Stub_factory::Stub_factory): New method definition.
9426         * gold.h (string_hash): New template.
9427         * output.h (Input_section_specifier::hash_value): Use
9428         gold::string_hash.
9429         (Input_section_specifier::string_hash): Remove.
9430         * stringpool.cc (Stringpool_template::string_hash): Use
9431         gold::string_hash.
9432
9433 2009-10-20  Doug Kwan  <dougkwan@google.com>
9434
9435         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9436         symbols of relaxed input sections.
9437         * output.h (Output_section::find_relaxed_input_section): Make
9438         method public.
9439
9440 2009-10-16  Doug Kwan  <dougkwan@google.com>
9441
9442         * dynobj.cc (Versions::Versions): Initialize version_script_.
9443         Only insert base version symbol definition for a shared object
9444         if version script defines any version versions.
9445         (Versions::define_base_version): New method definition.
9446         (Versions::add_def): Check that base version is not needed.
9447         (Versions::add_need): Define base version lazily.
9448         * dynobj.h (Versions::define_base_version): New method declaration.
9449         (Versions::needs_base_version_): New data member declaration.
9450         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9451         (check_DATA): Add no_version_test.stdout.
9452         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9453         New make rules.
9454         * testsuite/Makefile.in: Regenerate.
9455         * testsuite/no_version_test.c: New file.
9456         * testsuite/no_version_test.sh: Ditto.
9457
9458 2009-10-16  Doug Kwan  <dougkwan@google.com>
9459
9460         * expression.cc (class Segment_start_expression): New class definition.
9461         (Segment_start_expression::value): New method definition.
9462         (script_exp_function_segment_start): Return a new
9463         Segment_start_expression.
9464         * gold/script-c.h (script_saw_segment_start_expression): New function
9465         prototype.
9466         * script-sections.cc (Script_sections::Script_sections): Initialize
9467         SAW_SEGMENT_START_EXPRESSION_ to false.
9468         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9469         and -Tbbs options to specify section addresses if given in
9470         command line and no SEGMENT_START expression is seen in a script.
9471         * script-sections.h (Script_sections::saw_segment_start_expression,
9472         Script_sections::set_saw_segment_start_expression): New method
9473         definition.
9474         (Script_sections::saw_segment_start_expression_): New data member
9475         declaration.
9476         * script.cc (script_saw_segment_start_expression): New function.
9477         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9478         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9479         script_test_7.sh and script_test_8.sh.
9480         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9481         script_test_8.stdout.
9482         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9483         (script_test_6, script_test_6.stdout, script_test_7,
9484         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9485         * Makefile.in: Regenerate.
9486         * testsuite/script_test_6.sh: New file.
9487         * testsuite/script_test_6.t: Same.
9488         * testsuite/script_test_7.sh: Same.
9489         * testsuite/script_test_7.t: Same.
9490         * testsuite/script_test_8.sh: Same.
9491
9492 2009-10-16  Doug Kwan  <dougkwan@google.com>
9493
9494         * output.cc (Output_segment::set_section_list_address): Cast
9495         expressions to unsigned long long type to avoid format warnings.
9496
9497 2009-10-15  Ian Lance Taylor  <iant@google.com>
9498
9499         * script.cc (Script_options::add_symbol_assignment): Always add a
9500         dot assignment to script_sections_.
9501         * script-sections.cc (Script_sections::add_dot_assignment):
9502         Initialize if necessary.
9503
9504         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9505         program headers with no load segment if there is a linker script.
9506
9507         * layout.cc (Layout::set_segment_offsets): Align the file offset
9508         to the segment aligment for -N or -n with no load segment.
9509         * output.cc (Output_segment::add_output_section): Don't crash if
9510         the first section is a TLS section.
9511         (Output_segment::set_section_list_addresses): Print an error
9512         message if the address moves backward in a linker script.
9513         * script-sections.cc
9514         (Output_section_element_input::set_section_addresses): Don't
9515         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9516         (Orphan_output_section::set_section_addresses): Likewise.
9517
9518 2009-10-15  Doug Kwan  <dougkwan@google.com>
9519
9520         * layout.cc (Layout::finish_dynamic_section): Generate tags
9521         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9522         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9523         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9524
9525 2009-10-14  Ian Lance Taylor  <iant@google.com>
9526
9527         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9528         fields.
9529         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9530         data_shdr fields of relinfo.
9531         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9532         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9533         R_386_TLS_LDO_32, adjust based on section flags.
9534         (Target_i386::Relocate::fix_up_ldo): Remove.
9535
9536 2009-10-13  Ian Lance Taylor  <iant@google.com>
9537
9538         Add support for -pie.
9539         * options.h (class General_options): Add -pie and
9540         --pic-executable.
9541         (General_options::output_is_position_independent): Test -pie.
9542         (General_options::output_is_executable): Return true if not shared
9543         and not relocatable.
9544         (General_options::output_is_pie): Remove.
9545         * options.cc (General_options::finalize): Reject incompatible uses
9546         of -pie.
9547         * gold.cc (queue_middle_tasks): A -pie link is not static.
9548         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9549         * symtab.cc (Symbol::final_value_is_known): Return false if
9550         output_is_position_independent.
9551         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9552         output_is_position_independent.
9553         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9554         output_is_position_independent.
9555         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9556         output_is_position_independent.
9557         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9558         two_file_pie_test.
9559         (basic_pie_test.o, basic_pie_test): New targets.
9560         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9561         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9562         (two_file_pie_test): New target.
9563         * testsuite/Makefile.in: Rebuild.
9564         * README: Remove note saying that -pie is not supported.
9565
9566 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9567
9568         * options.h (class General_options): Add -init and -fini.
9569         * layout.cc (Layout::finish_dynamic_section): Emit
9570         given init and fini functions.
9571
9572 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9573
9574         * gc.h (gc_process_relocs): Check if icf is enabled using new
9575         function.
9576         * gold.cc (queue_initial_tasks): Likewise.
9577         (queue_middle_tasks): Likewise.
9578         * object.cc (do_layout): Likewise.
9579         * symtab.cc (is_section_folded): Likewise.
9580         * main.cc (main): Likewise.
9581         * reloc.cc (Read_relocs::run): Likewise.
9582         (Sized_relobj::do_scan_relocs): Likewise.
9583         * icf.cc (is_function_ctor_or_dtor): New function.
9584         (Icf::find_identical_sections): Check if function is ctor or dtor when
9585         safe icf is chosen.
9586         * options.h (General_options::icf): Change option to be an enum.
9587         (Icf_status): New enum.
9588         (icf_enabled): New method.
9589         (icf_safe_folding): New method.
9590         (set_icf_status): New method.
9591         (icf_status_): New variable.
9592         * (options.cc) (General_options::finalize): Set icf_status_.
9593         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9594         icf_test and icf_keep_unique_test to use the --icf enum flag.
9595         * testsuite/icf_safe_test.sh: New file.
9596         * testsuite/icf_safe_test.cc: New file.
9597
9598 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9599
9600         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9601         includes to gc.h and icf.h.
9602         * arm.cc: Include gc.h.
9603         * gold.cc: Likewise.
9604         * i386.cc: Likewise.
9605         * powerpc.cc: Likewise.
9606         * sparc.cc: Likewise.
9607         * x86_64.cc: Likewise.
9608         * gc.h: Include icf.h.
9609
9610 2009-10-11  Ian Lance Taylor  <iant@google.com>
9611
9612         * plugin.cc: Include "gold.h" before other header files.
9613
9614 2009-10-10  Chris Demetriou  <cgd@google.com>
9615
9616         * options.h (Input_file_argument::Input_file_type): New enum.
9617         (Input_file_argument::is_lib_): Replace with...
9618         (Input_file_argument::type_): New member.
9619         (Input_file_argument::Input_file_argument): Take Input_file_type
9620         'type' rather than boolean 'is_lib' as second argument.
9621         (Input_file_argument::is_lib): Use type_.
9622         (Input_file_argument::is_searched_file): New function.
9623         (Input_file_argument::may_need_search): Handle is_searched_file.
9624         * options.cc (General_options::parse_library): Support -l:filename.
9625         (General_options::parse_just_symbols): Update for Input_file_argument
9626         changes.
9627         (Command_line::process): Likewise.
9628         * archive.cc (Archive::get_file_and_offset): Likewise.
9629         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9630         * script.cc (read_script_file, script_add_file): Likewise.
9631         * fileread.cc (Input_file::Input_file): Likewise.
9632         (Input_file::will_search_for): Handle is_searched_file.
9633         (Input_file::open): Likewise.
9634         * readsyms.cc (Read_symbols::get_name): Likewise.
9635         * testsuite/Makefile.am (searched_file_test): New test.
9636         * testsuite/Makefile.in: Regenerate.
9637         * testsuite/searched_file_test.cc: New file.
9638         * testsuite/searched_file_test_lib.cc: New file.
9639
9640 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9641             Ian Lance Taylor  <iant@google.com>
9642
9643         * descriptor.cc: Include <cstdio> and "binary-io.h".
9644         (Descriptors::open): Open the files in binary mode always.
9645         * script.cc (Lex::get_token): Treat \r as whitespace.
9646
9647 2009-10-09  Ian Lance Taylor  <iant@google.com>
9648
9649         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9650
9651 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9652             Ian Lance Taylor  <iant@google.com>
9653
9654         * configure.ac: Check for readv function also.
9655         * fileread.cc (readv): Define if not HAVE_READV.
9656         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9657         does not exist.
9658         * config.in: Regenerate.
9659         * configure: Regenerate.
9660
9661 2009-10-09  Doug Kwan  <dougkwan@google.com>
9662
9663         * layout.cc (Layout::make_output_section): Call target hook to make
9664         ordinary output section.
9665         (Layout::finalize): Adjust parameter list of call the
9666         Target::may_relax().
9667         * layout.h (class Layout::section_list): New method.
9668         * merge.h (Output_merge_base::entsize): Change visibility to public.
9669         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9670         New methods.
9671         (Output_merge_string::do_is_string): New method.
9672         * object.cc (Sized_relobj::do_setup): renamed from
9673         Sized_relobj::set_up.
9674         * object.h (Sized_relobj::adjust_shndx,
9675         Sized_relobj::initializ_input_to_output_maps,
9676         Sized_relobj::free_input_to_output_maps): Change visibilities to
9677         protected.
9678         (Sized_relobj::setup): Virtualize.
9679         (Sized_relobj::do_setup): New method declaration.
9680         (Sized_relobj::invalidate_section_offset,
9681         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9682         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9683         * options.cc (parse_int): New function.
9684         * options.h (parse_int): New declaration.
9685         (DEFINE_int): New macro.
9686         (stub_group_size): New option.
9687         * output.cc (Output_section::Output_section): Initialize memebers
9688         merge_section_map_, merge_section_by_properties_map_,
9689         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9690         (Output_section::add_input_section): Handled deferred code-fill
9691         generation and remove an old comment.
9692         (Output_section::add_relaxed_input_section): New method definition.
9693         (Output_section::add_merge_input_section): Use merge section by
9694         properties map to speed to search.  Update merge section maps
9695         as appropriate.
9696         (Output_section::build_relaxation_map): New method definition.
9697         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9698         Same.
9699         (Output_section::relax_input_section): Renamed to
9700         Output_section::convert_input_sections_to_relaxed_sections and change
9701         interface to take a vector of pointers to relaxed sections.
9702         (Output_section::find_merge_section,
9703         Output_section::find_relaxed_input_section): New method definitions.
9704         (Output_section::is_input_address_mapped,
9705         Output_section::output_offset, Output_section::output_address):
9706         Use output section data maps to speed up searching.
9707         (Output_section::find_starting_output_address): Add comments.
9708         (Output_section::do_write,
9709         Output_section::write_to_postprocessing_buffer): Do code-fill
9710         generation as appropriate.
9711         (Output_section::get_input_sections): Invalidate relaxed input section
9712         map.
9713         (Output_section::restore_states): Adjust type of checkpoint .
9714         Invalidate relaxed input section map.
9715         * output.h (Output_merge_base): New class declaration.
9716         (Input_section_specifier): New class defintion.
9717         (class Output_relaxed_input_section) Change base class to
9718         Output_section_data_build.
9719         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9720         base class initializer.
9721         (Output_section::add_relaxed_input_section): New method declaration.
9722         (Output_section::Input_section): Change visibility to protected.
9723         (Output_section::Input_section::relobj,
9724         Output_section::Input_section::shndx): Handle relaxed input sections.
9725         Output_section::input_sections) Change visibility to protected.  Also
9726         define overload to return a non-const pointer.
9727         (Output_section::Merge_section_properties): New class defintion.
9728         (Output_section::Merge_section_by_properties_map,
9729         Output_section::Output_section_data_by_input_section_map,
9730         Output_section::Relaxation_map): New types.
9731         (Output_section::relax_input_section): Rename method to
9732         Output_section::convert_input_sections_to_relaxed_sections and change
9733         interface to take a vector of relaxed section pointers.
9734         (Output_section::find_merge_section,
9735         Output_section::find_relaxed_input_section,
9736         Output_section::build_relaxation_map,
9737         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9738         New method declarations.
9739         (Output_section::merge_section_map_
9740         Output_section::merge_section_by_properties_map_,
9741         Output_section::relaxed_input_section_map_,
9742         Output_section::is_relaxed_input_section_map_valid_,
9743         Output_section::generate_code_fills_at_write_): New data members.
9744         * script-sections.cc
9745         (Output_section_element_input::set_section_addresses): Call
9746         current_data_size and addralign methods of relaxed input sections.
9747         (Orphan_output_section::set_section_addresses): Call current_data_size
9748         and addralign methods of relaxed input sections.
9749         * symtab.cc (Symbol_table::compute_final_value): Extract template
9750         from the body of Symbol_table::sized_finalize_symbol.
9751         (Symbol_table::sized_finalized_symbol): Call
9752         Symbol_table::compute_final_value.
9753         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9754         (Symbol_table::compute_final_value): New templated method declaration.
9755         * target.cc (Target::do_make_output_section): New method defintion.
9756         * target.h (Target::make_output_section): New method declaration.
9757         (Target::relax): Add more parameters for input objects, symbol table
9758         and layout.  Adjust call to do_relax.
9759         (Target::do_make_output_section): New method declaration.
9760         (Target::do_relax): Add parameters for input objects, symbol table
9761         and layout.
9762
9763 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9764
9765         * pread.c: Include stdio.h.
9766
9767 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9768
9769         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9770         defined.
9771
9772 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9773
9774         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9775         Change read_shndx type to unsigned int.
9776         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9777         int.
9778         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9779         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9780         Change read_shndx type to unsigned int.
9781         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9782         int.
9783         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9784         * layout.cc (Layout::create_symtab_sections): Cast the result of
9785         local_symcount * symsize to off_t in the gold_assert.
9786
9787 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9788
9789         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9790         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9791         R_ARM_BASE_ABS.
9792         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9793         (Arm_relocate_functions::thm_abs5): New function.
9794         (Arm_relocate_functions::abs12): New function.
9795         (Arm_relocate_functions::abs16): New function.
9796         (Arm_relocate_functions::base_abs): New function.
9797         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9798         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9799         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9800         R_ARM_BASE_ABS.
9801         (Scan::global): Likewise.
9802         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9803         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9804         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9805         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9806         R_ARM_BASE_ABS.
9807
9808 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9809
9810         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9811         (Arm_relocate_functions::movt_prel): New function.
9812         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9813         (Arm_relocate_functions::thm_movt_prel): New function.
9814         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9815         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9816         (Scan::global, Relocate::relocate): Likewise.
9817         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9818
9819 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9820
9821         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9822         Incremental_checker.
9823         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9824         unsigned int.
9825         (class Incremental_inputs_header): New class.
9826         (Incremental_inputs_header_writer): Edit comment.
9827         (Incremental_inputs_entry): New class.
9828         (Incremental_inputs_entry_writer): Edit comment.
9829         (Sized_incremental_binary::do_find_incremental_inputs_section):
9830         Add *strtab_shndx parameter, fill it.
9831         (Sized_incremental_binary::do_check_inputs): New method.
9832         (Incremental_checker::can_incrementally_link_output_file): Use
9833         Sized_incremental_binary::check_inputs.
9834         (Incremental_inputs::report_command_line): Save command line in
9835         command_line_.
9836         * incremental.h:
9837         (Incremental_binary::find_incremental_inputs_section): New
9838         method.
9839         (Incremental_binary::do_find_incremental_inputs_section): Add
9840         strtab_shndx parameter.
9841         (Incremental_binary::do_check_inputs): New pure virtual method.
9842         (Sized_incremental_binary::do_check_inputs): Declare.
9843         (Incremental_checker::Incremental_checker): Add incremental_inputs
9844         parameter, use it to initialize incremental_inputs_.
9845         (Incremental_checker::incremental_inputs_): New field.
9846         (Incremental_checker::command_line): New method.
9847         (Incremental_checker::inputs): New method.
9848         (Incremental_checker::command_line_): New field.
9849
9850 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9851
9852         * incremental.cc: Include <cstdarg> and "target-select.h".
9853         (vexplain_no_incremental): New function.
9854         (explain_no_incremental): New function.
9855         (Incremental_binary::error): New method.
9856         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9857         method.
9858         (make_sized_incremental_binary): New function.
9859         (open_incremental_binary): New function.
9860         (can_incrementally_link_file): Add checks if output is ELF and has
9861         inputs section.
9862         * incremental.h: Include "elfcpp_file.h" and "output.h".
9863         (Incremental_binary): New class.
9864         (Sized_incremental_binary): New class.
9865         (open_incremental_binary): Declare.
9866         * object.cc (is_elf_object): Use
9867         elfcpp::Elf_recognizer::is_elf_file.
9868         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9869         * output.h (Output_file::filesize): New method.
9870
9871 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9872
9873         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9874         New function.
9875         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9876         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9877         function.
9878         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9879         function.
9880         (Arm_relocate_functions::movw_abs_nc): New function.
9881         (Arm_relocate_functions::movt_abs): New function.
9882         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9883         (Arm_relocate_functions::thm_movt_abs): New function.
9884         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9885         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9886         (Scan::global): Likewise.
9887         (Relocate::relocate): Likewise.
9888         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9889
9890 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9891
9892         * arm.cc (Arm_relocate_functions::got_prel) New function.
9893         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9894         (Relocate::relocate): Likewise.
9895         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9896
9897 2009-10-06  Ian Lance Taylor  <iant@google.com>
9898
9899         * options.h (class General_options): Define
9900         split_stack_adjust_size parameter.
9901         * object.h (class Object): Add uses_split_stack_ and
9902         has_no_split_stack_ fields.  Add uses_split_stack and
9903         has_no_split_stack accessor functions.  Declare
9904         handle_split_stack_section.
9905         (class Reloc_symbol_changes): Define.
9906         (class Sized_relobj): Define Function_offsets.  Declare
9907         split_stack_adjust, split_stack_adjust_reltype, and
9908         find_functions.
9909         * object.cc (Object::handle_split_stack_section): New function.
9910         (Sized_relobj::do_layout): Call handle_split_stack_section.
9911         * dynobj.cc (Sized_dynobj::do_layout): Call
9912         handle_split_stack_section.
9913         * reloc.cc (Sized_relobj::relocate_sections): Call
9914         split_stack_adjust for executable sections in split_stack
9915         objects.  Pass reloc_map to relocate_section.
9916         (Sized_relobj::split_stack_adjust): New function.
9917         (Sized_relobj::split_stack_adjust_reltype): New function.
9918         (Sized_relobj::find_functions): New function.
9919         * target-reloc.h: Include "object.h".
9920         (relocate_section): Add reloc_symbol_changes parameter.  Change
9921         all callers.
9922         * target.h (class Target): Add calls_non_split method.  Declare
9923         do_calls_non_split virtual method.  Declare match_view and
9924         set_view_to_nop.
9925         * target.cc: Include "elfcpp.h".
9926         (Target::do_calls_non_split): New function.
9927         (Target::match_view): New function.
9928         (Target::set_view_to_nop): New function.
9929         * gold.cc (queue_middle_tasks): Give an error if mixing
9930         split-stack and non-split-stack objects with -r.
9931         * i386.cc (Target_i386::relocate_section): Add
9932         reloc_symbol_changes parameter.
9933         (Target_i386::do_calls_non_split): New function.
9934         * x86_64.cc (Target_x86_64::relocate_section): Add
9935         reloc_symbol_changes parameter.
9936         (Target_x86_64::do_calls_non_split): New function.
9937         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9938         parameter.
9939         * powerpc.cc (Target_powerpc::relocate_section): Add
9940         reloc_symbol_changes parameter.
9941         * sparc.cc (Target_sparc::relocate_section): Add
9942         reloc_symbol_changes parameter.
9943         * configure.ac: Call AM_CONDITIONAL for the default target.
9944         * configure: Rebuild.
9945         * testsuite/Makefile.am (TEST_AS): New variable.
9946         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9947         (check_DATA): Add split_i386 and split_x86_64 files.
9948         (SPLIT_DEFSYMS): Define.
9949         (split_i386_[1234n].o): New targets.
9950         (split_i386_[124]): New targets.
9951         (split_i386_[1234r].stdout): New targets.
9952         (split_x86_64_[1234n].o): New targets.
9953         (split_x86_64_[124]): New targets.
9954         (split_x86_64_[1234r].stdout): New targets.
9955         (MOSTLYCLEANFILES): Add new executables.
9956         * testsuite/split_i386.sh: New file.
9957         * testsuite/split_x86_64.sh: New file.
9958         * testsuite/split_i386_1.s: New file.
9959         * testsuite/split_i386_2.s: New file.
9960         * testsuite/split_i386_3.s: New file.
9961         * testsuite/split_i386_4.s: New file.
9962         * testsuite/split_i386_n.s: New file.
9963         * testsuite/split_x86_64_1.s: New file.
9964         * testsuite/split_x86_64_2.s: New file.
9965         * testsuite/split_x86_64_3.s: New file.
9966         * testsuite/split_x86_64_4.s: New file.
9967         * testsuite/split_x86_64_n.s: New file.
9968         * testsuite/testfile.cc (Target_test): Update relocation_section
9969         function.
9970         * testsuite/Makefile.in: Rebuild.
9971
9972 2009-10-06  Ian Lance Taylor  <iant@google.com>
9973
9974         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9975         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9976         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9977         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9978         the address on ldo_addrs_.
9979         (Target_i386::Relocate::fix_up_ldo): New function.
9980
9981 2009-10-06   Rafael Espindola  <espindola@google.com>
9982
9983         * plugin.cc (add_input_library): New.
9984         (Plugin::load): Add add_input_library to tv.
9985         (Plugin_manager::add_input_file): Add the is_lib argument.
9986         (add_input_file): Update call to Plugin_manager::add_input_file.
9987         (add_input_library): New.
9988         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9989
9990 2009-09-30  Doug Kwan  <dougkwan@google.com>
9991
9992         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9993         symbol and call Symbol::may_need_copy_reloc to determine if
9994         a copy reloc is needed.
9995         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9996         nocopyreloc is given in command line.
9997         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9998         given in command line.
9999         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10000         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10001         of the removed Target_i386::may_need_copy_reloc.
10002         * options.h (copyreloc): New option with default value false.
10003         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10004         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10005         instead of the removed Target_powerpc::may_need_copy_reloc.
10006         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10007         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10008         instead of the removed Target_sparc::may_need_copy_reloc.
10009         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10010         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10011         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10012         instead of the removed Target_x86_64::may_need_copy_reloc.
10013
10014 2009-09-30  Ian Lance Taylor  <iant@google.com>
10015
10016         * object.h (class Object): Remove target_ field, and target,
10017         sized_target, and set_target methods.
10018         (Object::sized_target): Remove.
10019         (class Sized_relobj): Update declarations.  Remove sized_target.
10020         * object.cc (Sized_relobj::setup): Remove target parameter.
10021         Change all callers.
10022         (Input_objects::add_object): Don't do anything with the target.
10023         (make_elf_sized_object): Add punconfigured parameter.  Change all
10024         callers.  Set or test parameter target.
10025         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10026         Change all callers.
10027         * parameters.cc (Parameters::set_target): Change parameter type to
10028         be non-const.
10029         (Parameters::default_target): Remove.
10030         (set_parameters_target): Change parameter type to be non-const.
10031         (parameters_force_valid_target): New function.
10032         (parameters_clear_target): New function.
10033         * parameters.h (class Parameters): Update declarations.  Remove
10034         default_target method.  Add sized_target and clear_target
10035         methods.  Change target_ to be non-const.
10036         (set_parameters_target): Update declaration.
10037         (parameters_force_valid_target): Declare.
10038         (parameters_clear_target): Declare.
10039         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10040         as NULL if we aren't searching.
10041         (Add_symbols::run): Don't check for compatible target.
10042         * fileread.cc (Input_file::open_binary): Call
10043         parameters_force_valid_target.
10044         * gold.cc (queue_middle_tasks): Likewise.
10045         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10046         set_target on object.
10047         * dynobj.h (class Sized_dynobj): Update declarations.
10048         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10049         make_elf_object returns NULL.
10050         (Archive::include_member): Don't check whether object target is
10051         compatible.
10052         * output.cc (Output_section::add_input_section): Get target from
10053         parameters.
10054         (Output_section::relax_input_section): Likewise.
10055         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10056         parameters.
10057         (Sized_relobj::do_scan_relocs): Likewise.
10058         (Sized_relobj::relocate_sections): Likewise.
10059         * resolve.cc (Symbol_table::resolve): Likewise.
10060         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10061         parameter.  Change all callers.
10062         (Symbol_table::add_from_object): Get target from parameters.
10063         (Symbol_table::add_from_relobj): Don't check object target.
10064         (Symbol_table::add_from_dynobj): Likewise.
10065         (Symbol_table::define_special_symbol): Get target from
10066         parameters.
10067         * symtab.h (class Symbol_table): Update declaration.
10068         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10069         parameter.  Change all callers.  Clear parameter target.
10070         (Binary_test): Test target here.
10071         * testsuite/object_unittest.cc (gold_testsuite): Remove
10072         target_test_pointer parameter.  Change all callers.
10073         (Object_test): Test target here.
10074
10075 2009-09-26  Ian Lance Taylor  <iant@google.com>
10076
10077         * testsuite/initpri1.c: Don't try to use constructor priorities if
10078         compiling with gcc before 4.3.
10079
10080 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10081
10082         * testsuite/retain_symbols_file_test.sh (check_present): Change
10083         output file name to retain_symbols_file_test.stdout.
10084         (check_absent): Likewise.
10085
10086 2009-09-18  Craig Silverstein  <csilvers@google.com>
10087
10088         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10089         * options.cc: Include <cerrno> and <fstream>.
10090         (General_options::finalize): Parse -retain-symbols-file tag.
10091         * options.h: New flag.
10092         (General_options): New method should_retain_symbol, new
10093         variable symbols_to_retain.
10094         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10095         should_retain_symbol map.
10096         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10097         * testsuite/Makefile.in: Regenerate.
10098         * testsuite/retain_symbols_file_test.sh: New file.
10099
10100 2009-09-18  Nick Clifton  <nickc@redhat.com>
10101
10102         * po/es.po: Updated Spanish translation.
10103
10104 2009-09-17  Doug Kwan  <dougkwan@google.com>
10105
10106         * debug.h (DEBUG_RELAXATION): New constant.
10107         (DEBUG_ALL): Add DEBUG_RELAXATION.
10108         (debug_string_to_enum): Add relaxation debug option.
10109         * layout.cc
10110         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10111         Layout::Relaxation_debug_check::read_sections,
10112         Layout::Relaxation_debug_check::read_sections): New method definitions.
10113         (Layout::Layout): Initialize data members
10114         record_output_section_data_from_scrips_,
10115         script_output_section_data_list_ and relaxation_debug_check_.
10116         (Layout::save_segments, Layout::restore_segments,
10117         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10118         Layout::relaxation_loop_body): New method definitions.
10119         (Layout::finalize): Support relaxation.  Move section layout code to
10120         Layout::relaxation_loop_body.
10121         (Layout::set_asection_address_from_script): Move code for orphan
10122         section placement out.
10123         (Layout::place_orphan_sections_in_script): New method definition.
10124         * layout.h (Output_segment_headers, Output_file_header):
10125         New forward class declarations.
10126         (Layout::~Layout): Define.
10127         (Layout::new_output_section_data_from_script): New method definition.
10128         (Layout::place_orphan_sections_in_script): New method declaration.
10129         (Layout::Segment_states): New type declaration.
10130         (Layout::save_segments, Layout::restore_segments,
10131         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10132         Layout::relaxation_loop_body): New method declarations.
10133         (Layout::Output_section_data_list): New type declaration.
10134         (Layout::Relaxation_debug_check): New class definition.
10135         (Layout::record_output_section_data_from_script_,
10136         Layout::script_output_section_data_list_, Layout::segment_states_,
10137         Layout::relaxation_debug_check_): New data members.
10138         * output.cc: (Output_section_headers::do_size): New method definition.
10139         (Output_section_headers::Output_section_headers): Move size
10140         computation to Output_section_headers::do_size.
10141         (Output_segment_headers::do_size): New method definition.
10142         (Output_file_header::Output_file_header): Move size computation to
10143         Output_file_header::do_size and call it.
10144         (Output_file_header::do_size): New method definition.
10145         (Output_data_group::Output_data_group): Adjust call to
10146         Output_section_data.
10147         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10148         (Output_symtab_xindex::do_write): Add array bound check.
10149         (Output_section::Input_section::print_to_mapfile): Handle
10150         RELAXED_INPUT_SECTION_CODE.
10151         (Output_section::Output_section): Initialize data member checkpoint_.
10152         (Output_section::~Output_section): Delete checkpoint object pointed
10153         by checkpoint_.
10154         (Output_section::add_input_section): Always add an Input_section if
10155         relaxing.
10156         (Output_section::add_merge_input_section): Add assert.
10157         (Output_section::relax_input_section): New method definition.
10158         (Output_section::set_final_data_size): Set load address to zero for
10159         an unallocated section.
10160         (Output_section::do_address_and_file_offset_have_reset_values):
10161         New method definition.
10162         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10163         Handle relaxed input section.
10164         (Output_section::sort_attached_input_sections): Checkpoint input
10165         section list lazily.
10166         (Output_section::get_input_sections): Change type of input_sections to
10167         list of Simple_input_section pointers.  Checkpoint input section list
10168         lazily.  Also handle relaxed input sections.
10169         (Output_section::add_input_section_for_script): Take a reference to
10170         a Simple_input_section object instead of Relobj pointer and section
10171         index as parameter.  Handle relaxed input sections.
10172         (Output_section::save_states, Output_section::restore_states): New
10173         method definitions.
10174         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10175         (Output_data::is_data_size_fixed): New method definition.
10176         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10177         if it is fixed.
10178         (Output_data::address_and_file_offset_have_reset_values): New method
10179         definition.
10180         (Output_data::do_address_and_file_offset_have_reset_values): New method
10181         definition.
10182         (Output_data::set_data_size): Check that data size is not fixed.
10183         (Output_data::fix_data_size): New method definition.
10184         (Output_data::is_data_size_fixed_): New data member.
10185         (Output_section_headers::set_final_data_size): New method definition.
10186         (Output_section_headers::do_size): New method declaration.
10187         (Output_segment_headers::set_final_data_size): New method definition.
10188         (Output_segment_headers::do_size): New method declaration.
10189         (Output_file_header::set_final_data_size)::New method definition.
10190         (Output_file_header::do_size)::New method declaration.
10191         (Output_section_data::Output_section_data): Add new parameter
10192         is_data_size_fixed and use it to fix data size.
10193         (Output_data_const::Output_data_const): Adjust call to base class
10194         constructor and fix data size.
10195         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10196         base class constructor and fix data size.
10197         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10198         base class constructor and fix data size.
10199         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10200         class constructor and fix data size.
10201         (Output_data_group::set_final_data_size): New method definition.
10202         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10203         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10204         class constructor and fix data size.
10205         (Output_relaxed_input_section): New class definition.
10206         (Output_section::Simple_input_section): New class definition.
10207         (Output_section::get_input_sections): Adjust parameter list.
10208         (Output_section::add_input_section_for_script): Same.
10209         (Output_section::save_states, Output_section::restore_states,
10210         Output_section::do_address_and_file_offset_have_reset_values,
10211         (Output_section::Input_section::Input_section): Handle
10212         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10213         Output_relaxed_input_section.
10214         (Output_section::Input_section::is_input_section,
10215         Output_section::Input_section::set_output_section): Handle relaxed
10216         input section.
10217         (Output_section::Input_section::is_relaxed_input_section,
10218         Output_section::Input_section::output_section_data,
10219         Output_section::Input_section::relaxed_input_section): New method
10220         definitions.
10221         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10222         value.
10223         (Output_section::Input_section::u1_): Update comments.
10224         (Output_section::Input_section::u2_): Add new union member poris.
10225         (Output_section::Checkpoint_output_section): New classs definition.
10226         (Output_section::relax_input_section): New method declaration.
10227         (Output_section::checkpoint_): New data member.
10228         (Output_segment): Update comments.
10229         (Output_segment::Output_segment): Un-privatize copy constructor.
10230         (Output_segment::operator=): Un-privatize.
10231         * script-sections.cc (Output_section_element::Input_section_list):
10232         Change element type to Output_section::Simple_input_section.
10233         (Output_section_element_dot_assignment::set_section_addresses):
10234         Register output section data for relaxation clean up.
10235         (Output_data_exression::Output_data_expression): Adjust call to base
10236         constructor to fix data size.
10237         (Output_section_element_data::set_section_addresses): Register
10238         Output_data_expression object for relaxation clean up.
10239         (struct Input_section_info): Replace Relobj pointer and section index
10240         pair with Output_section::Simple_input_section and Convert struct to a
10241         class.
10242         (Input_section_sorter::operator()): Adjust access to
10243         Input_section_info data member to use accessors.
10244         (Output_section_element_input::set_section_addresses): Use layout
10245         parameter.  Adjust code to use Output_section::Simple_input_section
10246         and Input_secction_info classes.  Register filler for relaxation
10247         clean up.
10248         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10249         and section index pair with Output_section::Simple_input_section
10250         class.  Adjust code accordingly.
10251         (Phdrs_element::release_segment): New method definition.
10252         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10253         segment list.
10254         (Script_sections::release_segments): New method definition.
10255         * gold/script-sections.h (Script_sections::release_segments): New
10256         method declaration.
10257         * gold/target.h (Target::may_relax, Target::relax,
10258         Target::do_may_relax, Target::do_relax): New method definitions.
10259
10260 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10261
10262         * arm.cc (has_signed_unsigned_overflow): New function.
10263         (Arm_relocate_functions::abs8): New function.
10264         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10265         (Target_arm::Scan::global): Likewise.
10266         (Target_arm::relocate::relocate): Likewise.
10267         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10268         Likewise.
10269
10270 2009-09-16  Cary Coutant  <ccoutant@google.com>
10271
10272         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10273         * testsuite/Makefile.in: Regenerate.
10274
10275 2009-09-11  Nick Clifton  <nickc@redhat.com>
10276
10277         * po/gold.pot: Updated by the Translation project.
10278
10279 2009-09-08  Cary Coutant  <ccoutant@google.com>
10280
10281         * output.cc (Output_file::open): Add execute permission to empty file.
10282         * testsuite/Makefile.am (permission_test): New test.
10283         * testsuite/Makefile.in: Regenerate.
10284
10285 2009-09-02  Ian Lance Taylor  <iant@google.com>
10286
10287         * output.cc (Output_file::resize): Call map_no_anonymous rather
10288         than map.
10289
10290 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10291
10292         * gold.cc: Include "incremental.h".
10293         (queue_initial_tasks): Call Incremental_checker methods.
10294         * incremental.cc: Include "output.h".
10295         (Incremental_checker::can_incrementally_link_output_file): New
10296         method.
10297         * incremental.h (Incremental_checker): New class.
10298
10299         * output.cc (Output_file::open_for_modification): New method.
10300         (Output_file::map_anonymous): Changed return type to bool.  Record
10301         map in base_ field.
10302         (Output_file::map_no_anonymous): New method, broken out of map.
10303         (Output_file::map): Use map_no_anonymous and map_anonymous.
10304         * output.h (class Output_file): Update declarations.
10305
10306 2009-08-24  Cary Coutant  <ccoutant@google.com>
10307
10308         * options.h (Command_line::Pre_options): New class.
10309         (Command_line::pre_options): New member.
10310         * options.cc (gold::options::ready_to_register): New variable.
10311         (One_option::register_option): Do nothing if not registering options.
10312         Assert if same short option registered twice.
10313         (General_options::General_options): Turn off option registration when
10314         done constructing.
10315         (Command_line::Pre_options::Pre_options): New constructor.
10316
10317 2009-08-24  Cary Coutant  <ccoutant@google.com>
10318
10319         * options.h (General_options::no_keep_memory): Remove incorrect
10320         short option.
10321
10322 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10323
10324         * Makefile.am (am__skiplex, am__skipyacc): New.
10325         * Makefile.in: Regenerate.
10326
10327 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10328
10329         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10330         (INCLUDES): ... this.
10331         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10332         (AM_CPPFLAGS): Renamed from ...
10333         (INCLUDE): ... this.
10334         * Makefile.in, testsuite/Makefile.in: Regenerate.
10335
10336         * Makefile.in: Regenerate.
10337         * aclocal.m4: Likewise.
10338         * config.in: Likewise.
10339         * configure: Likewise.
10340         * testsuite/Makefile.in: Likewise.
10341
10342         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10343         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10344         * Makefile.in: Regenerate.
10345         * testsuite/Makefile.in: Regenerate.
10346
10347 2009-08-19  Cary Coutant  <ccoutant@google.com>
10348
10349         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10350         symbols in shared libraries overridden by hidden or internal symbols
10351         in the main program.
10352
10353 2009-08-19  Chris Demetriou  <cgd@google.com>
10354
10355         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10356         checking source file names in error messages.
10357
10358 2009-08-18  Doug Kwan  <dougkwan@google.com>
10359
10360         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10361         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10362         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10363         an elfcpp::Ehdr as parameter.
10364         * object.cc (Object::set_target): Remove the version that looks up
10365         a target and sets it.
10366         (Sized_relobj::setup): Take a Target object instead of
10367         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10368         (make_elf_sized_object): Find target and ask target to
10369         make an ELF object.
10370         * object.h: (Object::set_target): Remove the version that looks up
10371         a target and sets it.
10372         (Sized_relobj::setup): Take a Target object instead of
10373         an elfcpp:Ehdr as parameter.
10374         * target.cc: Include dynobj.h.
10375         (Target::do_make_elf_object_implementation): New.
10376         (Target::do_make_elf_object): New.
10377         * target.h (Target::make_elf_object): New template declaration.
10378         (Target::do_make_elf_object): New method declarations.
10379         (Target::do_make_elf_object_implementation): New template declaration.
10380
10381 2009-08-14  Ian Lance Taylor  <iant@google.com>
10382
10383         * gold.h (FUNCTION_NAME): Define.
10384         (gold_unreachable): Use FUNCTION_NAME.
10385
10386 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10387
10388         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10389         symbol in the --keep-unique list is not found.
10390
10391 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10392
10393         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10394         been maked as --keep-unique.
10395         (Icf::unfold_section): New function.
10396         * icf.h (Icf::unfold_section): New function.
10397         * options.h (General_options::keep_unique): New option.
10398         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10399         * testsuite/Makefile.in: Regenerate.
10400         * testsuite/icf_keep_unique_test.sh: New file.
10401         * testsuite/icf_keep_unique_test.cc: New file.
10402
10403 2009-08-12  Cary Coutant  <ccoutant@google.com>
10404
10405         PR 10471
10406         * resolve.cc (Symbol_table::resolve): Check for references from
10407         dynamic objects to hidden and internal symbols.
10408         * testsuite/Makefile.am (hidden_test.sh): New test.
10409         * testsuite/Makefile.in: Regenerate.
10410         * testsuite/hidden_test.sh: New script.
10411         * testsuite/hidden_test_1.c: New test source.
10412         * testsuite/hidden_test_main.c: New test source.
10413
10414 2009-08-11  Doug Kwan  <dougkwan@google.com>
10415
10416         * arm.cc: Update comments.
10417         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10418         segment to locate the .ARM.exidx section if present.
10419
10420 2009-08-09  Doug Kwan  <dougkwan@google.com>
10421
10422         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10423         patch.
10424
10425 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10426         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10427         compiler warnings.
10428
10429 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10430
10431         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10432         valid tls_segment only for non-debug-section relocations.
10433         * testsuite/Makefile.am: Add gc_tls_test.
10434         * testsuite/Makefile.in: Regenerate.
10435         * testsuite/gc_tls_test.cc: New file.
10436         * testsuite/gc_tls_test.sh: New file.
10437
10438 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10439
10440         * icf.cc: New file.
10441         * icf.h: New file.
10442         * Makefile.am (CCFILES): Add icf.cc.
10443         (HFILES): Add icf.h
10444         * Makefile.in: Regenerate.
10445         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10446         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10447         section, symbol and addend information for the relocs.
10448         * gold.cc (queue_middle_tasks): Call identical code folding.
10449         * gold.h: Add defines for multimap.
10450         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10451         to the call of finalize_local_symbols.
10452         * main.cc (main): Create object of class Icf.
10453         * object.cc (Sized_relobj::do_layout): Allow this function to be
10454         called twice during icf.
10455         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10456         to sections marked as identical by icf.
10457         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10458         when available.
10459         (Sized_relobj::do_section_entsize): New function.
10460         * object.h (Object::section_entsize): New function.
10461         (Object::do_section_entsize): New pure virtual function.
10462         (Relobj::finalize_local_symbols): Add new parameter.
10463         (Relobj::do_section_entsize): New function.
10464         * options.h (General_options::icf): New option.
10465         (General_options::icf_iterations): New option.
10466         (General_options::print_icf_sections): New option.
10467         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10468         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10469         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10470         icf.
10471         * symtab.cc (Symbol_table::is_section_folded): New function.
10472         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10473         to sections marked as identical by icf.
10474         * symtab.h (Symbol_table::set_icf): New function.
10475         (Symbol_table::icf): New function.
10476         (Symbol_table::is_section_folded): New function.
10477         (Symbol_table::icf_): New data member.
10478         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10479         * testsuite/Makefile.am: Add commands to build icf_test.
10480         * testsuite/Makefile.in: Regenerate.
10481         * testsuite/icf_test.sh: New file.
10482         * testsuite/icf_test.cc: New file.
10483
10484 2009-07-24  Chris Demetriou  <cgd@google.com>
10485
10486         * layout.cc (is_compressible_debug_section): Fix incorrect
10487         comment about compressed section names.
10488
10489 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10490
10491         PR 10419
10492         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10493
10494 2009-07-16  Ian Lance Taylor  <iant@google.com>
10495
10496         PR 10400
10497         * layout.h: #include <map>.
10498         (class Kept_section): Change from struct to class.  Add accessors
10499         and setters.  Add section size to Comdat_group mapping.  Change
10500         Comdat_group to std::map.  Add is_comdat_ field.  Add
10501         linkonce_size field in union.
10502         (class Layout): Update declaration of find_or_add_kept_section.
10503         Don't declare find_kept_object.
10504         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10505         parameter.  Add object, shndx, is_comdat, and is_group_name
10506         parameters.  Change all callers.  Adjust for new Kept_section.
10507         (Layout::find_kept_object): Remove.
10508         * object.cc (Sized_relobj::include_section_group): Update use of
10509         Kept_section.  Rename secnum to shndx.  Only record
10510         Kept_comdat_section if sections are the same size.
10511         (Sized_relobj::include_linkonce_section): Update use of
10512         Kept_section.  Only record Kept_comdat_section if sections are the
10513         same size.  Set size of linkonce section.
10514         (Sized_relobj::map_to_kept_section): Update call to
10515         get_kept_comdat_section.
10516         * object.h (class Sized_relobj): Rename fields in
10517         Kept_comdat_section to drop trailing underscores; change object
10518         field to Relobj*.  Change Kept_comdat_section_table to store
10519         struct rather than pointer.
10520         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10521         Add kept_object and kept_shndx parameters.  Change all callers.
10522         (Sized_relobj::get_kept_comdat_section): Change return type to
10523         bool.  Add kept_object and kept_shndx parameters.  Change all
10524         callers.
10525         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10526         Layout::find_or_add_kept_section.
10527
10528 2009-07-09  Ian Lance Taylor  <iant@google.com>
10529
10530         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10531         Reserve space in the hash table.
10532
10533 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10534
10535         * fileread.cc (File_read::get_mtime): New method.
10536         * fileread.h (Timespec): New structure.
10537         (File_read::get_mtime): New method.
10538         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10539         Renamed from timestamp_nsec.
10540         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10541         Elf_Xword.
10542         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10543         timestamp_nsec.
10544         (Incremental_inputs::report_archive): Save mtime; style fix.
10545         (Incremental_inputs::report_obejct): Save mtime; style fix.
10546         (Incremental_inputs::report_script): Save mtime; style fix.
10547         (Incremental_inputs::finalize_inputs): Style fix.
10548         (Incremental_inputs::finalize): Style fix.
10549         (Incremental_inputs::create_input_section_data): Store inputs
10550         mtime.
10551         * incremental.h (Incremental_inputs::report_script): Add mtime
10552         argument.
10553         (Incremental_inputs::Input_info::Input_info): Intialize only one
10554         union member.
10555         (Incremental_inputs::Input_info::archive): Move to nameless
10556         union.
10557         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10558         (Incremental_inputs::Input_info::script): Move to nameless union.
10559         (Incremental_inputs::mtime): New field.
10560         * script.cc (read_input_script): Pass file mtime to
10561         Incremental_input.
10562         * script.h (Script_info::inputs): Style fix.
10563
10564 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10565
10566         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10567         instead of 32.
10568
10569 2009-06-24  Ian Lance Taylor  <iant@google.com>
10570
10571         PR 10156
10572         * layout.cc (Layout::choose_output_section): If we find an
10573         existing section, update the flags.
10574         (Layout::create_notes): New function, broken out of
10575         Layout::finalize.
10576         (Layout::finalize): Don't create note sections.
10577         (Layout::create_note): Don't crash if linker script discards
10578         section.
10579         (Layout::create_gold_note): Likewise.
10580         (Layout::create_build_id): Likewise.  Don't set
10581         after_input_sections on the section.
10582         (Layout::create_executable_stack_info): Remove target parameter.
10583         Change caller.
10584         * layout.h (class Layout): Declare create_notes.  Update
10585         declaration of create_executable_stack_info.
10586         * gold.cc (queue_middle_tasks): Call create_notes.
10587         * output.cc (Output_section::update_flags_for_input_section): Move
10588         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10589         invalid.
10590         * output.h (Output_data::mark_address_invalid): New function.
10591         (class Output_section): Only declare, not define,
10592         update_flags_for_input_section.  Remove set_flags.
10593
10594 2009-06-24  Ian Lance Taylor  <iant@google.com>
10595
10596         * script-sections.cc (Output_section_definition::
10597         set_section_addresses): Rename shadowing local load_address to
10598         laddr.
10599
10600 2009-06-24  Ian Lance Taylor  <iant@google.com>
10601
10602         PR 10244
10603         * reloc.cc (relocate_sections): Skip empty relocation sections.
10604
10605 2009-06-23  Ian Lance Taylor  <iant@google.com>
10606
10607         PR 10156
10608         * layout.cc (Layout::create_note): Use choose_output_section
10609         rather than make_output_section.
10610
10611 2009-06-23  Ian Lance Taylor  <iant@google.com>
10612
10613         PR 10237
10614         * options.cc (General_options::parse_V): Set printed_version_.
10615         (General_options::General_options): Initialize printed_version_.
10616         * options.h (class General_options): Add printed_version_ field.
10617         * gold.cc (queue_initial_tasks): If there are no input files,
10618         don't give a fatal error if we printed the version information.
10619         (queue_middle_tasks): If using -r with a shared object, give a
10620         fatal error rather than an ordinary error.
10621
10622 2009-06-23  Ian Lance Taylor  <iant@google.com>
10623
10624         PR 10219
10625         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10626         (Layout::make_output_section): Set have_stabstr_section_ if we see
10627         a .stab*str section.
10628         (Layout::finalize): Call link_stabs_sections.
10629         (Layout::link_stabs_sections): New file.
10630         * layout.h (class Layout): Add have_stabstr_section_ field.
10631         Declare link_stabs_sections.
10632
10633 2009-06-23  Doug Kwan  <dougkwan@google.com>
10634
10635         * Makefile.am (libgold_a_LIBADD): New.
10636         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10637         * Makefile.in: Regenerate.
10638         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10639         * configure: Regenerate.
10640         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10641         * fileread.cc: Include sys/state.h
10642         * gold.h: Declare memmem and strndup if found missing.
10643         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10644
10645 2009-06-23  Ian Lance Taylor  <iant@google.com>
10646
10647         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10648         * configure: Rebuild.
10649
10650 2009-06-23  Ian Lance Taylor  <iant@google.com>
10651
10652         PR 10147
10653         * object.cc (Object::section_contents): Don't try to get a view if
10654         the section has length zero.
10655         (Object::handle_gnu_warning_section): If the section is empty, use
10656         the name of the section as the warning.
10657
10658 2009-06-23  Ian Lance Taylor  <iant@google.com>
10659
10660         PR 10133
10661         * stringpool.h (class Stringpool_template): Add optimize_ field.
10662         (Stringpool_template::set_optimize): New function.
10663         * stringpool.cc (Stringpool_template::Stringpool_template):
10664         Initialize optimize_ field.
10665         (Stringpool_template::set_string_offsets): Test local optimize
10666         fild rather than parameter.
10667         * layout.cc (Layout::Layout): Call set_optimize on the section
10668         name stringpool.
10669
10670 2009-06-22  Ian Lance Taylor  <iant@google.com>
10671
10672         PR 10030
10673         * yyscript.y: Parse TARGET.
10674         * script.cc (script_set_target): New function.
10675         * script-c.h (script_set_target): Declare.
10676         * options.cc (General_options::string_to_object_format): Rename
10677         from string_to_object_format in anonymous namespace.  Change
10678         callers.
10679         * options.h (class General_options): Declare
10680         string_to_object_format.
10681
10682 2009-06-22  Ian Lance Taylor  <iant@google.com>
10683
10684         * script-sections.cc (Script_sections::create_segments): Don't put
10685         program headers in a PT_LOAD segment if -n or -N.
10686
10687 2009-06-22  Ian Lance Taylor  <iant@google.com>
10688
10689         PR 10141
10690         * options.h (class General_options): Add -z lazy and -z now.  Sort
10691         -z options into alphabetical order.
10692         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10693
10694 2009-06-21  Ian Lance Taylor  <iant@google.com>
10695
10696         * layout.cc (Layout::make_output_section): Call
10697         Target::new_output_section.
10698         (Layout::attach_allocated_section_to_segment): Put large section
10699         sections in a separate load segment with the large segment flag
10700         set.
10701         (Layout::segment_precedes): Sort large data segments after other
10702         load segments.
10703         (align_file_offset): New static function.
10704         (Layout::set_segment_offsets): Use align_file_offset.
10705         * output.h (class Output_section): Add is_small_section_ and
10706         is_large_section_ fields.
10707         (Output_section::is_small_section): New function.
10708         (Output_section::set_is_small_section):  New function.
10709         (Output_section::is_large_section): New function.
10710         (Output_section::set_is_large_section): New function.
10711         (Output_section::is_large_data_section): New function.
10712         (class Output_segment): Add is_large_data_segment_ field.
10713         (Output_segment::is_large_data_segment): New function.
10714         (Output_segment::set_is_large_data_segment): New function.
10715         * output.cc (Output_section::Output_section): Initialize new
10716         fields.
10717         (Output_segment::Output_segment): Likewise.
10718         (Output_segment::add_output_section): Add assertion that large
10719         data sections always go in large data segments.  Force small data
10720         sections to the end of the list of data sections.  Force small BSS
10721         sections to the start of the list of BSS sections.  For large BSS
10722         sections to the end of the list of BSS sections.
10723         * symtab.h (class Symbol): Declare is_common_shndx.
10724         (Symbol::is_defined): Check Symbol::is_common_shndx.
10725         (Symbol::is_common): Likewise.
10726         (class Symbol_table): Define enum Commons_section_type.  Update
10727         declarations.  Add small_commons_ and large_commons_ fields.
10728         * symtab.cc (Symbol::is_common_shndx): New function.
10729         (Symbol_table::Symbol_table): Initialize new fields.
10730         (Symbol_table::add_from_object): Put small and large common
10731         symbols in the right list.
10732         (Symbol_table::sized_finalized_symbol): Check
10733         Symbol::is_common_shndx.
10734         (Symbol_table::sized_write_globals): Likewise.
10735         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10736         common symbol lists.  Don't call do_allocate_commons_list if the
10737         list is empty.
10738         (Symbol_table::do_allocate_commons_list): Remove is_tls
10739         parameter.  Add comons_section_type parameter.  Change all
10740         callers.  Handle small and large common symbols.
10741         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10742         Symbol::is_common_shndx.
10743         * resolve.cc (symbol_to_bits): Likewise.
10744         * target.h (Target::small_common_shndx): New function.
10745         (Target::small_common_section_flags): New function.
10746         (Target::large_common_shndx): New function.
10747         (Target::large_common_section_flags): New function.
10748         (Target::new_output_section): New function.
10749         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10750         small_common_section_flags, and large_common_section_flags
10751         fields.
10752         (Target::do_new_output_section): New virtual function.
10753         * arm.cc (Target_arm::arm_info): Initialize new fields.
10754         * i386.cc (Target_i386::i386_info): Likewise.
10755         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10756         Likewise.
10757         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10758         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10759         (Target_x86_64::do_new_output_section): New function.
10760         * configure.ac: Define conditional MCMODEL_MEDIUM.
10761         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10762         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10763         (large_LDFLAGS): Define.
10764         * testsuite/large.c: New file.
10765         * testsuite/testfile.cc (Target_test::test_target_info):
10766         Initialize new fields.
10767         * configure, testsuite/Makefile.in: Rebuild.
10768
10769 2009-06-05  Doug Kwan  <dougkwan@google.com>
10770
10771         * Makefile.am (CCFILES): Add target.cc.
10772         * Makefile.in: Regenerate.
10773         * i386.cc (class Target_i386): Define new virtual method to
10774         override do_is_local_label_name in parent.
10775         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10776         local symbols if --discard-locals or -X is given.
10777         * options.h (class General_options): Declare new options
10778         '--discard-locals' and '-X' for discarding locals.
10779         * target.h (class Target): Define new methods is_local_label_name.
10780         Declare new virtual method do_is_local_label_name.
10781         * target.cc: New file.
10782         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10783         (check_SCRIPTS): Add discard_locals_test.sh.
10784         (check_DATA): Add discard_local_tests.syms.
10785         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10786         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10787         * testsuite/Makefile.in: Regenerate.
10788         * testsuite/discard_locals_test.c: New file.
10789         * testsuite/discard_locals_test.sh: Same.
10790
10791 2009-06-05  Doug Kwan  <dougkwan@google.com>
10792
10793         * object.cc (Sized_relobj::Sized_relobj): Initialize
10794         discarded_eh_frame_shndx_ to -1U.
10795         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10796         section.
10797         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10798         a discarded .eh_frame section.
10799         (Sized_relobj::do_finalize_local_symbols): Ditto.
10800         * object.h (class Sized_relobj): Declare new member
10801         discarded_eh_frame_shndx_.
10802         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10803         (local_labels_test.o, local_labels_test): New rules.
10804         * testsuite/Makefile.in: Regenerate.
10805
10806 2009-06-04  Doug Kwan  <dougkwan@google.com>
10807
10808         * layout.cc (Layout::section_name_mapping): Add mapping for
10809         special ARM sections.
10810
10811 2009-06-03  Doug Kwan  <dougkwan@google.com>
10812
10813         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10814         (utils::has_overflow): Same.
10815
10816 2009-06-03  Ian Lance Taylor  <iant@google.com>
10817
10818         * layout.cc (Layout::section_name_mapping): New array, replacing
10819         Layout::linkonce_mapping.
10820         (Layout::section_name_mapping_count): New variable, replacing
10821         Layout::linkonce_mapping_count.
10822         (Layout::linkonce_output_name): Remove.
10823         (Layout::output_section_name): Rewrite.
10824         * layout.h (class Layout): Rename Linkonce_mapping to
10825         Section_name_mapping, linkonce_mapping to section_name_mapping,
10826         linkonce_mapping_count to section_name_mapping_count.  Don't
10827         declare linkonce_output_name.
10828
10829 2009-06-03  Doug Kwan  <dougkwan@google.com>
10830
10831         * gold/arm.cc (namespace utils): New.
10832         (Target_arm::reloc_is_non_pic): Define new method.
10833         (class Arm_relocate_functions): New.
10834         (Target_arm::Relocate::relocate): Handle relocation types used by
10835         Android.
10836
10837 2009-06-03  Ian Lance Taylor  <iant@google.com>
10838
10839         * arm.cc (Target_arm::scan::global): Use || instead of |.
10840
10841 2009-06-02  Doug Kwan  <dougkwan@google.com>
10842
10843         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10844         issued_non_pic_error_.
10845         (class Target_arm::Scan): Declare new method check_non_pic.
10846         Define new method symbol_needs_plt_entry.
10847         Declare new data member issued_non_pic_error_.
10848         (class Target_arm::Relocate): Declare new method
10849         should_apply_static_reloc.
10850         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10851         (Target_arm::Scan::check_non_pic): Define new method.
10852         (Target_arm::Scan::local): Handle a small subset of reloc types used
10853         by Android.
10854         (Target_arm::Scan::local): Same.
10855         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10856
10857 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10858
10859         * incremental.cc (Incremental_inputs::report_command_line): Filter
10860         out --incremental-* options.
10861
10862 2009-05-29  Doug Kwan  <dougkwan@google.com>
10863
10864         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10865         template class.
10866         (class Target_arm): Update comment.
10867         (Target_arm::Target_arm): Initialize new data members GOT_,
10868         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10869         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10870         and Target_arm::rel_dyn_section.
10871         Declare new_enum Target_arm::Got_type.
10872         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10873         and DYNBSS_.
10874         Update commments for member do_dynsym_value.
10875         (Target_arm::got_size, Target_arm::plt_section,
10876         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10877         new methods inside class defintion.
10878         (Target_arm::got_section): Define new method.
10879         (Target_arm::rel_dyn_section): Same.
10880         (Output_data_plt_arm): New template class.
10881         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10882         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10883         (Output_data_plt_arm::add_entry): Same.
10884         (Output_data_plt_arm::first_plt_entry): Define new
10885         static data member for PLT instruction template.
10886         (Output_data_plt_arm::plt_entry): Same.
10887         (Output_data_plt_arm::do_write): Define new method.
10888         (Target_arm::make_plt_entry): Same.
10889         (Target_arm::do_finalize_sections): Same.
10890         (Target_arm::do_dynsym_value): Same.
10891
10892 2009-05-28  Doug Kwan  <dougkwan@google.com>
10893
10894         * Makefile.am (TARGETSOURCES): Add arm.cc.
10895         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10896         * Makefile.in: Regenerate.
10897         * arm.cc: New file.
10898         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10899
10900 2009-05-26  Doug Kwan  <dougkwan@google.com>
10901
10902         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10903         (General_options::check_excluded_libs): Strip off directories in
10904         archive name before matching like GNU ld does.
10905         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10906         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10907         (exclude_libs_test_LDFLAGS): Add linker option
10908         -Wl,--exclude-libs,libexclude_libs_test_3
10909         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10910         an explicit archive without using -l.
10911         (alt/libexclude_libs_test_3.a): New make rule.
10912         * testsuite/Makefile.in: Regenerate.
10913         * testsuite/exclude_libs_test.c : Declare lib3_default().
10914         (main): Call it.
10915         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10916         * exclude_libs_test_3.c: New file.
10917
10918 2009-05-26  Nick Clifton  <nickc@redhat.com>
10919
10920         * po/id.po: New Indonesian translation.
10921         * po/gold.pot: Updated template file.
10922
10923 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10924
10925         * testsuite/Makefile.am: Add -ffunction-sections to compile
10926         gc_comdat_test files.  Add -Wl,--gc-sections to build
10927         gc_comdat_test.
10928         * testsuite/Makefile.in: Regenerate.
10929         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10930
10931 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10932
10933         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10934         kept comdat section was garbage collected.
10935         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10936         * testsuite/Makefile.in: Regenerate.
10937         * testsuite/gc_comdat_test.sh: New file.
10938         * testsuite/gc_comdat_test_1.cc: New file.
10939         * testsuite/gc_comdat_test_2.cc: New file.
10940
10941 2009-05-19  Doug Kwan  <dougkwan@google.com>
10942
10943         * archive.cc (Archive::Archive): Move constructor from archive.h
10944         to here.  Initialize no_export_.
10945         (Archive::get_elf_object_for_member): Set no_export flag of object.
10946         * archive.h (Archive::Archive): Move constructor body to
10947         archive.cc.
10948         (Archive::no_export): New method.
10949         (Archive::no_export_): New field.
10950         * object.h (Object::Object): Initialize no_export_ to false.
10951         (Object::no_export, Object::set_no_export): New methods.
10952         (Object::no_export_): New field.
10953         * options.cc (General_options::parse_exclude_libs): New method.
10954         (General_options::check_excluded_libs) Same.
10955         * options.h (exclude_libs): New option.
10956         (General_options::check_excluded_libs): New method declaration.
10957         (General_options::excluded_libs_): New field.
10958         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10959         default or protected visibility if an object has no-export flag set.
10960         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10961         (check_SCRIPTS): Add exclude_libs_test.sh.
10962         (check_DATA): Add exclude_libs_test.syms.
10963         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10964         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10965         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10966         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10967         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10968         libexclude_libs_test_2.a): New rules.
10969         * testsuite/Makefile.in: Regenerate.
10970         * testsuite/exclude_libs_test.c: New file.
10971         * testsuite/exclude_libs_test.sh: Ditto.
10972         * testsuite/exclude_libs_test_1.c: Ditto.
10973         * testsuite/exclude_libs_test_2.c: Ditto.
10974
10975 2009-05-15  Ian Lance Taylor  <iant@google.com>
10976
10977         * configure.ac: Check for declarations for cases where libiberty.h
10978         checks HAVE_DECL_xxx.
10979         * configure, config.in: Rebuild.
10980
10981 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10982
10983         * gold.h (Incremental_argument_list): Remove (invalid) forward
10984         declaration.
10985         * incremental.cc (Incremental_inputs::report_achive): New method.
10986         (Incremental_inputs::report_object): New method.
10987         (Incremental_inputs::report_script): New method.
10988         (Incremental_inputs::finalize_inputs): New method.
10989         (Incremental_inputs::finalize): Call finalize_inputs().
10990         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10991         Create inputs entries.
10992         * incremental.h (Incremental_input_type): New enum.
10993         (Incremental_inputs::Incremental_input): Initialize new fields.
10994         (Incremental_inputs::report_inputs): New method.
10995         (Incremental_inputs::report_achive): New method.
10996         (Incremental_inputs::report_object): New method.
10997         (Incremental_inputs::report_script): New method.
10998         (Incremental_inputs::finalize_inputs): New method.
10999         (Incremental_inputs::Input_info): New struct.
11000         (Incremental_inputs::Input_info_map): New typedef.
11001         (Incremental_inputs::lock_): New field.
11002         (Incremental_inputs::Inputs_): New field.
11003         (Incremental_inputs::Inputs_map): New field.
11004         * main.cc (main): Call Incremental_input::report_inputs.
11005         * options.h (Input_argument_list): Typedef moved from
11006         Input_arguments.
11007         (Input_file_group::Files): Remove, use ::Input_argument_list.
11008         (Input_file_group::Input_argument_list): Remove, use
11009         ::Input_argument_list.
11010         * plugin.cc (Plugin_manager::add_input_file): Add error in
11011         incremental build.
11012         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11013         functions.
11014         * script.cc (read_input_script): Call
11015         Incremental_input::report_script.
11016         * script.h (Script_info): New class.
11017
11018 2009-04-27  Ian Lance Taylor  <iant@google.com>
11019
11020         * x86_64.cc (do_adjust_output_section): Set entsize to
11021         plt_entry_size.
11022
11023 2009-04-23  Elliott Hughes  <enh@google.com>
11024
11025         * output.cc (Output_file::close): After short writes, continue
11026         writing from the correct offset in the buffer being written.
11027
11028 2009-04-23  Chris Demetriou  <cgd@google.com>
11029
11030         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11031         * configure: Regenerate.
11032         * config.in: Regenerate.
11033         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11034         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11035
11036 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11037
11038         * incremental.cc (Incremental_inputs_header_data): Renamed from
11039         Incremental_input_header_data.
11040         (Incremental_inputs_header_data::data_size): New field.
11041         (Incremental_inputs_header_data::put_input_file_count): Renamed
11042         from input_file_count.
11043         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11044         from command_line_offset.
11045         (Incremental_inputs_header_data::put_reserved): Renamed from
11046         put_reserved.
11047         (Incremental_inputs_entry_data): Renamed from
11048         Incremental_input_entry_data.
11049         (Incremental_inputs_entry_data::data_size): New field.
11050         (Incremental_inputs::report_command_line): New method.
11051         (Incremental_inputs::finalize): New method.
11052         (Incremental_inputs::create_incremental_inputs_data): New method.
11053         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11054         * incremental.h: New file.
11055         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11056         (Layout::finalize): Create incremental inputs section in
11057         incremental builds.
11058         (Layout::create_incremental_info_sections): New method.
11059         * layout.h (Layout::incremental_inputs): New method.
11060         (Layout::create_incremental_info_sections): New method.
11061         (Layout::incremental_inputs_): New field.
11062         * main.cc (main): Notify Incremental_input of the command line.
11063
11064 2009-04-01  Ian Lance Taylor  <iant@google.com>
11065             Mikolaj Zalewski  <mikolajz@google.com>
11066
11067         * gold.h (reserve_unordered_map): Define, three versions, one for
11068         each version of Unordered_map.
11069         * layout.cc (Layout::Layout): Remove options parameter.  Add
11070         number_of_input_files parameter.  Don't initialize options_.
11071         Initialize number_of_input_files_ and resized_signatures_.  Move
11072         sections_are_attached_.
11073         (Layout::layout_group): Reserve space for group_signatures_.
11074         (Layout::find_or_add_kept_section): Change name parameter to be a
11075         reference.  Resize signatures_ map when it gets large enough.
11076         (Layout::layout_eh_frame): Use parameters->options() instead of
11077         this->options_.
11078         (Layout::make_output_section): Likewise.
11079         (Layout::attach_allocated_section_to_segment): Likewise.
11080         (Layout::finalize, Layout::create_executable_stack): Likewise.
11081         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11082         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11083         * layout.h (class Layout): Update declarations.  Remove options_
11084         field.  Add number_of_input_files_ and resized_signatures_
11085         fields.  Move sections_are_attached_ field.
11086         * main.cc (main): Pass number of input files to Layout
11087         constructor.  Don't pass options.
11088
11089 2009-03-30  Ian Lance Taylor  <iant@google.com>
11090
11091         * ffsll.c (ffsll): Correct implementation.
11092
11093 2009-03-27  Ian Lance Taylor  <iant@google.com>
11094
11095         * ffsll.c: New file.
11096         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11097         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11098         * ftruncate.c (ftruncate): Declare before definition.
11099         * mremap.c (mremap): Likewise.
11100         * pread.c (pread): Likewise.
11101         * configure, Makefile.in, config.in: Rebuild.
11102
11103         * mremap.c: New file.
11104         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11105         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11106         (mremap): Declare if HAVE_MREMAP is not defined.
11107         * configure, Makefile.in, config.in: Rebuild.
11108
11109 2009-03-27  Cary Coutant  <ccoutant@google.com>
11110
11111         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11112         position independent.
11113         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11114         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11115
11116 2009-03-24  Cary Coutant  <ccoutant@google.com>
11117
11118         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11119         an executable.
11120         (needs_dynamic_reloc): Likewise.
11121
11122 2009-03-24  Ian Lance Taylor  <iant@google.com>
11123
11124         * yyscript.y (file_cmd): Recognize EXTERN.
11125         (extern_name_list, extern_name_list_body): New nonterminals.
11126         * script.cc (script_add_extern): Define.
11127         * script-c.h (script_add_extern): Declare.
11128
11129 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11130
11131         * object.cc (is_elf_object): Define.
11132         * object.h (is_elf_object): Declare.
11133         * archive.cc (Archive::get_elf_object_for_member): Call
11134         is_elf_object.
11135         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11136
11137 2009-03-24  Elliott Hughes  <enh@google.com>
11138
11139         * output.cc (Output_file::map_anonymous): Define.
11140         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11141         try an anonymous one.  Report the size if the mmap fails.
11142         * output.h (class Output_file): Declare map_anonymous.
11143
11144 2009-03-24  Ian Lance Taylor  <iant@google.com>
11145
11146         * target-select.cc (instantiate_target): Don't acquire the lock if
11147         the instantiated_target_ field has already been set.
11148
11149 2009-03-23  Ian Lance Taylor  <iant@google.com>
11150
11151         * gold-threads.h (class Initialize_lock): Define.
11152         * gold-threads.cc (class Initialize_lock_once): Define.
11153         (initialize_lock_control): New static variable.
11154         (initialize_lock_pointer): New static variable.
11155         (initialize_lock_once): New static function.
11156         (Initialize_lock::Initialize_lock): Define.
11157         (Initialize_lock::initialize): Define.
11158         * target-select.h: Include "gold-threads.h".
11159         (class Target_selector): Add lock_ and initialize_lock_ fields.
11160         Don't define instantiate_target, just declare it.
11161         * target-select.cc (Target_selector::Target_selector): Initialize
11162         new fields.
11163         (Target_selector::instantiate_target): Define.
11164         * descriptors.h: Include "gold-threads.h".
11165         (class Descriptors): Add initialize_lock_ field.
11166         * descriptors.cc (Descriptors::Descriptors): Initialize new
11167         field.
11168         (Descriptors::open): Use initialize_lock_ field
11169         * errors.h (class Errors): Add initialize_lock_ field.
11170         * errors.cc (Errors::Errors): Initialize new field.
11171         (Errors::initialize_lock): Use initialize_lock_ field.
11172         * powerpc.cc (class Target_selector_powerpc): Remove
11173         instantiated_target_ field.  In do_recognize call
11174         instantiate_target rather than do_instantiate_target.  In
11175         do_instantiate_target just allocate a new target.
11176         * sparc.cc (class Target_selector_sparc): Likewise.
11177
11178         * freebsd.h: New file.
11179         * i386.cc: Include "freebsd.h".
11180         (Target_i386): Derive from Target_freebsd rather than
11181         Sized_target.
11182         (Target_selector_i386): Derive from Target_selector_freebsd rather
11183         than Target_selector.
11184         * x86_64.cc: Include "freebsd.h".
11185         (Target_x86_64): Derive from Target_freebsd rather than
11186         Sized_target.
11187         (Target_selector_x86_64): Derive from Target_selector_freebsd
11188         rather than Target_selector.
11189         * target.h (class Target): Add adjust_elf_header and
11190         do_adjust_elf_header.
11191         * output.cc (Output_file_header:: do_sized_write): Call target
11192         adjust_elf_header routine.
11193         * configure.tgt: Set targ_osabi.
11194         * configure.ac: Define GOLD_DEFAULT_OSABI.
11195         * parameters.cc (Parameters::default_target): Pass
11196         GOLD_DEFAULT_OSABI to select_target.
11197         * target-select.h (class Target_selector): Make instantiate_target
11198         protected rather than private.
11199         * Makefile.am (HFILES): Add freebsd.h.
11200         * configure, Makefile.in, config.in: Rebuild.
11201
11202         * merge.cc (do_add_input_section): Correct pend value.  Change
11203         message about last entry not being null terminated from error to
11204         warning.
11205
11206 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11207
11208         * incremental.cc: New file.
11209         * Makefile.am (CCFILES): Add incremental.cc.
11210         * Makefile.in: Rebuild.
11211
11212 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11213
11214         * layout.cc (Layout::output_section_name): Preserve names
11215         of '.note.' sections.
11216
11217 2009-03-19  Ian Lance Taylor  <iant@google.com>
11218
11219         * descriptors.cc (Descriptors::open): Check that the options are
11220         valid before using them.
11221
11222 2009-03-18  Ian Lance Taylor  <iant@google.com>
11223
11224         * script-sections.h: Include <list>.
11225         (class Script_sections): Change Sections_elements from std::vector
11226         to std::list.  Typedef public Elements_iterator.  Add
11227         orphan_section_placement_, data_segment_align_start_, and
11228         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11229         field.
11230         * script-sections.cc (class Orphan_section_placement): New class.
11231         (class Sections_element): Add virtual functions is_relro and
11232         orphan_section_init.  Remove virtual function place_orphan_here.
11233         (class Output_section_definition): Add is_relro and
11234         orphan_section_init.  Remove place_orphan_here.
11235         (class Orphan_output_section): Likewise.
11236         (Script_sections::Script_sections): Update for field changes.
11237         (Script_sections::data_segment_align): Set saw_data_segment_align_
11238         and data_segment_align_start_, not data_segment_align_index.
11239         (Script_sections::data_segment_relro_end): Check
11240         saw_data_segment_align_.  Use data_segment_align_start_ rather
11241         than data_segment_align_index_.
11242         (Script_sections::place_orphan): Rewrite to use
11243         Orphan_section_placement.
11244
11245 2009-03-17  Ian Lance Taylor  <iant@google.com>
11246
11247         * archive.cc (Archive::add_symbols): Check for a version attached
11248         to the symbol name in the archive map.
11249         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11250         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11251         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11252         (ver_test_11.a): New target.
11253         * testsuite/Makefile.in: Rebuild.
11254
11255         * configure.ac: Check for chsize and posix_fallocate.  Replace
11256         ftruncate.
11257         * ftruncate.c: New file, from gnulib.
11258         * output.cc (posix_fallocate): Define dummy version if not
11259         HAVE_POSIX_FALLOCATE.
11260         (Output_file::map): Call posix_fallocate rather than lseek and
11261         write.
11262         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11263         * configure, Makefile.in, config.in: Rebuild.
11264
11265 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11266
11267         * layout.h (Layout::create_note): Add section_name parameter.
11268         * layout.cc (Layout::create_note): Likewise.
11269         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11270
11271 2009-03-17  Ian Lance Taylor  <iant@google.com>
11272
11273         * descriptors.cc: Include "options.h".
11274         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11275         (Descriptors::open): Always use O_CLOEXEC when opening a new
11276         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11277         then set FD_CLOEXEC.
11278
11279         * sparc.cc (class Target_sparc): Add has_got_section.
11280         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11281         make sure we have a GOT section.
11282
11283         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11284         (Target_sparc::Scan::local): Likewise.
11285         (Target_sparc::Scan::global): Likewise.
11286         (Target_sparc::Relocate::relocate): Likewise.
11287         (Target_sparc::Relocate::relocate_tls): Likewise.
11288
11289         * symtab.cc (Symbol_table::define_default_version): New function,
11290         broken out of add_from_object.
11291         (Symbol_table::add_from_object): Call define_default_version.
11292         (Symbol_table::define_special_symbol): Add resolve_oldsym
11293         parameter.  Change all callers.  If the version for a symbol comes
11294         from a version script, resolve it with the symbol with the same
11295         name with no version.  Also add the symbol without a version if
11296         appropriate.
11297         (do_define_in_output_data): If resolving with oldsym, don't delete
11298         sym.
11299         (do_define_in_output_segment): Likewise.
11300         (do_define_as_constant): Likewise.
11301         * symtab.h (class Symbol_table): Update declarations.
11302
11303 2009-03-13  Ian Lance Taylor  <iant@google.com>
11304
11305         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11306         (Read_symbols::requeue): New function.
11307         (Read_symbols::do_read_symbols): If make_elf_object fails because
11308         the target type is not configured, and the file was searched for,
11309         issue a warning and retry with the next directory.
11310         (Add_symbols::run): If the file has an incompatible format, and
11311         it was searched for, requeue the Read_symbols task.  On error,
11312         release the object.
11313         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11314         dirindex parameter to constructor.  Change all callers.  Declare
11315         incompatible_warning and requeue.
11316         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11317         input_argument_ and input_group_ fields.  Add them to
11318         constructor.  Change all callers.
11319         (class Read_script): Add dirindex_ field.  Add it to constructor.
11320         Change all callers.
11321         * archive.cc (Archive::setup): Remove input_objects parameter.
11322         Change all callers.
11323         (Archive::get_file_and_offset): Likewise.
11324         (Archive::read_all_symbols): Likewise.
11325         (Archive::read_symbols): Likewise.
11326         (Archive::get_elf_object_for_member): Remove input_objects
11327         parameter.  Add punconfigured parameter.  Change all callers.
11328         (Archive::add_symbols): Change return type to bool.  Check return
11329         value of include_member.
11330         (Archive::include_all_members): Likewise.
11331         (Archive::include_member): Change return type to bool.  Return
11332         false if first included object has incompatible target.  Set
11333         included_member_ field.
11334         (Add_archive_symbols::run): If add_symbols returns false, requeue
11335         Read_symbols task.
11336         * archive.h (class Archive): Add included_member_ field.
11337         Initialize it in constructor.  Add input_file and searched_for
11338         methods.  Update declarations.
11339         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11340         input_argument_ fields.  Add them to constructor.  Change all
11341         callers.
11342         * script.cc: Include "target-select.h".
11343         (class Parser_closure): Add skip_on_incompatible_target_ and
11344         found_incompatible_target_ fields.  Add
11345         skip_on_incompatible_target parameter to constructor.  Change all
11346         callers.  Add methods skip_on_incompatible_target,
11347         clear_skip_on_incompatible_target, found_incompatible_target, and
11348         set_found_incompatible_target.
11349         (read_input_script): Add dirindex parameter.  Change all callers.
11350         If parser finds an incompatible target, requeue Read_symbols
11351         task.
11352         (script_set_symbol): Clear skip_on_incompatible_target in
11353         closure.
11354         (script_add_assertion, script_parse_option): Likewise.
11355         (script_start_sections, script_add_phdr): Likewise.
11356         (script_check_output_format): New function.
11357         * script.h (read_input_script): Update declaration.
11358         * script-c.h (script_check_output_format): Declare.
11359         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11360         (ignore_cmd): Remove OUTPUT_FORMAT.
11361         * fileread.cc (Input_file::Input_file): Add explicit this.
11362         (Input_file::will_search_for): New function.
11363         (Input_file::open): Add pindex parameter.  Change all callers.
11364         * fileread.h (class Input_file): Add input_file_argument method.
11365         Declare will_search_for.  Update declarations.
11366         * object.cc (make_elf_object): Add punconfigured parameter.
11367         Change all callers.
11368         * object.h (class Object): Make input_file public.  Add
11369         searched_for method.
11370         (make_elf_object): Update declaration.
11371         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11372         restart search.
11373         * dirsearch.h (class Dirsearch): Update declaration.
11374         * options.h (class General_options): Add --warn-search-mismatch.
11375         * parameters.cc (Parameters::is_compatible_target): New function.
11376         * parameters.h (class Parameters): Declare is_compatible_target.
11377         * workqueue.cc (Workqueue::add_blocker): New function.
11378         * workqueue.h (class Workqueue): Declare add_blocker.
11379
11380         * fileread.cc (Input_file::open): Remove options parameter.
11381         Change all callers.
11382         (Input_file::open_binary): Likewise.
11383         * script.cc (read_input_script): Likewise.
11384         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11385         options parameter from constructor.  Change all callers.
11386         (class Read_script): Likewise.
11387         * fileread.h (class Input_file): Update declarations.
11388         * script.h (read_input_script): Update declaration.
11389
11390 2009-03-10  Nick Clifton  <nickc@redhat.com>
11391
11392         * po/es.po: New Spanish translation.
11393
11394 2009-03-06  Cary Coutant  <ccoutant@google.com>
11395
11396         * options.cc (parse_short_option): Keep dash_z from registering itself.
11397
11398 2009-03-03  Ian Lance Taylor  <iant@google.com>
11399
11400         PR 9918
11401         * target-reloc.h (relocate_section): Pass output_section to
11402         relocate.
11403         * i386.cc (Target_i386::should_apply_static_reloc): Add
11404         output_section parameter.  Change all callers.
11405         (Target_i386::Relocate::relocate): Add output_section parameter.
11406         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11407         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11408         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11409         * testsuite/two_file_shared.sh: New script.
11410         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11411         (check_DATA): Add two_file_shared.dbg.
11412         (two_file_shared.dbg): New target.
11413         * testsuite/Makefile.in: Rebuild.
11414
11415 2009-03-01  Ian Lance Taylor  <iant@google.com>
11416
11417         * configure.ac: Check for byteswap.h.
11418         * configure: Rebuild.
11419         * config.in: Rebuild.
11420
11421 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11422
11423         * layout.cc (Layout::find_or_add_kept_section): New function.
11424         (Layout::add_comdat): Removed.
11425         * layout.h (struct Kept_section): Move out of class Layout.
11426         Remove trailing underscores from field names.  Add group_sections
11427         field.  Rename group_ field to is_group.  Change all uses.
11428         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11429         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11430         comdat_groups_ field.
11431         (Sized_relobj::include_section_group): Use
11432         find_or_add_kept_section and Kept_section::group_sections.
11433         (Sized_relobj::include_linkonce_section): Likewise.
11434         * object.cc (class Sized_relobj): Don't define Comdat_group or
11435         Comdat_group_table.  Remove find_comdat_group and
11436         add_comdat_group.  Remove comdat_groups_ field.
11437         * plugin.cc (include_comdat_group): Use
11438         Layout::find_or_add_kept_section.
11439
11440 2009-02-28  Ian Lance Taylor  <iant@google.com>
11441
11442         * README: --gc-sections and map files are now supported.  Document
11443         some build requirements.
11444
11445         PR 6992
11446         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11447         relocatable link set the value of the section symbol to zero.
11448         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11449         relocatable link don't include the section address in the local
11450         symbol value.
11451
11452 2009-02-27  Ian Lance Taylor  <iant@google.com>
11453
11454         PR 6811
11455         * options.h (class Search_directory): Add is_system_directory.
11456         (class General_options): Declare is_in_system_directory.
11457         * options.cc (get_relative_sysroot): Make static.
11458         (get_default_sysroot): Make static.
11459         (General_optoins::is_in_system_directory): New function.
11460         * fileread.cc (Input_file::is_in_system_directory): New function.
11461         * fileread.h (class Input_file): Declare is_in_system_directory.
11462         * object.h (class Object): Add is_in_system_directory.
11463         (class Input_objects): Remove system_library_directory_ field.
11464         * object.cc (Input_objects::add_object): Don't set
11465         system_library_directory_.
11466         (input_objects::found_in_system_library_directory): Remove.
11467         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11468         parameter.  Change all callers.
11469         (Symbol_table::sized_write_globals): Likewise.
11470         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11471         Call Object::is_in_system_directory.
11472         * symtab.h (class Symbol_table): Update declarations.
11473
11474         PR 5990
11475         * descriptors.h (Open_descriptor): Add is_on_stack field.
11476         * descriptors.cc (Descriptors::open): If the descriptor is on the
11477         top of the stack, remove it.  Initialize is_on_stack field.
11478         (Descriptors::release): Only add pod to stack if it is not on the
11479         stack already.
11480         (Descriptors::close_some_descriptor): Clear stack_next and
11481         is_on_stack fields.
11482
11483         PR 7091
11484         * output.cc (Output_section::find_starting_output_address): Rename
11485         from starting_output_address; add PADDR parameter; change return
11486         type.
11487         * output.h (class Output_section): Declare
11488         find_starting_output_address instead of starting_output_address.
11489         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11490         section symbol for which we can't find a merge section.
11491
11492         PR 9836
11493         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11494         hidden or internal, force the symbol to be local.
11495         * resolve.cc (Symbol::override_visibility): Define.
11496         (Symbol::override_base): Use override_visibility.
11497         (Symbol_table::resolve): Likewise.
11498         (Symbol::override_base_with_special): Likewise.
11499         (Symbol_table::override_with_special): If the visibility is hidden
11500         or internal, force the symbol to be local.
11501         * symtab.h (class Symbol): Add set_visibility and
11502         override_visibility.
11503         * testsuite/ver_test_1.sh: New file.
11504         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11505         (check_DATA): Add ver_test_1.syms.
11506         (ver_test_1.syms): New target.
11507         * testsuite/Makefile.in: Rebuild.
11508
11509 2009-02-25  Cary Coutant  <ccoutant@google.com>
11510
11511         * layout.cc (Layout::choose_output_section): Don't rename sections
11512         when using a linker script that has a SECTIONS clause.
11513         * Makefile.in: Regenerate.
11514
11515         * testsuite/Makefile.am (script_test_5.sh): New test case.
11516         * testsuite/Makefile.in: Regenerate.
11517         * testsuite/script_test_5.cc: New file.
11518         * testsuite/script_test_5.sh: New file.
11519         * testsuite/script_test_5.t: New file.
11520
11521 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11522
11523         * archive.cc (Archive::include_member): Update calls to add_symbols.
11524         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11525         the Layout argument.
11526         * dynobj.h (do_add_symbols): Add the Layout argument.
11527         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11528         Layout argument.
11529         * object.h (Object::add_symbols): Add the Layout argument.
11530         (Object::do_add_symbols): Add the Layout argument.
11531         (Sized_relobj::do_add_symbols): Add the Layout argument.
11532         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11533         Unify the two versions.
11534         (Add_plugin_symbols): Remove.
11535         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11536         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11537         (Add_plugin_symbols): Remove.
11538         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11539         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11540         (Add_symbols::run): Make it work with Pulginobj.
11541
11542 2009-02-06  Ian Lance Taylor  <iant@google.com>
11543
11544         * object.cc (Sized_relobj::do_layout): Make info message start
11545         with lower case letter.
11546
11547 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11548
11549         * binary.cc: Fix file comment.
11550
11551         * options.h (enum Incremental_disposition): Define.
11552         (class General_options): Add new options: --incremental,
11553         --incremental_changed, --incremental_unchanged,
11554         --incremental_unknown.  Add incremental_disposition_ and
11555         implicit_incremental_ fields.
11556         (General_options::incremental_disposition): New function.
11557         (class Position_dependent_options): Add incremental_disposition
11558         option.
11559         (Position_dependent_options::copy_from_options): Set incremental
11560         dispositions.
11561         * options.cc (General_options::parse_incremental_changed): New
11562         function.
11563         (General_options::parse_incremental_unchanged): New function.
11564         (General_options::parse_incremental_unknown): New function.
11565         (General_options::General_options): Initialize new fields
11566         incremental_disposition_ and implicit_incremental_.
11567         (General_options::finalize): Check for uasge of --incremental-*
11568         without --incremental.
11569
11570 2009-02-06  Chris Demetriou  <cgd@google.com>
11571
11572         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11573         pointer and to report location as the file name associated with
11574         the symbol.
11575         (gold_undefined_symbol_at_location): New function to replace the
11576         old gold_undefined_symbol functionality.
11577         * target-reloc.h (relocate_section): Update to use
11578         gold_undefined_symbol_at_location.
11579         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11580         Call gold_undefined_symbol function rather than gold_error.
11581         * errors.h (Errors::undefined_symbol): Take location as a
11582         string, rather than calculating it from a relocation.
11583         * errors.cc (Errors::fatal): Print "fatal error:" before the
11584         formatted message.
11585         (Errors::error, Errors::error_at_location): Print "error: "
11586         before the formatted message.
11587         (Errors::undefined_symbol): Take location as a string, rather
11588         than calculating it from a relocation.
11589         (gold_undefined_symbol_at_location): New function akin to
11590         old gold_undefined_symbol, calculates location from relocation.
11591         (gold_undefined_symbol): Change to take only a Symbol pointer
11592         and to report location as the file name associated with the symbol.
11593         * testsuite/debug_msg.sh: Update for changed error messages.
11594         * testsuite/undef_symbol.sh: Likewise.
11595
11596 2009-02-04  Duncan Sands  <baldrick@free.fr>
11597
11598         PR 9812
11599         * reduced_debug_output.h
11600         (Output_reduced_debug_abbrev_section::failed): Use format for
11601         gold_warning.
11602         (Output_reduced_debug_info_section::faild): Likewise.
11603
11604 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11605
11606         * script.cc (Lazy_demangler): New class.
11607         (Version_script_info::get_symbol_version_helper): Demangle a
11608         symbol only once.
11609
11610 2009-01-29  Cary Coutant  <ccoutant@google.com>
11611
11612         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11613         to __tls_get_addr.
11614         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11615
11616 2009-01-28  Ian Lance Taylor  <iant@google.com>
11617
11618         * version.cc (version_string): Bump to 1.9.
11619
11620         * gold.h: Include <cstring> and <stdint.h>.
11621         * version.cc: Include <cstdio>.
11622         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11623         warning.
11624         * reduced_debug_output.cc (insert_into_vector): Rename from
11625         Insert_into_vector; change all callers.  Use Swap_unaligned to
11626         avoid aliasing issue; remove union since it is unnecessary.
11627
11628 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11629
11630         * Makefile.am (CCFILES): Add gc.cc.
11631         (HFILES): Add gc.h.
11632         * Makefile.in: Regenerate.
11633         * gold.cc (Gc_runner): New class.
11634         (queue_initial_tasks): Call garbage collection related tasks
11635         when corresponding options are invoked.
11636         (queue_middle_gc_tasks): New function.
11637         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11638         processed early before laying out sections during garbage collection.
11639         * gold.h (queue_middle_gc_tasks): New function.
11640         (is_prefix_of): Move from "layout.cc".
11641         * i386.cc (Target_i386::gc_process_relocs): New function.
11642         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11643         * main.cc (main): Create object of class "Garbage_collection".
11644         * object.cc (Relobj::copy_symbols_data): New function.
11645         (Relobj::is_section_name_included): New function.
11646         (Sized_relobj::do_layout): Allow this function to be called twice
11647         during garbage collection and defer layout of section during the
11648         first call.
11649         * object.h (Relobj::get_symbols_data): New function.
11650         (Relobj::is_section_name_included): New function.
11651         (Relobj::copy_symbols_data): New function.
11652         (Relobj::set_symbols_data): New function.
11653         (Relobj::get_relocs_data): New function.
11654         (Relobj::set_relocs_data): New function.
11655         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11656         (Relobj::gc_process_relocs): New function.
11657         (Relobj::do_gc_process_relocs): New pure virtual function.
11658         (Relobj::sd_): New data member.
11659         (Sized_relobj::is_output_section_offset_invalid): New function.
11660         (Sized_relobj::do_gc_process_relocs): New function.
11661         * options.h (General_options::gc_sections): Modify to not be a no-op.
11662         (General_options::print_gc_sections): New option.
11663         * plugin.cc (Plugin_finish::run): Remove function call to
11664         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11665         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11666         * reloc.cc (Read_relocs::run): Add task to process relocs and
11667         determine unreferenced sections when doing garbage collection.
11668         (Gc_process_relocs): New class.
11669         (Sized_relobj::do_gc_process_relocs): New function.
11670         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11671         sections that are garbage collected.
11672         * reloc.h (Gc_process_relocs): New class.
11673         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11674         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11675         symbols whose corresponding sections are garbage collected.
11676         (Symbol_table::Symbol_table): Add new parameter for the garbage
11677         collection object.
11678         (Symbol_table::gc_mark_undef_symbols): New function.
11679         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11680         (Symbol_table::gc_mark_dyn_syms): New function.
11681         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11682         as garbage.
11683         (Symbol_table::add_from_object): Likewise.
11684         (Symbol_table::add_from_relobj): When building shared objects, do not
11685         treat externally visible symbols as garbage.
11686         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11687         table information for static and relocatable links.
11688         * symtab.h (Symbol_table::set_gc): New function.
11689         (Symbol_table::gc): New function.
11690         (Symbol_table::gc_mark_undef_symbols): New function.
11691         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11692         (Symbol_table::gc_mark_dyn_syms): New function.
11693         (Symbol_table::gc_): New data member.
11694         * target.h (Sized_target::gc_process_relocs): New pure virtual
11695         function.
11696         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11697         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11698
11699 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11700
11701         * options.h (General_options::gc_sections): Define as a no-op for now.
11702         (General_options::no_keep_memory): Ditto.
11703         (General_options::Bshareable): Define.
11704         * options.cc (General_options::finalize): Honor -Bshareable.
11705
11706 2009-01-20  Andreas Schwab  <schwab@suse.de>
11707
11708         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11709         read the value in the contents, since we don't use it.  Use the
11710         template endianness when writing.
11711         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11712
11713 2009-01-19  Andreas Schwab  <schwab@suse.de>
11714
11715         * configure.tgt (powerpc64-*): Fix targ_obj.
11716
11717 2009-01-15  Ian Lance Taylor  <iant@google.com>
11718
11719         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11720         local symbols when stripping all symbols.
11721
11722 2009-01-14  Cary Coutant  <ccoutant@google.com>
11723
11724         * output.cc (Output_reloc): Add explicit instantiations.
11725
11726 2009-01-14  Cary Coutant  <ccoutant@google.com>
11727
11728         * archive.cc (Archive::get_elf_object_for_member): Remove call
11729         to File_read::claim_for_plugin.
11730         * descriptors.cc (Descriptors::open): Remove reference to
11731         is_claimed.
11732         (Descriptors::claim_for_plugin): Remove.
11733         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11734         (Descriptors::is_claimed): Remove.
11735         (claim_descriptor_for_plugin): Remove.
11736         * fileread.cc (File_read::claim_for_plugin): Remove.
11737         * fileread.h (File_read::claim_for_plugin): Remove.
11738         (File_read::descriptor): Reopen descriptor if necessary.
11739         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11740         (Plugin_manager::all_symbols_read): Add task parameter. Change
11741         all callers.
11742         (Plugin_manager::get_input_file): New function.
11743         (Plugin_manager::release_input_file): New function.
11744         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11745         corresponding data member.
11746         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11747         and pass to base constructor. Change all callers.
11748         (get_input_file, release_input_file): New functions.
11749         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11750         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11751         (Plugin_manager::all_symbols_read): Add task parameter.
11752         (Plugin_manager::get_input_file): New function.
11753         (Plugin_manager::release_input_file): New function.
11754         (Plugin_manager::task_): New data member.
11755         (Pluginobj::Pluginobj): Add filesize parameter.
11756         (Pluginobj::filename): New function.
11757         (Pluginobj::descriptor): New function.
11758         (Pluginobj::filesize): New function.
11759         (Pluginobj::filesize_): New data member.
11760         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11761         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11762         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11763
11764         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11765         with archive libraries.
11766         * testsuite/Makefile.in: Regenerate.
11767         * testsuite/plugin_test.c (struct sym_info): New type.
11768         (get_input_file, release_input_file): New static variables.
11769         (onload): Capture new transfer vector entries.
11770         (claim_file_hook): Stop reading at end of file according to filesize.
11771         Factor out parsing of readelf output into separate function.
11772         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11773         APIs and get the source file name from the symbol table.  Convert
11774         source file name to corresponding object file name.  Print info
11775         message when adding new input files.
11776         (parse_readelf_line): New function.
11777         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11778         * testsuite/plugin_test_2.sh: Likewise.
11779         * testsuite/plugin_test_3.sh: Likewise.
11780         * testsuite/plugin_test_4.sh: New test case.
11781
11782 2009-01-07  Ian Lance Taylor  <iant@google.com>
11783
11784         * version.cc (version_string): Bump to 1.8.
11785
11786 2008-12-23  Cary Coutant  <ccoutant@google.com>
11787
11788         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11789         * plugin.cc (Plugin_manager::finish): Rename as
11790         layout_deferred_objects.  Move cleanup to separate function.
11791         (Plugin_manager::cleanup): New function.
11792         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11793         separately.
11794         * plugin.h (Plugin_manager::finish): Rename as
11795         layout_deferred_objects.
11796         (Plugin_manager::cleanup): New function.
11797         (Plugin_manager::cleanup_done): New field.
11798
11799 2008-12-23  Cary Coutant  <ccoutant@google.com>
11800
11801         * plugin.cc (is_visible_from_outside): New function.
11802         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11803         so we don't return "IR only" status for exported symbols or -r links.
11804
11805         * testsuite/Makefile.am (plugin_test_3): New test case.
11806         * testsuite/Makefile.in: Regenerate.
11807         * testsuite/plugin_test_3.sh: New file.
11808
11809 2008-12-22  Cary Coutant  <ccoutant@google.com>
11810
11811         * object.cc (Sized_relobj::layout_section): New function.
11812         (Sized_relobj::do_layout): Defer layout of input sections until after
11813         plugin has provided replacement files.
11814         (Sized_relobj::do_layout_deferred_sections): New function.
11815         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11816         (Relobj::layout_deferred_sections): New function.
11817         (Relobj::do_layout_deferred_sections): New function.
11818         (Sized_relobj::do_layout_deferred_sections): New function.
11819         (Sized_relobj::layout_section): New function.
11820         (Sized_relobj::Deferred_layout): New structure.
11821         (Sized_relobj::deferred_layout_): New field.
11822         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11823         Change all callers.  Layout deferred sections.
11824         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11825         references.
11826         (Plugin_hook::run): Move code from do_plugin_hook inline.
11827         (Plugin_hook::do_plugin_hook): Remove.
11828         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11829         (Plugin_manager::finish): Renamed, was cleanup.
11830         (Plugin_manager::should_defer_layout): New function.
11831         (Plugin_manager::add_deferred_layout_object): New function.
11832         (Plugin_manager::Deferred_layout_list): New type.
11833         (Plugin_manager::deferred_layout_objects_): New field.
11834         (Plugin_hook::do_plugin_hook): Remove.
11835
11836 2008-12-17  Ian Lance Taylor  <iant@google.com>
11837
11838         * options.h (class General_options): Add --no case for
11839         --export-dynamic.
11840
11841 2008-12-16  Cary Coutant  <ccoutant@google.com>
11842
11843         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11844         vector.
11845         (Plugin_manager::claim_file): Create plugin object even if
11846         plugin did not call the add_symbols callback.
11847         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11848         asking for more symbols than were added.
11849         * testsuite/Makefile.am (plugin_test_1): Add test case with
11850         no global symbols.
11851         (empty.syms): New target.
11852         * testsuite/Makefile.in: Regenerate.
11853         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11854         message. Don't call add_symbols if no globals.
11855         (all_symbols_read_hook): Don't provide replacement for empty
11856         claimed file.
11857
11858 2008-12-12  Ian Lance Taylor  <iant@google.com>
11859
11860         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11861         r_type == 0 for a local symbol with r_sym == 0.
11862         (scan_relocatable_relocs): Pass r_sym to
11863         local_non_section_strategy.
11864         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11865         r_sym parameter.
11866
11867         * configure.ac: Update test for TLS descriptors: they are
11868         supported as of glibc 2.9.
11869         * configure: Rebuild.
11870
11871 2008-12-11  Ian Lance Taylor  <iant@google.com>
11872
11873         PR 7091
11874         * target-reloc.h (Default_scan_relocatable_relocs): For each
11875         function, map r_type == 0 to RELOC_DISCARD.
11876
11877 2008-12-10  Cary Coutant  <ccoutant@google.com>
11878
11879         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11880         object to override a kept COMDAT group from a plugin object.
11881
11882 2008-12-09  Ian Lance Taylor  <iant@google.com>
11883
11884         PR 7088
11885         * yyscript.y (file_cmd): Handle INPUT.
11886
11887         * testsuite/initpri1.c: Change all declarations to be full
11888         prototypes by adding void, to avoid compiler warnings.
11889
11890 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11891
11892         * options.cc (General_options::parse_plugin_opt): New.
11893         (General_options::add_plugin): The argument now is just the filename.
11894         (General_options::add_plugin_option): New.
11895         * options.h (plugin_opt): New.
11896         (add_plugin): Change argument name.
11897         (add_plugin_option): New.
11898         * plugin.cc (Plugin::load): Don't parse the plugin option.
11899         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11900         (Plugin::add_option): New.
11901         (Plugin::args_): Change type.
11902         (Plugin::filename_): New.
11903         (Plugin_manager::add_plugin_option): New.
11904         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11905         * testsuite/Makefile.in: Regenerate.
11906
11907 2008-12-05  Cary Coutant  <ccoutant@google.com>
11908
11909         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11910         Handle --strip-lto-sections option.
11911         * options.h (strip_lto_sections): New option.
11912
11913 2008-12-01  Cary Coutant  <ccoutant@google.com>
11914
11915         * plugin.cc (ld_plugin_message): Change format parameter to const.
11916         Fix mismatch between new[] and delete.
11917
11918 2008-11-14  Cary Coutant  <ccoutant@google.com>
11919
11920         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11921         instead of -1U.
11922
11923 2008-11-05  Craig Silverstein  <csilvers@google.com>
11924
11925         * options.cc (General_options::parse_dynamic_list): New function.
11926         * options.h (General_options): New flags dynamic_list,
11927         dynamic_list_data, dynamic_list_cpp_new, and
11928         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11929         (General_options::in_dynamic_list): New function.
11930         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11931         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11932         (Lex::can_continue_name): Likewise.
11933         (yylex): Likewise.
11934         (read_script_file): New parameter script_options.
11935         (read_dynamic_list): New function.
11936         (Script_options::define_dynamic_list): New function.
11937         (dynamic_list_keyword_parsecodes): New variable.
11938         (dynamic_list_keywords): New variable.
11939         * script.h (Script_options::define_dynamic_list): New function
11940         prototype.
11941         (read_dynamic_list): New function prototype.
11942         * symtab.cc (strprefix): New macro.
11943         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11944         dynamic_list_data, dynamic_list_cpp_new, and
11945         dynamic_list_cpp_typeinfo.
11946         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11947         (dynamic_list_expr): New rule.
11948         (dynamic_list_nodes): Likewise.
11949         (dynamic_list_node): Likewise.
11950         * testsuite/Makefile.am (dynamic_list): New test.
11951         * testsuite/Makefile.in: Regenerated.
11952         * testsuite/dynamic_list.t: New file.
11953         * testsuite/dynamic_list.sh: New file.
11954
11955 2008-11-05  Craig Silverstein  <csilvers@google.com>
11956
11957         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11958         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11959         (t11_last): Likewise.
11960         * testsuite/ver_test_6.c (main): Likewise.
11961
11962 2008-10-07  Cary Coutant  <ccoutant@google.com>
11963
11964         * options.c (General_options::finalize): Add check for -static and
11965         -shared.
11966         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11967         is not empty.
11968
11969 2008-10-02  Cary Coutant  <ccoutant@google.com>
11970
11971         * plugin.cc (make_sized_plugin_object): Fix conditional
11972         compilation to work when not all targets are enabled.
11973
11974 2008-09-29  Cary Coutant  <ccoutant@google.com>
11975
11976         * archive.cc (Archive::get_file_and_offset): Use filename instead
11977         of name to get library path.
11978         (Archive::include_member): Unlock external member of a thin archive.
11979
11980         * testsuite/Makefile.am (TEST_AR): New variable.
11981         (thin_archive_test_1): New test.
11982         (thin_archive_test_2): New test.
11983         * testsuite/Makefile.in: Regenerate.
11984         * testsuite/thin_archive_main.cc: New file.
11985         * testsuite/thin_archive_test_1.cc: New file.
11986         * testsuite/thin_archive_test_2.cc: New file.
11987         * testsuite/thin_archive_test_3.cc: New file.
11988         * testsuite/thin_archive_test_4.cc: New file.
11989
11990 2008-09-29  Cary Coutant  <ccoutant@google.com>
11991
11992         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11993         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11994         instead of -1U.
11995         (Sized_relobj::do_finalize_local_symbols): Likewise.
11996         (Sized_relobj::map_to_kept_section): Likewise.
11997         * object.h (Sized_relobj::invalid_address): New constant.
11998         (Sized_relobj::do_output_section_offset): Check for invalid_address
11999         and return -1ULL.
12000         * output.cc (Output_reloc::local_section_offset): Use constant
12001         invalid_address instead of -1U.
12002         (Output_reloc::get_address): Likewise.
12003         (Output_section::output_address): Change -1U to -1ULL.
12004         * output.h (Output_reloc::invalid_address): New constant.
12005         * reloc.cc (Sized_relobj::write_sections): Use constant
12006         invalid_address instead of -1U.
12007         (Sized_relobj::relocate_sections): Likewise.
12008         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12009         values for merge sections.
12010         * target-reloc.h (relocate_for_relocatable): Use constant
12011         invalid_address instead of -1U.
12012
12013 2008-09-19  Cary Coutant  <ccoutant@google.com>
12014
12015         Add plugin functionality for link-time optimization (LTO).
12016         * configure.ac (plugins): Add --enable-plugins option.
12017         * configure: Regenerate.
12018         * config.in: Regenerate.
12019         * Makefile.am (LIBDL): New variable.
12020         (CCFILES): Add plugin.cc.
12021         (HFILES): Add plugin.h.
12022         (ldadd_var): Add LIBDL.
12023         * Makefile.in: Regenerate.
12024
12025         * archive.cc: Include "plugin.h".
12026         (Archive::setup): Don't preread archive symbols when using a plugin.
12027         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12028         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12029         files.
12030         (Archive::include_member): Add symbols from plugin objects.
12031         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12032         * descriptors.cc (Descriptors::open): Check for file descriptors
12033         abandoned by plugins.
12034         (Descriptors::claim_for_plugin): New function.
12035         * descriptors.h (Descriptors::claim_for_plugin): New function.
12036         (Open_descriptor::is_claimed): New field.
12037         (claim_descriptor_for_plugin): New function.
12038         * fileread.cc (File_read::claim_for_plugin): New function.
12039         * fileread.h (File_read::claim_for_plugin): New function.
12040         (File_read::descriptor): New function.
12041         * gold.cc: Include "plugin.h".
12042         (queue_initial_tasks): Add task to call plugin hooks for generating
12043         new object files.
12044         * main.cc: Include "plugin.h".
12045         (main): Load plugin libraries.
12046         * object.h (Pluginobj): Declare.
12047         (Object::pluginobj): New function.
12048         (Object::do_pluginobj): New function.
12049         (Object::set_target): New function.
12050         * options.cc: Include "plugin.h".
12051         (General_options::parse_plugin): New function.
12052         (General_options::General_options): Initialize plugins_ field.
12053         (General_options::add_plugin): New function.
12054         * options.h (Plugin_manager): Declare.
12055         (General_options): Add --plugin option.
12056         (General_options::has_plugins): New function.
12057         (General_options::plugins): New function.
12058         (General_options::add_plugin): New function.
12059         (General_options::plugins_): New field.
12060         * plugin.cc: New file.
12061         * plugin.h: New file.
12062         * readsyms.cc: Include "plugin.h".
12063         (Read_symbols::do_read_symbols): Check for archive before checking
12064         for ELF file.  Call plugin hooks to claim files.
12065         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12066         from a real object file; force override when processing replacement
12067         files.
12068         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12069         (Symbol::init_base_object): Likewise.
12070         (Symbol::init_base_output_data): Likewise.
12071         (Symbol::init_base_output_segment): Likewise.
12072         (Symbol::init_base_constant): Likewise.
12073         (Symbol::init_base_undefined): Likewise.
12074         (Symbol::output_section): Assert that object is not a plugin.
12075         (Symbol_table::add_from_pluginobj): New function.
12076         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12077         undefined.
12078         (Symbol_table::sized_write_globals): Likewise.
12079         (Symbol_table::add_from_pluginobj): Instantiate template.
12080         * symtab.h (Sized_pluginobj): Declare.
12081         (Symbol::in_real_elf): New function.
12082         (Symbol::set_in_real_elf): New function.
12083         (Symbol::in_real_elf_): New field.
12084         (Symbol_table::add_from_pluginobj): New function.
12085
12086         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12087         (LIBDL): New variable.
12088         (LDADD): Add LIBDL.
12089         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12090         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12091         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12092         (MOSTLYCLEANFILES): Likewise.
12093         * testsuite/Makefile.in: Regenerate.
12094         * testsuite/plugin_test.c: New file.
12095         * testsuite/plugin_test_1.sh: New file.
12096         * testsuite/plugin_test_2.sh: New file.
12097
12098 2008-09-16  Ian Lance Taylor  <iant@google.com>
12099
12100         * target-reloc.h (relocate_section): Check whether a symbol is
12101         defined by the ABI before reporting an undefined symbol error.
12102         * target.h (Target::is_defined_by_abi): Make parameter const.
12103         (Target::do_is_defined_by_abi): Likewise.
12104         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12105         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12106         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12107         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12108         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12109         * testsuite/Makefile.in: Rebuild.
12110
12111         * fileread.cc (make_view): Add casts to avoid warning.
12112
12113 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12114
12115         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12116         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12117
12118 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12119
12120         * options.h (General_options::output_is_executable): New.
12121         (General_options::output_is_pie): New.
12122         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12123         for shared libraries.
12124         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12125
12126 2008-09-11  Chris Demetriou  <cgd@google.com>
12127
12128         * options.h (origin): New -z option.
12129         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12130         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12131         in DT_FLAGS_1.
12132
12133 2008-09-05  Cary Coutant  <ccoutant@google.com>
12134
12135         * fileread.cc (File_read::make_view): Add check for attempt to map
12136         beyond end of file.
12137
12138 2008-09-05  Cary Coutant  <ccoutant@google.com>
12139
12140         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12141         explicit instantiations.
12142
12143 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12144
12145         PR gold/6858
12146         * options.cc (General_options::finalize): Allow undefined symbols
12147         in shlibs if linking -shared.
12148
12149         PR gold/6859
12150         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12151         symbols as not needing a dynsym entry.
12152
12153 2008-08-20  Craig Silverstein  <csilvers@google.com>
12154
12155         * fileread.cc (File_read::open): Do not lock the file unless it
12156         was successfully opened.
12157
12158 2008-08-14  Cary Coutant  <ccoutant@google.com>
12159
12160         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12161         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12162         * testsuite/tls_test.cc (struct int128): 128-bit struct
12163         for testing TLS relocs with non-zero addend.
12164         (v12): New TLS variable.
12165         (t12): New test.
12166         (t_last): Add check for v12.
12167         * testsuite/tls_test.h (t12): New function.
12168         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12169
12170 2008-08-13  Ian Lance Taylor  <iant@google.com>
12171
12172         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12173         set tls_segment_ or relro_segment_.
12174         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12175         when appropriate.
12176         * output.h (Output_section::clear_is_relro): New function.
12177         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12178         sections specially even when output_data_ is empty.
12179         (Output_segment::maximum_alignment): When first section is relro,
12180         only force alignment for PT_LOAD segments.
12181         * script.cc (script_data_segment_align): New function.
12182         (script_data_segment_relro_end): New function.
12183         * script-c.h (script_data_segment_align): Declare.
12184         (script_data_segment_relro_end): Declare.
12185         * script-sections.h (class Script_sections): Declare
12186         data_segment_align and data_segment_relro_end.  Add fields
12187         segment_align_index_ and saw_relro_end_.
12188         * script-sections.cc (class Sections_element): Add set_is_relro
12189         virtual function.  Add new bool* parameter to place_orphan_here.
12190         Add get_output_section virtual function.
12191         (class Output_section_definition): Add set_is_relro.  Add new
12192         bool* parameter to place_orphan_here.  Add get_output_section.
12193         Add is_relro_ field.
12194         (Output_section_definition::Output_section_definition): Initialize
12195         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12196         and is_relro_ fields.
12197         (Output_section_definition::place_orphan_here): Add is_relro
12198         parameter.
12199         (Output_section_definition::set_section_addresses): Set relro for
12200         output section.
12201         (Output_section_definition::alternate_constraint): Likewise.
12202         (class Orphan_output_section): Add new bool* parameter to
12203         place_orphan_here.  Add get_output_section.
12204         (Orphan_output_section::place_orphan_here): Add is_relro
12205         parameter.
12206         (Script_sections::Script_sections): Initialize
12207         data_segment_align_index_ and saw_relro_end_.
12208         (Script_sections::data_segment_align): New function.
12209         (Script_sections::data_segment_relro_end): New function.
12210         (Script_sections::place_orphan): Set or clear is_relro.
12211         (Script_sections::set_section_addresses): Force alignment of first
12212         TLS section.
12213         * yyscript.y (exp): Call script_data_segment_align and
12214         script_data_segment_relro_end.
12215         * testsuite/relro_script_test.t: New file.
12216         * testsuite/relro_test.cc (using_script): Declare.
12217         (t1, t2): Test using_script.
12218         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12219         (relro_script_test_SOURCES): Define.
12220         (relro_script_test_DEPENDENCIES): Define.
12221         (relro_script_test_LDFLAGS): Define.
12222         (relro_script_test_LDADD): Define.
12223         (relro_script_test.so): New target.
12224         * testsuite/Makefile.in: Rebuild.
12225
12226 2008-08-06  Cary Coutant <ccoutant@google.com>
12227
12228         * archive.cc (Archive::total_archives, Archive::total_members)
12229         (Archive::total_members_loaded): New variables.
12230         (Archive::setup): Add parameter.  Add option to preread
12231         archive symbols.
12232         (Archive::read_armap): Add counter.
12233         (Archive::get_file_and_offset): New function.
12234         (Archive::get_elf_object_for_member): New function.
12235         (Archive::read_all_symbols): New function.
12236         (Archive::read_symbols): New function.
12237         (Archive::add_symbols): Add counters.
12238         (Archive::include_all_members): Use armap to find members if it's
12239         already built.
12240         (Archive::include_member): Skip reading symbols if already read.
12241         Factored code into Archive::get_file_and_offset and
12242         Archive::get_elf_object_for_member.  Changed call to
12243         Mapfile::report_include_archive_member.
12244         (Archive::print_stats): New function.
12245         * archive.h: Declare Object and Read_symbols_data classes.
12246         (Archive::Archive): Add initializers for new members.
12247         (Archive::setup): Add parameter.
12248         (Archive::print_stats): New function.
12249         (Archive::total_archives, Archive::total_members)
12250         (Archive::total_members_loaded): New variables.
12251         (Archive::get_file_and_offset): New function.
12252         (Archive::get_elf_object_for_member): New function.
12253         (Archive::read_all_symbols): New function.
12254         (Archive::read_symbols): New function.
12255         (Archive::Archive_member): New class.
12256         (Archive::members_): New member.
12257         (Archive::num_members_): New member.
12258         * main.cc: Include archive.h.
12259         (main): Call Archive::print_stats.
12260         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12261         archive parameter; member_name is now the fully-decorated name.
12262         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12263         * options.h: (General_options): Add --preread-archive-symbols option.
12264         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12265         Archive::setup.
12266
12267 2008-08-04  Ian Lance Taylor  <iant@google.com>
12268
12269         * symtab.h (Symbol::use_plt_offset): New function.
12270         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12271         * powerpc.cc (Relocate::relocate): Likewise.
12272         * sparc.cc (Relocate::relocate): Likewise.
12273         * x86_64.cc (Relocate::relocate): Likewise.
12274         * testsuite/weak_plt.sh: New test.
12275         * testsuite/weak_plt_main.cc: New test.
12276         * testsuite/weak_plt_shared.cc: New test.
12277         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12278         (check_PROGRAMS): Add weak_plt.
12279         (check_DATA): Add weak_plt_shared.so.
12280         (weak_plt_main_pic.o, weak_plt): New targets.
12281         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12282         * testsuite/Makefile.in: Rebuild.
12283
12284         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12285         gcctestdir/ld.
12286         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12287         * testsuite/Makefile.in: Rebuild.
12288
12289 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12290
12291         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12292         * Makefile.in: Regenerate.
12293         * po/POTFILES.in: Regenerate.
12294
12295 2008-07-29  Ian Lance Taylor  <iant@google.com>
12296
12297         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12298         symbols before other symbols.
12299         * testsuite/script_test_2.cc (test_addr): Declare.
12300         (test_addr_alias): Declare.
12301         (main): Check that test_addr and test_addr_alias have the right
12302         values.
12303         * testsuite/script_test_2.t: Define test_addr_alias and
12304         test_addr.
12305
12306 2008-07-24  Ian Lance Taylor  <iant@google.com>
12307
12308         PR 5990
12309         * descriptors.cc: New file.
12310         * descriptors.h: New file.
12311         * gold-threads.h (class Hold_optional_lock): New class.
12312         * fileread.cc: Include "descriptors.h".
12313         (File_read::~File_read): Release descriptor rather than closing
12314         it.
12315         (File_read::open) [file]: Call open_descriptor rather than open.
12316         Set is_descriptor_opened_.
12317         (File_read::open) [memory]: Assert that descriptor is not open.
12318         (File_read::reopen_descriptor): New function.
12319         (File_read::release): Release descriptor.
12320         (File_read::do_read): Make non-const.  Reopen descriptor.
12321         (File_read::read): Make non-const.
12322         (File_read::make_view): Reopen descriptor.
12323         (File_read::do_readv): Likewise.
12324         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12325         Update declarations.
12326         * layout.cc: Include "descriptors.h".
12327         (Layout::create_build_id): Use open_descriptor rather than open.
12328         * output.cc: Include "descriptors.h".
12329         (Output_file::open): Use open_descriptor rather than open.
12330         * archive.cc (Archive::const_iterator): Change Archive to be
12331         non-const.
12332         (Archive::begin, Archive::end): Make non-const.
12333         (Archive::count_members): Likewise.
12334         * archive.h (class Archive): Update declarations.
12335         * object.h (Object::read): Make non-const.
12336         * Makefile.am (CCFILES): Add descriptors.cc.
12337         (HFILES): Add descriptors.h.
12338         * Makefile.in: Rebuild.
12339
12340         PR 6716
12341         * gold.h: Always include <clocale>.  Add Solaris workarounds
12342         following code in binutils/sysdep.h.
12343
12344         PR 6048
12345         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12346         this->eh_frame_hdr_ is NULL before using it.
12347
12348         * dynobj.cc (Versions::Versions): Update comment.
12349
12350         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12351         the base version name.
12352
12353         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12354         array size plus one.
12355         (Stringpool_template::set_string_offsets): Subtract one from key
12356         before using it as an array index.
12357         (Stringpool_template::get_offset_with_length): Likewise.
12358         (Stringpool_template::write_to_buffer): Likewise.
12359         * stringpool.h (Stringpool_template::get_offset_from_key):
12360         Likewise.
12361
12362 2008-07-23  Ian Lance Taylor  <iant@google.com>
12363
12364         PR 6658
12365         * object.h (Merged_symbol_value::value): Do our best to handle a
12366         negative addend.
12367
12368         PR 6647
12369         * script.cc (Version_script_info::get_versions): Don't add empty
12370         version tag to return value.
12371         (Version_script_info::get_symbol_version_helper): Change return
12372         type to bool.  Add pversion parameter.  Change all callers.
12373         (script_register_vers_node): Don't require a non-NULL tag.
12374         * script.h (class Version_script_info): Update declarations.
12375         (Version_script_info::get_symbol_version): Change return type to
12376         bool.  Add version parameter.  Change all callers.
12377         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12378         handling.  Handle an empty version from a version script.
12379         (Symbol_table::define_special_symbol): Likewise.
12380         * testsuite/ver_test_10.script: New file.
12381         * testsuite/ver_test_10.sh: New file.
12382         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12383         (check_DATA): Add ver_test_10.syms.
12384         (ver_test_10.syms, ver_test_10.so): New target.
12385         * testsuite/Makefile.in: Rebuild.
12386
12387 2008-07-23  Simon Baldwin  <simonb@google.com>
12388
12389         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12390         to zero for undefined symbols from dynamic libraries.
12391
12392 2008-07-23  Ian Lance Taylor  <iant@google.com>
12393
12394         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12395         Change all callers.
12396         * symtab.h (class Symbol_table): Update declaration.
12397         * testsuite/ver_test_9.cc: New file.
12398         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12399         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12400         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12401         (ver_test_9.so, ver_test_9.o): New targets.
12402         * testsuite/Makefile.in: Rebuild.
12403
12404 2008-07-22  Ian Lance Taylor  <iant@google.com>
12405
12406         * options.h (class General_options): Define --check-sections.
12407         * layout.cc (Layout::set_segment_offsets): Handle
12408         --check-sections.
12409
12410         * options.h (class General_options): Define -n/--nmagic and
12411         -N/--omagic.
12412         * options.cc (General_options::finalize): For -n/--nmagic or
12413         -N/--omagic, set -static.
12414         * layout.cc (Layout::attach_allocated_section_to_segment): If
12415         -N/--omagic, don't put read-only and read-write sections in
12416         different segments.
12417         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12418         finding a read-only segment.
12419         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12420         don't set the minimum segment alignment to the common page size,
12421         and don't set the file offset to the address modulo the page size.
12422         * script-sections.cc (Script_sections::create_segments): If
12423         -n/--omagic, don't put read-only and read-write sections in
12424         different segments.
12425
12426         * cref.cc: New file.
12427         * cref.h: New file.
12428         * options.h (class General_options): Add --print-symbol-counts.
12429         * main.cc (main): Issue defined symbol report if requested.
12430         * archive.cc (Archive::interpret_header): Make into a const member
12431         function.
12432         (Archive::add_symbols): Call Input_objects::archive_start and
12433         archive_stop.
12434         (Archive::const_iterator): Define new class.
12435         (Archive::begin, Archive::end): New functions.
12436         (Archive::include_all_members): Rewrite to use iterator.
12437         (Archive::count_members): New function.
12438         * archive.h (class Archive): Update declarations.
12439         (Archive::filename): New function.
12440         * object.cc: Include "cref.h".
12441         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12442         (Sized_relobj::do_get_global_symbol_counts): New function.
12443         (Input_objects::add_object): Add object to cross-referencer.
12444         (Input_objects::archive_start): New function.
12445         (Input_objects::archive_stop): New function.
12446         (Input_objects::print_symbol_counts): New function.
12447         * object.h: Declare Cref and Archive.
12448         (Object::get_global_symbol_counts): New function.
12449         (Object::do_get_global_symbol_counts): New pure virtual function.
12450         (class Sized_relobj): Add defined_count_ field.  Update
12451         declarations.
12452         (class Input_objects): Add cref_ field.  Update constructor.
12453         Update declarations.
12454         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12455         defined_count_.
12456         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12457         symbol counts.
12458         (Sized_dynobj::do_get_global_symbol_counts): New function.
12459         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12460         defined_count_.  Update declarations.  Define Symbols typedef.
12461         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12462         parameter.  Change all callers.
12463         (Symbol_table::add_from_dynobj): Add sympointers and defined
12464         parameters.  Change all callers.
12465         * symtab.h (class Symbol_table): Update declarations.
12466         * Makefile.am (CCFILES): Add cref.cc.
12467         (HFILES): Add cref.h.
12468         * Makefile.in: Rebuild.
12469
12470 2008-07-22  Simon Baldwin  <simonb@google.com>
12471
12472         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12473         to zero when writing undefined symbols.
12474
12475 2008-07-22  Ian Lance Taylor  <iant@google.com>
12476
12477         * output.cc (Output_section::add_input_section): Don't try to
12478         merge empty merge sections.
12479
12480 2008-07-21  Craig Silverstein  <csilvers@google.com>
12481
12482         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12483         Include symbol version in error message.
12484
12485 2008-07-20  Chris Demetriou  <cgd@google.com>
12486
12487         * configure.ac (gold_cv_c_random_seed): New configured variable.
12488         (RANDOM_SEED_CFLAGS): New substituted variable.
12489         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12490         * configure: Rebuild.
12491         * Makefile.in: Likewise.
12492         * testsuite/Makefile.in: Likewise.
12493
12494 2008-07-18  Ian Lance Taylor  <iant@google.com>
12495
12496         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12497         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12498         * testsuite/ver_test_main.cc (main): Call t4.
12499         (t4, t4_2a): Define.
12500         * testsuite/ver_test_2.cc (t4_2): Define.
12501         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12502         * testsuite/ver_test_4.cc (t4_2a): Define.
12503         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12504         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12505
12506 2008-07-17  Ian Lance Taylor  <iant@google.com>
12507
12508         * dynobj.cc (Versions::add_def): If we give an error about a
12509         missing version, go ahead and create the version anyhow.
12510
12511 2008-07-10  Ian Lance Taylor  <iant@google.com>
12512
12513         Handle output sections with more than 0x7fffffff bytes.
12514         * object.h (class Relobj): Change map_to_output_ to
12515         output_sections_, and just keep a section pointer.  Change all
12516         uses.  Move comdat group support to Sized_relobj.
12517         (Relobj::is_section_specially_mapped): Remove.
12518         (Relobj::output_section): Remove poff parameter.  Change all
12519         callers.
12520         (Relobj::output_section_offset): New function.
12521         (Relobj::set_section_offset): Rewrite.
12522         (Relobj::map_to_output): Remove.
12523         (Relobj::output_sections): New function.
12524         (Relobj::do_output_section_offset): New pure virtual function.
12525         (Relobj::do_set_section_offset): Likewise.
12526         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12527         group support from Relobj.  Update declarations.
12528         (Sized_relobj::get_output_section_offset): New function.
12529         (Sized_relobj::do_output_section_offset): New function.
12530         (Sized_relobj::do_set_section_offset): New function.
12531         * object.cc (Relobj::output_section_address): Remove.
12532         (Sized_relobj::Sized_relobj): Initialize new fields.
12533         (Sized_relobj::include_section_group): Cast find_kept_object to
12534         Sized_relobj.
12535         (Sized_relobj::include_linkonce_section): Likewise.
12536         (Sized_relobj::do_layout): Use separate arrays for output section
12537         and output offset.
12538         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12539         output_sections.
12540         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12541         output_sections and section_offsets.
12542         (Sized_relobj::write_local_symbols): Likewise.
12543         (map_to_kept_section): Compute output address directly.
12544         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12545         output_sections and section_offsets.
12546         (Sized_relobj::write_sections): Likewise.
12547         (Sized_relobj::relocate_sections): Likewise.
12548         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12549         * output.h (class Output_reloc): Update declarations.  Change
12550         u2_.relobj to Sized_relobj*.
12551         (class Output_data_reloc): Change add functions to use
12552         Sized_relobj*.
12553         * output.cc (Output_reloc::Output_reloc): Change relobj to
12554         Sized_relobj*.
12555         (Output_reloc::local_section_offset): Change return type to
12556         Elf_Addr.  Use get_output_section_offset.
12557         (Output_reloc::get_address): Likewise.
12558         (Output_section::is_input_address_mapped): Don't call
12559         is_section_specially_mapped.
12560         (Output_section::output_offset): Likewise.
12561         (Output_section::output_address): Likewise.
12562         (Output_section::starting_output_address): Likewise.
12563         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12564         parameter to Sized_relobj*.
12565         (Copy_relocs::need_copy_reloc): Likewise.
12566         (Copy_relocs::save): Likewise.
12567         * copy-relocs.h (class Copy_relocs): Update declarations.
12568         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12569         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12570         * target-reloc.h (relocate_for_relocatable): Change
12571         offset_in_output_section type to Elf_Addr.  Change code that uses
12572         it as well.
12573         * layout.cc (Layout::layout): Always set *off.
12574         * mapfile.cc (Mapfile::print_input_section): Use
12575         output_section_offset.
12576         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12577         Sized_relobj*.
12578         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12579         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12580         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12581
12582 2008-07-03  Ian Lance Taylor  <iant@google.com>
12583
12584         * layout.cc (Layout::include_section): Do not discard unrecognized
12585         SHT_STRTAB sections.
12586
12587 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12588
12589         * script.cc (Lex::can_continue_name): Make '?' allowable in
12590         version-script names.
12591         * testsuite/version_script.map: Change glob pattern to use '?'
12592
12593 2008-06-30  Manish Singh  <yosh@gimp.org>
12594
12595         PR 6585
12596         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12597         Correct typo.
12598
12599 2008-06-30  Ian Lance Taylor  <iant@google.com>
12600
12601         PR 6660
12602         PR 6682
12603         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12604         versions]: Don't try to read the value in the contents, since we
12605         don't use it.  Use the template endianness when writing.
12606
12607 2008-06-25  Cary Coutant  <ccoutant@google.com>
12608
12609         * fileread.cc (File_read::make_view): Assert on zero-length view.
12610         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12611         symbol table when there are no symbols to read.
12612
12613 2008-06-23  Craig Silverstein  <csilvers@google.com>
12614
12615         * version.cc (version_string): Bump to 1.7
12616
12617 2008-06-18  Craig Silverstein  <csilvers@google.com>
12618
12619         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12620         constant 0xFFFF to type Valtype.
12621         (Powerpc_relocate_functions::rel16_ha): Likewise.
12622
12623 2008-06-17  Ian Lance Taylor  <iant@google.com>
12624
12625         * output.h (Output_section::Input_section): Initialize p2align_ to
12626         zero for Output_section_data constructors.
12627         (Output_section::Input_section::addralign): If not an input
12628         section, return the alignment of the Output_section_data.
12629         * testsuite/copy_test.cc: New file.
12630         * testsuite/copy_test_1.cc: New file.
12631         * testsuite/copy_test_2.cc: New file.
12632         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12633         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12634         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12635         (copy_test_1_pic.o, copy_test_1.so): New targets.
12636         (copy_test_2_pic.o, copy_test_2.so): New targets.
12637         * testsuite/Makefile.in: Rebuild.
12638
12639         * script-sections.cc (Script_sections::place_orphan): Initialize
12640         local variable exact.
12641
12642 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12643
12644         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12645
12646 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12647             David S. Miller  <davem@davemloft.net>
12648
12649         * powerpc.cc: New file.
12650         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12651         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12652         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12653         * Makefile.in: Rebuild.
12654
12655 2008-06-09  Ian Lance Taylor  <iant@google.com>
12656
12657         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12658         <exception>.
12659         (throwing, orig_terminate): New static variables.
12660         (terminate_handler): New static function.
12661         (t2): Set terminate handler.
12662
12663 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12664
12665         PR 6584
12666         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12667         alignment.
12668
12669 2008-05-30  Cary Coutant  <ccoutant@google.com>
12670
12671         * archive.cc (Archive::include_all_members) Correct to step
12672         over symbol table and extended name table in thin archives.
12673
12674 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12675
12676         PR 6407
12677         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12678         calculation.
12679
12680 2008-05-28  Caleb Howe  <cshowe@google.com>
12681
12682         * reduced_debug_output.cc: New file.
12683         * reduced_debug_output.h: New file.
12684         * options.h (class General_options): Add --strip-debug-non-line.
12685         * options.cc (General_options::finalize): Add strip_debug_non_line
12686         to the strip heirarchy.
12687         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12688         fields.
12689         * layout.cc: Include "reduced_debug_output.h".
12690         (Layout::Layout): Initialize new fields.
12691         (line_only_debug_sections): New static array.
12692         (is_lines_only_debug_sections): New static inline function.
12693         (Layout::include_section): Handle --strip-debug-non-line.
12694         (Layout::make_output_section): If --strip-debug-non-line, build
12695         new output sections for .debug_abbrev and .debug_info.
12696         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12697         gold.  Warn about possible overflow.
12698         (read_signed_LEB_128): Likewise.
12699         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12700         (read_signed_LEB_128): Declare.
12701         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12702         (HFILES): Add reduced_debug_output.h.
12703         * Makefile.in: Rebuild.
12704
12705 2008-05-21  Ian Lance Taylor  <iant@google.com>
12706
12707         * mapfile.cc: New file.
12708         * mapfile.h: New file.
12709         * options.h (class General_options): Add -M/--print-map and -Map.
12710         * options.cc (General_options::finalize): Make -M equivalent to
12711         -Map -.
12712         * main.cc: Include <cstdio> and "mapfile.h".
12713         (main): Open mapfile if requested.
12714         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12715         constructor.  Change caller.
12716         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12717         (queue_middle_tasks): Likewise.
12718         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12719         declarations.
12720         * archive.cc: Include "mapfile.h".
12721         (Archive::add_symbols): Add mapfile parameter.  Change all
12722         callers.  Pass mapfile, symbol, and reason to include_member.
12723         (Archive::include_all_members): Add mapfile parameter.  Change all
12724         callers.
12725         (Archive::include_member): Add mapfile, sym, and why parameters.
12726         Change all callers.  Report inclusion to map file.
12727         * archive.h: Include "fileread.h".
12728         (class Archive): Update declarations.
12729         (Archive::file): New const method.
12730         (class Add_archive_symbols): Add mapfile_ field.  Update
12731         constructor.  Change all callers.
12732         * readsyms.h (class Read_symbols): Likewise.
12733         (class Finish_group): Likewise.
12734         (class Read_script): Likewise.
12735         * common.cc: Include "mapfile.h".
12736         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12737         all callers.
12738         (Symbol_table::do_allocate_commons): Likewise.
12739         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12740         symbol allocation to mapfile.
12741         * common.h (class Allocate_commons_task): Add mapfile_ field.
12742         Update constructor.  Change all callers.
12743         * symtab.h (class Symbol_table): Update declarations.
12744         * layout.cc: Include "mapfile.h".
12745         (Layout_task_runner::run): Print information to mapfile.
12746         (Layout::create_gold_note): Change Output_data_fixed_space to
12747         Output_data_zero_fill.
12748         (Layout::create_build_id): Likewise.
12749         (Layout::print_to_mapfile): New function.
12750         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12751         constructor.  Change caller.
12752         (class Layout): Declare print_to_mapfile.
12753         * output.cc (Output_section::Input_section::print_to_mapfile): New
12754         function.
12755         (Output_section::add_input_section): If producing a map, always
12756         add to input_sections_ list.
12757         (Output_section::do_print_to_mapfile): New function.
12758         (Output_segment::print_sections_to_mapfile): New function.
12759         (Output_segment::print_section_list_to_mapfile): New function.
12760         * output.h: Include "mapfile.h".
12761         (Output_data::print_to_mapfile): New function.
12762         (Output_data::do_print_to_mapfile): New virtual function.
12763         (Output_segment_headers::do_print_to_mapfile): New function.
12764         (Output_file_header::do_print_to_mapfile): New function.
12765         (Output_data_const::do_print_to_mapfile): New function.
12766         (class Output_data_const_buffer): Add map_name_ field.  Update
12767         constructor.  Change all callers.  Add do_print_to_mapfile
12768         function.
12769         (class Output_data_fixed_space): Likewise.
12770         (class Output_data_space): Likewise.
12771         (class Output_data_zero_fill): New class.
12772         (Output_data_strtab::do_print_to_mapfile): New function.
12773         (Output_data_reloc_base::do_print_to_mapfile): New function.
12774         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12775         (Output_data_group::do_print_to_mapfile): New function.
12776         (Output_data_got::do_print_to_mapfile): New function.
12777         (Output_data_dynamic::do_print_to_mapfile): New function.
12778         (Output_symtab_xindex::do_print_to_mapfile): New function.
12779         (class Output_section): Declare do_print_to_mapflie.  Declare
12780         print_to_mapfile in Input_section.
12781         (class Output_segment): Declare new functions.
12782         * object.h (Sized_relobj::symbol_count): New function.
12783         * script-sections.cc
12784         (Output_section_element_dot_assignment::set_section_addresses):
12785         Change Output_data_fixed_space to Output_data_zero_fill.
12786         (Output_data_expression::do_print_to_mapfile): New function.
12787         * script.cc (read_input_script): Add mapfile parameter.  Change
12788         all callers.
12789         * script.h (read_input_script): Update declaration.
12790         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12791         (Eh_frame::do_print_to_mapfile): New function.
12792         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12793         (Output_merge_string::do_print_to_mapfile): New function.
12794         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12795         function.
12796         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12797         function.
12798         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12799         function.
12800         * Makefile.am (CCFILES): Add mapfile.cc.
12801         (HFILES): Add mapfile.h.
12802         * Makefile.in: Rebuild.
12803
12804 2008-05-19  Ian Lance Taylor  <iant@google.com>
12805
12806         * options.h (class General_options): Add -z relro.
12807         * layout.cc (Layout::Layout): Initialize relro_segment_.
12808         (Layout::add_output_section_data): Return the output section.
12809         (Layout::make_output_section): Rcognize relro sections and mark
12810         them appropriately.
12811         (Layout::attach_allocated_section_to_segment): Put relro sections
12812         in a PT_GNU_RELRO segment.
12813         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12814         section as relro.
12815         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12816         PT_TLS segments.
12817         (Layout::linkonce_mapping): Map d.rel.ro.local to
12818         .data.rel.ro.local.
12819         (Layout::output_section_name): Us .data.rel.ro.local for any
12820         section which begins with that.
12821         * layout.h (class Layout): Update add_output_section_data
12822         declaration.  Add relro_segment_ field.
12823         * output.cc (Output_section::Output_section): Initialize is_relro_
12824         and is_relro_local_ fields.
12825         (Output_segment::add_output_section): Group relro sections.
12826         (Output_segment::is_first_section_relro): New function.
12827         (Output_segment::maximum_alignment): If there is a relro section,
12828         align the segment to the common page size.
12829         (Output_segment::set_section_addresses): Track whether we are
12830         looking at relro sections.  If the last section is a relro
12831         section, align to the common page size.
12832         (Output_segment::set_section_list_addresses): Add in_relro
12833         parameter.  Change all callers.  Align to the page size when
12834         moving from relro to non-relro section.
12835         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12836         segment.
12837         * output.h (class Output_section): Add is_relro_ and
12838         is_relro_local_ fields.
12839         (Output_section::is_relro): New function.
12840         (Output_section::set_is_relro): New function.
12841         (Output_section::is_relro_local): New function.
12842         (Output_section::set_is_relro_local): New function.
12843         (class Output_segment): Update declarations.
12844         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12845         * sparc.cc (Target_sparc::got_section): Likewise.
12846         * x86_64.cc (Target_x86_64::got_section): Likewise.
12847         * testsuite/relro_test_main.cc: New file.
12848         * testsuite/relro_test.cc: New file.
12849         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12850         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12851         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12852         (relro_test.so, relro_test_pic.o): New targets.
12853         * testsuite/Makefile.in: Rebuild.
12854
12855 2008-05-16  Ian Lance Taylor  <iant@google.com>
12856
12857         * output.cc (Output_segment::add_output_section): Remove front
12858         parameter.
12859         * output.h (class Output_segment): Remove
12860         add_initial_output_section and overloaded add_output_section.
12861         Update declaration of remaining add_output_section.
12862         * layout.cc (Layout::create_interp): Call add_output_section
12863         rather than add_initial_output_section.
12864         (Layout::finish_dynamic_section): Likewise.
12865
12866         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12867         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12868         know the dynamic type.
12869         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12870         field.  Initialize it in constructor.
12871         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12872         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12873         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12874         reloc.
12875
12876         * output.cc (Output_reloc::get_address): Change return type to
12877         Elf_Addr.
12878         * output.h (class Output_reloc): Update get_address declaration.
12879         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12880         for section addresses.
12881
12882 2008-05-09  Ian Lance Taylor  <iant@google.com>
12883
12884         PR 6493
12885         * gold.cc (gold_nomem): Use return value of write.
12886
12887 2008-05-08  Ian Lance Taylor  <iant@google.com>
12888
12889         * symtab.c (Symbol::init_base_output_data): Add version
12890         parameter.  Change all callers.
12891         (Symbol::init_base_output_segment): Likewise.
12892         (Symbol::init_base_constant): Likewise.
12893         (Symbol::init_base_undefined): Likewise.
12894         (Sized_symbol::init_output_data): Likewise.
12895         (Sized_symbol::init_output_segment): Likewise.
12896         (Sized_symbol::init_constant): Likewise.
12897         (Sized_symbol::init_undefined): Likewise.
12898         (Symbol_table::do_define_in_output_data): If the new symbol has a
12899         version, mark it as the default.
12900         (Symbol_table::do_define_in_output_segment): Likewise.
12901         (Symbol_table::do_define_as_constant): Likewise.
12902         * symtab.h (class Symbol): Update declarations.
12903         (class Sized_symbol): Likewise.
12904         * resolve.cc (Symbol::override_version): New function.
12905         (Symbol::override_base): Call override_version.
12906         (Symbol::override_base_with_special): Likewise.
12907         * testsuite/ver_script_8.script: New file.
12908         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12909         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12910         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12911         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12912
12913 2008-05-06  Ian Lance Taylor  <iant@google.com>
12914
12915         PR 6049
12916         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12917         functions.
12918         (class General_options): Remove existing --undefined, and add
12919         --no-undefined instead.  Add new --undefined as synonym for -u.
12920         * archive.cc (Archive::add_symbols): Check whether symbol was
12921         named with -u.
12922         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12923         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12924         all uses.  Add IS_UNDEFINED.  Update declarations to split
12925         different versions of init_base.  Declare init_base_undefined.
12926         (Symbol::is_defined): Handle IS_UNDEFINED.
12927         (Symbol::is_undefined): Likewise.
12928         (Symbol::is_weak_undefined): Call is_undefined.
12929         (Symbol::is_absolute): Handle IS_CONSTANT.
12930         (class Sized_symbol): Update declarations to split different
12931         versions of init.  Declare init_undefined.
12932         (class Symbol_table): Declare new functions.
12933         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12934         Change all callers.
12935         (Symbol::init_base_output_data): Likewise.
12936         (Symbol::init_base_output_segment): Likewise.
12937         (Symbol::init_base_constant): Likewise.
12938         (Symbol::init_base_undefined): New function.
12939         (Sized_symbol::init_object): Rename from init.  Change all
12940         callers.
12941         (Sized_symbol::init_output_data): Likewise.
12942         (Sized_symbol::init_output_segment): Likewise.
12943         (Sized_symbol::init_constant): Likewise.
12944         (Sized_symbol::init_undefined): New function.
12945         (Symbol_table::add_undefined_symbols_from_command_line): New
12946         function.
12947         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12948         function.
12949         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12950         (Symbol::output_section): Likewise.
12951         (Symbol::set_output_section): Likewise.
12952         (Symbol_table::sized_finalize_symbol): Likewise.
12953         (Symbol_table::sized_write_globals): Likewise.
12954         * resolve.cc (Symbol_table::should_override): Likewise.
12955         (Symbol::override_base_with_special): Likewise.
12956
12957         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12958         symbol, change it to have default visibility.
12959         * testsuite/protected_1.cc: New file.
12960         * testsuite/protected_2.cc: New file.
12961         * testsuite/protected_3.cc: New file.
12962         * testsuite/protected_main_1.cc: New file.
12963         * testsuite/protected_main_2.cc: New file.
12964         * testsuite/protected_main_3.cc: New file.
12965         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12966         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12967         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12968         (protected_1.so): New target.
12969         (protected_1_pic.o, protected_2_pic.o): New targets.
12970         (protected_3_pic.o): New target.
12971         (check_PROGRAMS): Add protected_2.
12972         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12973         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12974         * testsuite/Makefile.in: Rebuild.
12975
12976         * options.h (DEFINE_var): Add set_user_set_##varname__.
12977         (DEFINE_bool_alias): New macro.
12978         (class General_options): Define -Bstatic using DEFINE_bool_alias
12979         rather than DEFINE_special.  Add --undefined as an alias for -z
12980         defs.
12981         * options.cc (General_options::parse_Bstatic): Remove.
12982
12983         * options.h (class General_options): Add --fatal-warnings.
12984         * main.cc (main): Implement --fatal-warnings.
12985         * errors.h (Errors::warning_count): New function.
12986
12987         * options.h (class General_options): Add -Bsymbolic-functions.
12988         * symtab.h (Symbol::is_preemptible): Check for
12989         -Bsymbolic-functions.
12990
12991 2008-05-05  Ian Lance Taylor  <iant@google.com>
12992
12993         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12994         as noVARNAME rather than no-VARNAME.
12995         (class General_options): Add option -z combreloc.
12996         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12997         get_address.
12998         (Output_reloc::sort_before) [SHT_REL]: New function.
12999         (Output_reloc::sort_before) [SHT_RELA]: New function.
13000         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13001         Sort_relocs_comparison.
13002         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13003         parameter.  Change all callers.
13004         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13005         sort_relocs parameter.  Change all callers.
13006         * output.cc (Output_reloc::get_address): New function, broken out
13007         of write_rel.
13008         (Output_reloc::write_rel): Call it.
13009         (Output_reloc::compare): New function.
13010         (Output_data_reloc_base::do_write): Optionally sort relocs.
13011
13012         * configure.ac: If targ_extra_obj is set, link it in.
13013         * configure.tgt: Initialize all variables.
13014         (x86_64*): Set targ_extra_obj and targ_extra_size.
13015         * configure: Rebuild.
13016
13017         * object.cc (Sized_relobj::include_section_group): Adjust section
13018         indexes read from group data.  Build vector to pass to
13019         layout_group.
13020         * layout.cc (Layout::layout_group): Add flags and shndxes
13021         parameters.  Remove contents parameter.  Change caller.  Update
13022         explicit instantiations.
13023         * layout.h (class Layout): Update layout_group declaration.
13024         * output.cc (Output_data_group::Output_data_group): Add flags and
13025         input_shndxes parameters.  Remove contents parameter.  Change
13026         caller.
13027         (Output_data_group::do_write): Change input_sections_ to
13028         input_shndxes_.
13029         * output.h (class Output_data_group): Update constructor
13030         declaration.  Rename input_sections_ to input_shndxes_.
13031         * testsuite/many_sections_test.cc: Add template.
13032
13033 2008-04-30  Cary Coutant  <ccoutant@google.com>
13034
13035         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13036
13037         * layout.cc (Layout::include_section): Refactored check for debug
13038         info section.
13039         (Layout::add_comdat): Add new parameters.  Change type
13040         of signature parameter.  Add object and shndx to signatures table.
13041         (Layout::find_kept_object): New function.
13042         * layout.h: Include <cstring>.
13043         (Layout::is_debug_info_section): New function.
13044         (Layout::add_comdat): Add new parameters.
13045         (Layout::find_kept_object): New function.
13046         (Layout::Kept_section): New struct.
13047         (Layout::Signatures): Change type of map range.
13048         * object.cc (Relobj::output_section_address): New function.
13049         (Sized_relobj::include_section_group): Add new parameters.  Change
13050         calls to Layout::add_comdat.  Change to build table of kept comdat
13051         groups and table mapping discarded sections to kept sections.
13052         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13053         (Sized_relobj::do_layout): Change calls to include_section_group and
13054         include_linkonce_section.
13055         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13056         value to zero when section is discarded.
13057         (Sized_relobj::map_to_kept_section): New function.
13058         * object.h (Relobj::output_section_address): New function.
13059         (Relobj::Comdat_group): New type.
13060         (Relobj::find_comdat_group): New function.
13061         (Relobj::Comdat_group_table): New type.
13062         (Relobj::Kept_comdat_section): New type.
13063         (Relobj::Kept_comdat_section_table): New type.
13064         (Relobj::add_comdat_group): New function.
13065         (Relobj::set_kept_comdat_section): New function.
13066         (Relobj::get_kept_comdat_section): New function.
13067         (Relobj::comdat_groups_): New field.
13068         (Relobj::kept_comdat_sections_): New field.
13069         (Symbol_value::input_value): Update comment.
13070         (Sized_relobj::map_to_kept_section) New function.
13071         (Sized_relobj::include_linkonce_section): Add new parameter.
13072         * target-reloc.h (Comdat_behavior): New type.
13073         (get_comdat_behavior): New function.
13074         (relocate_section): Add code to map a discarded section to the
13075         corresponding kept section when applying a relocation.
13076
13077 2008-04-30  Craig Silverstein  <csilvers@google.com>
13078
13079         * dwarf_reader.cc (next_generation_count): New static var.
13080         (Addr2line_cache_entry): New struct.
13081         (addr2line_cache): New static var.
13082         (Dwarf_line_info::one_addr2line): Added caching.
13083         (Dwarf_line_info::clear_addr2line_cache): New function.
13084         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13085         cache-size parameter.
13086         (Dwarf_line_info::one_addr2line_cache): New function.
13087         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13088         new cache-size argument to one_addr2line(), and clear cache.
13089
13090 2008-04-28  Cary Coutant  <ccoutant@google.com>
13091
13092         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13093         R_386_PC8 relocations.
13094
13095 2008-04-23  Ian Lance Taylor  <iant@google.com>
13096
13097         * object.cc (Sized_relobj::include_section_group): Check for
13098         invalid section group.
13099
13100         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13101         header size.
13102
13103         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13104         than read for file header.
13105         * archive.cc (Archive::include_member): Likewise.
13106
13107 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13108
13109         * aclocal.m4: Regenerate.
13110         * configure: Regenerate.
13111
13112 2008-04-19  Ian Lance Taylor  <iant@google.com>
13113
13114         * version.cc (version_string): Bump to 1.6.
13115
13116         * testsuite/Makefile.am (many_sections_r_test): New target.
13117         (many_sections_r_test_SOURCES): Remove.
13118         (many_sections_r_test_DEPENDENCIES): Remove.
13119         (many_sections_r_test_LDFLAGS): Remove.
13120         (many_sections_r_test_LDADD): Remove.
13121
13122         * object.cc (Sized_relobj::do_add_symbols): Always pass
13123         local_symbol_count_ to add_from_relobj.
13124
13125         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13126         every thousand variables.
13127         * testsuite/Makefile.in: Rebuild.
13128
13129         * object.cc (Xindex::initialize_symtab_xindex): New function.
13130         (Xindex::read_symtab_xindex): New function.
13131         (Xindex::sym_xindex_to_shndx): New function.
13132         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13133         available.
13134         (Sized_relobj::do_initialize_xindex): New function.
13135         (Sized_relobj::do_read_symbols): Adjust section links.
13136         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13137         parameter.  Change all callers.
13138         (Sized_relobj::include_section_group): Adjust section links and
13139         symbol section indexes.
13140         (Sized_relobj::do_layout): Adjust section links.
13141         (Sized_relobj::do_count_local_symbols): Adjust section links and
13142         symbol section indexes.
13143         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13144         ordinary and special symbols.
13145         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13146         dynsym_xindex parameters.  Change all callers.  Adjust section
13147         links.  Use SHN_XINDEX when needed.
13148         (Sized_relobj::get_symbol_location_info): Adjust section links.
13149         Don't get fooled by special symbols.
13150         * object.h (class Xindex): Define.
13151         (class Object): Add xindex_ parameter.  Declare virtual functoin
13152         do_initialize_xindex.
13153         (Object::adjust_sym_shndx): New function.
13154         (Object::set_xindex): New protected function.
13155         (class Symbol_value): Add is_ordinary_shndx_ field.
13156         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13157         (Symbol_value::value): Assert ordinary section.
13158         (Symbol_value::initialize_input_to_output_map): Likewise.
13159         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13160         Change all callers.
13161         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13162         all callers.
13163         (class Sized_relobj): Update declarations.
13164         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13165         parameter.  Change all callers.
13166         (Sized_relobj::adjust_shndx): New function.
13167         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13168         field.
13169         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13170         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13171         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13172         (Sized_dynobj::read_dynsym_section): Adjust section links.
13173         (Sized_dynobj::read_dynamic): Likewise.
13174         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13175         section links.
13176         (Sized_dynobj::do_initialize_xindex): New function.
13177         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13178         do_initialize_xindex.
13179         (Sized_dynobj::adjust_shndx): New function.
13180         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13181         dynsym_xindex_ fields.
13182         (Layout::finalize): Add a call to set_section_indexes before
13183         creating the symtab sections.
13184         (Layout::set_section_indexes): Don't do anything if the section
13185         already has a section index.
13186         (Layout::create_symtab_sections): Add shnum parameter.  Change
13187         caller.  Create .symtab_shndx section if needed.
13188         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13189         caller.
13190         (Layout::allocated_output_section_count): New function.
13191         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13192         needed.
13193         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13194         fields.  Update declarations.
13195         (Layout::symtab_xindex): New function.
13196         (Layout::dynsym_xindex): New function.
13197         (class Write_symbols_task): Add layout_ field.
13198         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13199         Change caller.
13200         * output.cc (Output_section_headers::Output_section_headers): Add
13201         shstrtab_section parameter.  Change all callers.
13202         (Output_section_headers::do_sized_write): Store overflow values
13203         for section count and section string table section index in
13204         section header zero.
13205         (Output_file_header::do_sized_write): Check for overflow of
13206         section count and section string table section index.
13207         (Output_symtab_xindex::do_write): New function.
13208         (Output_symtab_xindex::endian_do_write): New function.
13209         * output.h (class Output_section_headers): Add shstrtab_section_.
13210         Update declarations.
13211         (class Output_symtab_xindex): Define.
13212         (Output_section::has_out_shndx): New function.
13213         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13214         field.
13215         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13216         Change all callers.
13217         (Sized_symbol::init): Likewise.
13218         (Symbol::output_section): Check for ordinary symbol.
13219         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13220         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13221         callers.
13222         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13223         Change all callers.  Simplify handling of symbols from sections
13224         not included in the link.
13225         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13226         distinction.
13227         (Weak_alias_sorter::operator()): Assert that symbols are
13228         ordinary.
13229         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13230         distinction.
13231         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13232         parameters.  Change all callers.
13233         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13234         symbol distinction.  Use SHN_XINDEX when needed.
13235         (Symbol_table::write_section_symbol): Add symtab_xindex
13236         parameter.  Change all callers.
13237         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13238         SHN_XINDEX when needed.
13239         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13240         declarations.
13241         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13242         (Symbol::is_defined): Check is_ordinary.
13243         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13244         (Symbol::is_absolute, Symbol::is_common): Likewise.
13245         (class Sized_symbol): Update declarations.
13246         (class Symbol_table): Update declarations.
13247         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13248         parameters.  Change all callers.
13249         (Sized_symbol::override): Likewise.
13250         (Symbol_table::override): Likewise.
13251         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13252         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13253         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13254         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13255         to be in an ordinary section.
13256         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13257         object and is_ordinary parameters.  Change all callers.
13258         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13259         Change all callers.  Don't add undefined or non-ordinary symbols
13260         to reloc_map_.
13261         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13262         Change all callers.
13263         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13264         declarations.
13265         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13266         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13267         (Sized_relobj::relocate_sections): Likewise.
13268         * target-reloc.h (scan_relocs): Adjust section symbol index.
13269         (scan_relocatable_relocs): Likewise.
13270         * i386.cc (Scan::local): Check for ordinary symbols.
13271         * sparc.cc (Scan::local): Likewise.
13272         * x86_64.cc (Scan::local): Likewise.
13273         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13274         to symbol_section_and_value.
13275         * testsuite/many_sections_test.cc: New file.
13276         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13277         (check_PROGRAMS): Add many_sections_test.
13278         (many_sections_test_SOURCES): Define.
13279         (many_sections_test_DEPENDENCIES): Define.
13280         (many_sections_test_LDFLAGS): Define.
13281         (BUILT_SOURCES): Add many_sections_define.h.
13282         (many_sections_define.h): New target.
13283         (BUILT_SOURCES): Add many_sections_check.h.
13284         (many_sections_check.h): New target.
13285         (check_PROGRAMS): Add many_sections_r_test.
13286         (many_sections_r_test_SOURCES): Define.
13287         (many_sections_r_test_DEPENDENCIES): Define.
13288         (many_sections_r_test_LDFLAGS): Define.
13289         (many_sections_r_test_LDADD): Define.
13290         (many_sections_r_test.o): New target.
13291         * testsuite/Makefile.in: Rebuild.
13292
13293 2008-04-17  Cary Coutant  <ccoutant@google.com>
13294
13295         * errors.cc (Errors::info): New function.
13296         (gold_info): New function.
13297         * errors.h (Errors::info): New function.
13298         * gold.h (gold_info): New function.
13299         * object.cc (Input_objects::add_object): Print trace output.
13300         * options.cc (options::parse_set): New function.
13301         (General_options::parse_wrap): Deleted.
13302         (General_options::General_options): Deleted initializer.
13303         * options.h (options::String_set): New typedef.
13304         (options::parse_set): New function.
13305         (DEFINE_set): New macro.
13306         (General_options::wrap): Changed to use DEFINE_set. Changed
13307         callers of any_wrap_symbols and is_wrap_symbol.
13308         (General_options::trace, General_options::trace_symbol):
13309         New options.
13310         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13311         (General_options::wrap_symbols_): Deleted.
13312         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13313
13314 2008-04-17  David S. Miller  <davem@davemloft.net>
13315
13316         * options.cc (General_options::parse_V): New function.
13317         * options.h: Add entries for -V and -Qy.
13318
13319 2008-04-17  Ian Lance Taylor  <iant@google.com>
13320
13321         * common.cc (Symbol_table::allocate_commons): Remove options
13322         parameter.  Change caller.
13323         (Symbol_table::do_allocate_commons): Remove options parameter.
13324         Change caller.  Just call do_allocate_commons_list twice.
13325         (Symbol_table::do_allocate_commons_list): New function, broken out
13326         of do_allocate_commons.
13327         * common.h (class Allocate_commons_task): Remove options_ field.
13328         Update constructor.
13329         * symtab.cc (Symbol_table::Symbol_table): Initialize
13330         tls_commons_.
13331         (Symbol_table::add_from_object): Put TLS common symbols on
13332         tls_commons_ list.
13333         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13334         which are IN_OUTPUT_DATA.
13335         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13336         allocate_commons and do_allocate_commons declarations.  Declare
13337         do_allocate_commons_list.
13338         * gold.cc (queue_middle_tasks): Update creation of
13339         Allocate_commons_task to not pass options.
13340         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13341         (TLS_TEST_C_FLAGS): New variable.
13342         (tls_test_c_pic.o): New target.
13343         (tls_test_shared.so): Link in tls_test_c_pic.o.
13344         (tls_test_c_pic_ie.o): New target.
13345         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13346         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13347         (tls_test_c.o): New target.
13348         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13349         (tls_pic_test_LDADD): Likewise.
13350         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13351         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13352         (tls_test_c_gnu2.o): New target.
13353         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13354         tls_test_c_gnu2.o.
13355         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13356         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13357         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13358         * testsuite/tls_test.cc: Include "config.h".
13359         (t_last): Call t11_last.
13360         * testsuite/tls_test.h (t11, t11_last): Declare.
13361         * testsuite/tls_test_c.c: New file.
13362         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13363         * configure.ac: Check for OpenMP support.
13364         * configure, config.in, Makefile.in: Rebuild.
13365         * testsuite/Makefile.in: Rebuild.
13366
13367 2008-04-16  Cary Coutant  <ccoutant@google.com>
13368
13369         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13370         (Target_i386::tls_base_symbol_defined_): New field.
13371         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13372         (Target_i386::Scan::global): Likewise.
13373         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13374         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13375         (Target_x86_64::tls_base_symbol_defined_): New field.
13376         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13377         (Target_x86_64::Scan::global): Likewise.
13378
13379 2008-04-16  Cary Coutant  <ccoutant@google.com>
13380
13381         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13382         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13383         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13384         building shared libraries.
13385         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13386         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13387         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13388         * testsuite/Makefile.in: Rebuild.
13389         * testsuite/weak_undef.h: New file.
13390         * testsuite/weak_undef_file1.cc: Add extra test cases.
13391         * testsuite/weak_undef_file2.cc: Likewise.
13392         * testsuite/weak_undef_test.cc: Likewise.
13393
13394 2008-04-16  David S. Miller  <davem@davemloft.net>
13395
13396         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13397         Add issued_non_pic_error_ field.  Declare check_non_pic.
13398         (Target_sparc::Scan::check_non_pic): New function.
13399         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13400         (Target_sparc::Scan::global): Likewise.
13401
13402         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13403         * configure: Rebuild.
13404
13405         * options.h (DEFINE_enable): New macro.
13406         (new_dtags): New enable option.
13407         (initfirst, interpose, loadfltr, nodefaultlib,
13408         nodelete, nodlopen, nodump): New -z options.
13409         * layout.cc (Layout:finish_dynamic_section): If new
13410         dtags enabled, emit DT_RUNPATH.  Also, emit a
13411         DT_FLAGS_1 containing any specified -z flags.
13412
13413 2008-04-16  Ian Lance Taylor  <iant@google.com>
13414
13415         * copy-relocs.cc: New file.
13416         * copy-relocs.h: New file.
13417         * reloc.cc: Remove Copy_relocs code.
13418         * reloc.h: Likewise.
13419         * reloc-types.h (struct Reloc_types) [both versions]: Add
13420         get_reloc_addend_noerror.
13421         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13422         variants of add_global which take an addend which must be zero.
13423         * i386.cc: Include "copy-relocs.h".
13424         (class Target_i386): Change type of copy_relocs_ to variable,
13425         update initializer.
13426         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13427         Change all callers.
13428         (Target_i386::do_finalize_sections): Change handling of
13429         copy_relocs_.
13430         * sparc.cc: Include "copy-relocs.h".
13431         (class Target_sparc): Change type of copy_relocs_ to variable,
13432         update initializer.
13433         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13434         Change all callers.
13435         (Target_sparc::do_finalize_sections): Change handling of
13436         copy_relocs_.
13437         * x86_64.cc: Include "copy-relocs.h".
13438         (class Target_x86_64): Change type of copy_relocs_ to variable,
13439         update initializer.
13440         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13441         class.  Change all callers.
13442         (Target_x86_64::do_finalize_sections): Change handling of
13443         copy_relocs_.
13444         * Makefile.am (CCFILES): Add copy-relocs.cc.
13445         (HFILES): Add copy-relocs.h.
13446
13447         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13448
13449         * testsuite/script_test_4.sh: Permit leading zeroes.
13450
13451 2008-04-15  Ian Lance Taylor  <iant@google.com>
13452
13453         * script-sections.cc (Script_sections::create_segments): Use
13454         header_size_adjustment even when there is enough room for the
13455         headers.
13456         * testsuite/script_test_4.sh: New file.
13457         * testsuite/script_test_4.t: New file.
13458         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13459         (check_DATA): Add script_test_4.stdout.
13460         (MOSTLYCLEANFILES): Likewise.
13461         (script_test_4): New target.
13462         (script_test_4.stdout): New target.
13463         * testsuite/Makefile.in: Rebuild.
13464
13465         * sparc.cc: Add definitions for Output_data_plt_sparc class
13466         constants.
13467
13468 2008-04-14  David S. Miller  <davem@davemloft.net>
13469
13470         * sparc.cc: New file.
13471         * Makefile.am (TARGETSOURCES): Add sparc.cc
13472         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13473         * configure.tgt: Document targ_extra_size and
13474         targ_extra_big_endian.  Add entries for sparc-* and
13475         sparc64-*.
13476         * configure.ac: Handle targ_extra_size and
13477         targ_extra_big_endian.
13478         * Makefile.in: Rebuild.
13479         * configure: Likewise.
13480         * po/POTFILES.in: Likewise.
13481         * po/gold.pot: Likewise.
13482
13483 2008-04-14  Ian Lance Taylor  <iant@google.com>
13484
13485         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13486         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13487         in the name/type/flags to section mapping.  Don't call
13488         allocate_output_section.
13489         (Layout::choose_output_section): Change parameter from adjust_name
13490         to is_input_section.  Don't permit input sections after sections
13491         are attached to segments.  Don't call allocate_output_section.
13492         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13493         not write_enable_output_section.
13494         (Layout::make_output_section): Don't push to
13495         unattached_section_list_ nor call attach_to_segment.  Call
13496         attach_section_to_segment if sections are attached.
13497         (Layout::attach_sections_to_segments): New function.
13498         (Layout::attach_section_to_segment): New function.
13499         (Layout::attach_allocated_section_to_segment): Rename from
13500         attach_to_segment.  Remove flags parameter.
13501         (Layout::allocate_output_section): Remove function.
13502         (Layout::write_enable_output_section): Remove function.
13503         * layout.h (class Layout): Update for above changes.  Add new
13504         field sections_are_attached_.
13505         * output.h (Output_section::update_flags_for_input_section): New
13506         function.
13507         * output.cc (Output_section::add_input_section): Call
13508         update_flags_for_input_section.
13509         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13510
13511 2008-04-11  Cary Coutant  <ccoutant@google.com>
13512
13513         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13514         thought unnecessary.
13515         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13516
13517 2008-04-11  Ian Lance Taylor  <iant@google.com>
13518
13519         * output.h (class Output_section_data): Remove inline definition
13520         of set_addralign.
13521         * output.cc (Output_section_data::set_addralign): New function.
13522
13523 2008-04-11  Cary Coutant  <ccoutant@google.com>
13524
13525         Add support for TLS descriptors for i386 and x86_64.
13526         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13527         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13528         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13529         GOT_TYPE_TLS_DESC.
13530         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13531         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13532         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13533         relocations.
13534         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13535         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13536         Fix problem with initial-exec relocations.
13537         (Target_i386::Relocate::relocate_tls): Likewise.
13538         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13539         relaxation.
13540         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13541         support for section-plus-offset dynamic table entries.
13542         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13543         (Output_data_dynamic::Dynamic_entry): Add support for
13544         section-plus-offset dynamic table entries.
13545         (Output_data_dynamic::Classification): Likewise.
13546         (Output_data_dynamic::classification_): Renamed offset_.
13547         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13548         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13549         (Target_x86_64::make_plt_section): New function.
13550         (Target_x86_64::reserve_tlsdesc_entries): New function.
13551         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13552         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13553         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13554         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13555         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13556         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13557         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13558         add extra PLT entry for TLS descriptors.
13559         (Output_data_plt_x86_64::got_): New field.
13560         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13561         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13562         fields.
13563         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13564         descriptors.
13565         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13566         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13567         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13568         R_386_TLS_DESC_CALL relocations.
13569         (Target_x86_64::Scan::global): Likewise.
13570         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13571         for TLS descriptors.
13572         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13573         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13574         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13575         GD-to-IE relaxation.
13576         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13577         and TLS_DESCRIPTORS.
13578         * Makefile.in: Rebuild.
13579         * configure: Rebuild.
13580         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13581         (tls_test_shared2.so): New target.
13582         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13583         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13584         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13585         (tls_shared_gd_to_ie_test_LDADD): New variable.
13586         (tls_shared_gnu2_gd_to_ie_test): New target.
13587         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13588         New targets.
13589         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13590         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13591         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13592         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13593         (tls_shared_gnu2_test): New target.
13594         (tls_test_gnu2_shared.so): New target.
13595         (tls_shared_gnu2_test_SOURCES): New variable.
13596         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13597         (tls_shared_gnu2_test_LDFLAGS): New variable.
13598         (tls_shared_gnu2_test_LDADD): New variable.
13599         * testsuite/Makefile.in: Rebuild.
13600         * testsuite/Makefile.
13601
13602 2008-04-11  Ian Lance Taylor  <iant@google.com>
13603
13604         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13605         justsyms.t.
13606         * testsuite/Makefile.in: Rebuild.
13607
13608         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13609         long.
13610         * testsuite/script_test_2.cc (main): Adjust test.
13611
13612 2008-04-11  David S. Miller  <davem@davemloft.net>
13613             Ian Lance Taylor  <iant@google.com>
13614
13615         * options.h (General_options): Add entries for '-Y' and
13616         '-relax'.
13617         * options.cc (General_options:finalize): If -Y was used, add those
13618         entries to the library path instead of the default "/lib" and
13619         "/usr/lib".
13620
13621 2008-04-11  David S. Miller  <davem@davemloft.net>
13622
13623         * testsuite/justsyms.t: Start at 0x100.
13624         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13625         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13626         long.
13627         * testsuite/script_test_2.cc: Adjust string and section length
13628         checks.
13629
13630 2008-04-09  Ian Lance Taylor  <iant@google.com>
13631
13632         PR gold/5996
13633         * script-sections.cc (Sections_element::allocate_to_segment): Add
13634         orphan parameter.
13635         (Output_section_definition::allocate_to_segment): Likewise.
13636         (Orphan_output_section::allocate_to_segment): Likewise.
13637         (Script_sections::attach_sections_using_phdrs_clause): Don't
13638         propagate non-PT_LOAD segments to orphan sections.
13639         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13640         readelf rather than objdump.
13641         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13642         .interp section and PT_INTERP segment are the same size.
13643         * testsuite/Makefile.in: Rebuild.
13644
13645         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13646         aliases for symbols defined in the same object.
13647         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13648         (weak_alias_test_SOURCES): New variable.
13649         (weak_alias_test_DEPENDENCIES): New variable.
13650         (weak_alias_test_LDFLAGS): New variable.
13651         (weak_alias_test_LDADD): New variable.
13652         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13653         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13654         (weak_alias_test_3.o): New target.
13655         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13656         * testsuite/weak_alias_test_main.cc: New file.
13657         * testsuite/weak_alias_test_1.cc: New file.
13658         * testsuite/weak_alias_test_2.cc: New file.
13659         * testsuite/weak_alias_test_3.cc: New file.
13660
13661 2008-04-08  Ian Lance Taylor  <iant@google.com>
13662
13663         * options.h (class General_options): Add --noinhibit-exec option.
13664         * main.cc (main): Check --noinhibit-exec.
13665
13666         * options.h (class General_options): Define --wrap as a special
13667         option.  Add wrap_symbols_ field.
13668         (General_options::any_wrap_symbols): New function.
13669         (General_options::is_wrap_symbol): New function.
13670         * options.cc (General_options::parse_wrap): New function.
13671         (General_options::General_options): Initialize wrap_symbols_.
13672         * symtab.cc (Symbol_table::wrap_symbol): New function.
13673         (Symbol_table::add_from_object): Handle --wrap.
13674         * symtab.h (class Symbol_table): Declare wrap_symbol.
13675         * target.h (Target::wrap_char): New function.
13676         (Target::Target_info): Add wrap_char field.
13677         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13678         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13679         * testsuite/testfile.cc (Target_test::test_target_info):
13680         Likewise.
13681
13682         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13683         there is one.
13684
13685         * layout.h (class Layout): Add added_eh_frame_data_ field.
13686         * layout.cc (Layout::Layout): Initialize new field.
13687         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13688         output section until we find a section we merged successfully.
13689         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13690         that the size be non-zero.
13691
13692         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13693         qualifier.
13694
13695 2008-04-08  Craig Silverstein  <csilvers@google.com>
13696
13697         * configure.ac: Export new conditional variable HAVE_ZLIB.
13698         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13699         on HAVE_ZLIB.
13700         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13701         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13702
13703 2008-04-07  Ian Lance Taylor  <iant@google.com>
13704
13705         * version.cc (version_string): Set to "1.5".
13706
13707         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13708         Add issued_non_pic_error_ field.  Declare check_non_pic.
13709         (Target_x86_64::Scan::check_non_pic): New function.
13710         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13711         (Target_x86_64::Scan::global): Likewise.
13712
13713         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13714         addend parameter.  Change caller.  Handle merge sections.
13715         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13716         Address to Addend.  Don't add in the result of
13717         local_section_offset, pass down the addend and use the returned
13718         value.
13719         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13720         Update declarations of local_section_offset and symbol_value.
13721         * testsuite/two_file_test_1.cc (t18): New function.
13722         * testsuite/two_file_test_2.cc (f18): New function.
13723         * testsuite/two_file_test_main.cc (main): Call t18.
13724         * testsuite/two_file_test.h (t18, f18): Declare.
13725
13726         * configure.ac: Don't test for objdump, c++filt, or readelf.
13727         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13728         conditionals.
13729         (TEST_READELF): New variable.
13730         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13731         (check_PROGRAMS): Add two_file_strip_test.
13732         (two_file_strip_test): New target.
13733         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13734         (two_file_same_shared_strip_test_SOURCES): New variable.
13735         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13736         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13737         (two_file_same_shared_strip_test_LDADD): New variable.
13738         (two_file_shared_strip.so): New target.
13739         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13740         (ver_test_5.syms, ver_test_7.syms): Likewise.
13741         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13742         (strip_test_3.stdout): Use TEST_OBJDUMP.
13743         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13744
13745 2008-04-04  Cary Coutant  <ccoutant@google.com>
13746
13747         * symtab.h (Symbol::is_weak_undefined): New function.
13748         (Symbol::is_strong_undefined): New function.
13749         (Symbol::is_absolute): New function.
13750         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13751         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13752         absolute symbols.
13753         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13754         (weak_undef_test): New target.
13755         * testsuite/Makefile.in: Rebuild.
13756         * testsuite/weak_undef_file1.cc: New file.
13757         * testsuite/weak_undef_file2.cc: New file.
13758         * testsuite/weak_undef_test.cc: New file.
13759
13760 2008-04-03  Craig Silverstein  <csilvers@google.com>
13761
13762         * compressed_output.h (class Output_compressed_section): Use
13763         unsigned buffer.
13764         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13765         add zlib header.
13766         (zlib_compressed_suffix): Removed.
13767         (Output_compressed_section::set_final_data_size): Use unsigned
13768         buffers.
13769         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13770         Fix linker invocation.
13771         (flagstest_o_specialfile_and_compress_debug_sections):
13772         Likewise.
13773         * testsuite/Makefile.in: Regenerated.
13774
13775 2008-04-02  David S. Miller  <davem@davemloft.net>
13776
13777         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13778         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13779
13780 2008-04-02  Craig Silverstein  <csilvers@google.com>
13781
13782         * TODO: New file.
13783
13784 2008-04-02  Ian Lance Taylor  <iant@google.com>
13785
13786         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13787         parameters.  Update for new key type to views_.  Change all
13788         callers.
13789         (File_read::read): Adjust for byteshift in returned view.
13790         (File_read::add_view): New function, broken out of
13791         find_and_make_view.
13792         (File_read::make_view): New function, broken out of
13793         find_and_make_view.
13794         (File_read::find_or_make_view): Add offset and aligned
13795         parameters.  Rewrite accordingly.  Change all callers.
13796         (File_read::get_view): Add offset and aligned parameters.  Adjust
13797         for byteshift in return value.
13798         (File_read::get_lasting_view): Likewise.
13799         * fileread.h (class File_read): Update declarations.
13800         (class File_read::View): Add byteshift_ field.  Add byteshift to
13801         constructor.  Add byteshift method.
13802         * archive.h (Archive::clear_uncached_views): New function.
13803         (Archive::get_view): Add aligned parameter.  Change all callers.
13804         * object.h (Object::get_view): Add aligned parameter.  Change all
13805         callers.
13806         (Object::get_lasting_view): Likewise.
13807
13808         * fileread.cc (File_read::release): Don't call clear_views if
13809         there are multiple objects.
13810         * fileread.h (File_read::clear_uncached_views): New function.
13811         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13812         on the archive.
13813
13814 2008-03-31  Cary Coutant  <ccoutant@google.com>
13815
13816         Add thin archive support.
13817         * archive.cc (Archive::armagt): New const.
13818         (Archive::setup): Remove task parameter and calls to unlock.
13819         (Archive::unlock_nested_archives): New function.
13820         (Archive::read_header): Add nested_off parameter. Change
13821         all callers.
13822         (Archive::interpret_header): Likewise.
13823         (Archive::include_all_members): Change to handle thin
13824         archives.
13825         (Archive::include_member): Likewise.
13826         * archive.h (Archive::Archive): Add new parameters and
13827         initializers.
13828         (Archive::armagt): New const.
13829         (Archive::setup): Remove task parameter.
13830         (Archive::unlock_nested_archives): New function.
13831         (Archive::read_header): Add nested_off parameter.
13832         (Archive::interpret_header): Likewise.
13833         (Archive::Nested_archive_table): New typedef.
13834         (Archive::is_thin_archive_): New field.
13835         (Archive::nested_archives_): New field.
13836         (Archive::options_): New field.
13837         (Archive::dirpath_): New field.
13838         (Archive::task_): New field.
13839         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13840         for thin archives.  Pass additional parameters to
13841         Archive::Archive.  Unlock the archive file after calling
13842         Archive::setup.
13843
13844 2008-03-29  Ian Lance Taylor  <iant@google.com>
13845
13846         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13847         version symbol to be local.
13848         * testsuite/ver_test_4.sh: New file.
13849         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13850         (check_DATA): Add ver_test_4.syms.
13851         (ver_test_4.syms): New target.
13852         * testsuite/Makefile.in: Rebuild.
13853
13854         * output.cc
13855         (Output_section::Input_section_sort_entry::has_priority): New
13856         function.
13857         (Output_section::Input_section_sort_entry::match_file_name): New
13858         function.
13859         (Output_section::Input_section_sort_entry::match_section_name):
13860         Remove.
13861         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13862         Remove.
13863         (Output_section::Input_section_sort_entry::match_section_file):
13864         Remove.
13865         (Output_section::Input_section_sort_compare::operator()): Rewrite
13866         using new Input_section_sort_entry functions.  Sort crtbegin and
13867         crtend first.  Sort sections with no priority before sections with
13868         a priority.
13869         * testsuite/initpri1.c (d3): Check j != 4.
13870         (cd5): New constructor/destructor function.
13871         (main): Check j != 2.
13872
13873         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13874         new symbol when resolving, don't call set_is_default.
13875         * testsuite/ver_test_7.cc: New file.
13876         * testsuite/ver_test_7.sh: New file.
13877         * testsuite/Makefile.am (ver_test_7.so): New target.
13878         (ver_test_7.o): New target.
13879         (check_SCRIPTS): Add ver_test_7.sh.
13880         (check_DATA): Add ver_test_7.syms.
13881         (ver_test_7.syms): New target.
13882
13883 2008-03-28  Ian Lance Taylor  <iant@google.com>
13884
13885         * layout.cc (Layout::layout): If we see an input section with a
13886         name that needs sorting, set the must_sort flag for the output
13887         section.
13888         (Layout::make_output_section): If the name of the output section
13889         indicates that it might require sorting, set the may_sort flag.
13890         * output.h (Output_section::may_sort_attached_input_sections): New
13891         function.
13892         (Output_section::set_may_sort_attached_input_sections): New
13893         function.
13894         (Output_section::must_sort_attached_input_sections): New
13895         function.
13896         (Output_section::set_must_sort_attached_input_sections): New
13897         function.
13898         (class Output_section): Declare Input_section_sort_entry.  Define
13899         Input_section_sort_compare.  Declare
13900         sort_attached_input_sections.  Add new fields:
13901         may_sort_attached_input_sections_,
13902         must_sort_attached_input_sections_,
13903         attached_input_sections_are_sorted_.
13904         * output.cc (Output_section::Output_section): Initialize new
13905         fields.
13906         (Output_section::add_input_section): Add an entry to
13907         input_sections_ if may_sort or must_sort are true.
13908         (Output_section::set_final_data_size): Call
13909         sort_attached_input_sections if necessary.
13910         (Output_section::Input_section_sort_entry): Define new class.
13911         (Output_section::Input_section_sort_compare::operator()): New
13912         function.
13913         (Output_section::sort_attached_input_sections): New function.
13914         * configure.ac: Check whether the compiler supports constructor
13915         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13916         * testsuite/initpri1.c: New file.
13917         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13918         CONSTRUCTOR_PRIORITY.
13919         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13920         (initpri1_LDFLAGS): New variable.
13921         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13922
13923 2008-03-27  Ian Lance Taylor  <iant@google.com>
13924
13925         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13926         * testsuite/common_test_1.c: New file.
13927         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13928         (common_test_1_SOURCES): New variable.
13929         (common_test_1_DEPENDENCIES): New variable.
13930         (common_test_1_LDFLAGS): New variable.
13931
13932         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13933         and commons_ correctly when NAME/VERSION does not override
13934         NAME/NULL.
13935         * testsuite/ver_test_6.c: New file.
13936         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13937         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13938         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13939
13940 2008-03-26  Ian Lance Taylor  <iant@google.com>
13941
13942         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13943         of an undefined symbol from a version script.
13944         * testsuite/Makefile.am (ver_test_5.so): New target.
13945         (ver_test_5.o): New target.
13946         (check_SCRIPTS): Add ver_test_5.sh.
13947         (check_DATA): Add ver_test_5.syms.
13948         (ver_test_5.syms): New target.
13949         * testsuite/ver_test_5.cc: New file.
13950         * testsuite/ver_test_5.script: New file.
13951         * testsuite/ver_test_5.sh: New file.
13952         * Makefile.in, testsuite/Makefile.in: Rebuild.
13953
13954         PR gold/5986
13955         Fix problems building gold with gcc 4.3.0.
13956         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13957         (gold_error_at_location, gold_warning_at_location): Use it.
13958         * configure.ac: Check whether we can compile and use a template
13959         function with a printf attribute.
13960         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13961         when jumping over bytes.
13962         * object.cc: Instantiate Object::read_section_data.
13963         * debug.h: Include <cstring>
13964         * dwarf_reader.cc: Include <algorithm>
13965         * main.cc: Include <cstring>.
13966         * options.cc: Include <cstring>.
13967         * output.cc: Include <cstring>.
13968         * script.cc: Include <cstring>.
13969         * script.h: Include <string>.
13970         * symtab.cc: Include <cstring> and <algorithm>.
13971         * target-select.cc: Include <cstring>.
13972         * version.cc: Include <string>.
13973         * testsuite/testmain.cc: Include <cstdlib>.
13974         * configure, config.in: Rebuild.
13975
13976 2008-03-25  Ian Lance Taylor  <iant@google.com>
13977
13978         * options.cc: Include "../bfd/bfdver.h".
13979         (options::help): Print bug reporting address.
13980
13981         * version.cc (print_version): Adjust output for current value of
13982         BFD_VERSION_STRING.
13983
13984         * NEWS: New file.
13985
13986         * options.cc (options::help): Print list of supported targets.
13987         * target-select.h: Include <vector>.
13988         (class Target_selector): Make machine_, size_, and is_big_endian_
13989         fields const.  Add bfd_name_ and instantiated_target_ fields.
13990         (Target_selector::Target_selector): Add bfd_name parameter.
13991         (Target_selector::recognize): Make non-virtual, call
13992         do_recognize.
13993         (Target_selector::recognize_by_name): Make non-virtual, call
13994         do_recognize_by_name.
13995         (Target_selector::supported_names): New function.
13996         (Target_selector::bfd_name): New function.
13997         (Target_selector::do_instantiate_target): New pure virtual
13998         function.
13999         (Target_selector::do_recognize): New virtual function.
14000         (Target_selector::do_recognize_by_name): New virtual function.
14001         (Target_selector::instantiate_target): New private function.
14002         (supported_target_names): Declare.
14003         * target-select.cc (Target_selector::Target_selector): Update for
14004         new parameter and fields.
14005         (select_target_by_name): Check that the name matches before
14006         calling recognize_by_name.
14007         (supported_target_names): New function.
14008         * i386.cc (class Target_selector_i386): Update Target_selector
14009         constructor call.  Remove recognize and recognize_by_name.  Add
14010         do_instantiate_target.
14011         * x86_64.cc (class Target_selector_x86_64): Likewise.
14012         * testsuite/testfile.cc (class Target_selector_test): Update for
14013         changes to Target_selector.
14014
14015         * README: Rewrite, with some notes on unsupported features.
14016
14017 2008-03-24  Cary Coutant  <ccoutant@google.com>
14018
14019         * i386.cc (Target_i386::Got_type): New enum declaration.
14020         (Target_i386::Scan::local): Updated callers of Output_data_got
14021         member functions.
14022         (Target_i386::Scan::global): Likewise.
14023         (Target_i386::Relocate::relocate): Likewise.
14024         (Target_i386::Relocate::relocate_tls): Likewise.
14025         * object.h (Got_offset_list): New class.
14026         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14027         (Sized_relobj::local_got_offset): Likewise.
14028         (Sized_relobj::set_local_got_offset): Likewise.
14029         (Sized_relobj::local_has_tls_got_offset): Removed.
14030         (Sized_relobj::local_tls_got_offset): Removed.
14031         (Sized_relobj::set_local_tls_got_offset): Removed.
14032         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14033         * output.cc (Output_data_got::add_global): Added got_type parameter.
14034         (Output_data_got::add_global_with_rel): Likewise.
14035         (Output_data_got::add_global_with_rela): Likewise.
14036         (Output_data_got::add_global_pair_with_rel): New function.
14037         (Output_data_got::add_global_pair_with_rela): New function.
14038         (Output_data_got::add_local): Added got_type parameter.
14039         (Output_data_got::add_local_with_rel): Likewise.
14040         (Output_data_got::add_local_with_rela): Likewise.
14041         (Output_data_got::add_local_pair_with_rel): New function.
14042         (Output_data_got::add_local_pair_with_rela): New function.
14043         (Output_data_got::add_global_tls): Removed.
14044         (Output_data_got::add_global_tls_with_rel): Removed.
14045         (Output_data_got::add_global_tls_with_rela): Removed.
14046         (Output_data_got::add_local_tls): Removed.
14047         (Output_data_got::add_local_tls_with_rel): Removed.
14048         (Output_data_got::add_local_tls_with_rela): Removed.
14049         * output.h (Output_data_got::add_global): Added got_type parameter.
14050         (Output_data_got::add_global_with_rel): Likewise.
14051         (Output_data_got::add_global_with_rela): Likewise.
14052         (Output_data_got::add_global_pair_with_rel): New function.
14053         (Output_data_got::add_global_pair_with_rela): New function.
14054         (Output_data_got::add_local): Added got_type parameter.
14055         (Output_data_got::add_local_with_rel): Likewise.
14056         (Output_data_got::add_local_with_rela): Likewise.
14057         (Output_data_got::add_local_pair_with_rel): New function.
14058         (Output_data_got::add_local_pair_with_rela): New function.
14059         (Output_data_got::add_global_tls): Removed.
14060         (Output_data_got::add_global_tls_with_rel): Removed.
14061         (Output_data_got::add_global_tls_with_rela): Removed.
14062         (Output_data_got::add_local_tls): Removed.
14063         (Output_data_got::add_local_tls_with_rel): Removed.
14064         (Output_data_got::add_local_tls_with_rela): Removed.
14065         * resolve.cc (Symbol::override_base_with_special): Removed
14066         reference to has_got_offset_ field.
14067         * symtab.cc (Symbol::init_fields): Replaced initialization
14068         of got_offset_ with got_offsets_.  Removed initialization
14069         of has_got_offset_
14070         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14071         (Symbol::got_offset): Likewise.
14072         (Symbol::set_got_offset): Likewise.
14073         (Symbol::has_tls_got_offset): Removed.
14074         (Symbol::tls_got_offset): Removed.
14075         (Symbol::set_tls_got_offset): Removed.
14076         (Symbol::got_offset_): Removed.
14077         (Symbol::tls_mod_got_offset_): Removed.
14078         (Symbol::tls_pair_got_offset_): Removed.
14079         (Symbol::got_offsets_): New field.
14080         (Symbol::has_got_offset): Removed.
14081         (Symbol::has_tls_mod_got_offset): Removed.
14082         (Symbol::has_tls_pair_got_offset): Removed.
14083         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14084         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14085         member functions.
14086         (Target_x86_64::Scan::global): Likewise.
14087         (Target_x86_64::Relocate::relocate): Likewise.
14088         (Target_x86_64::Relocate::relocate_tls): Likewise.
14089
14090 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14091
14092         * yyscript.y: Fix spelling error in comment.
14093
14094 2008-03-24  Ian Lance Taylor  <iant@google.com>
14095
14096         * options.h (class General_options): Define build_id option.
14097         * layout.h (class Layout): Declare write_build_id, create_note,
14098         create_build_id.  Add build_id_note_ member.
14099         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14100         "libiberty.h", "md5.h", "sha1.h".
14101         (Layout::Layout): Initialize eh_frame_data_,
14102         eh_frame_hdr_section_, and build_id_note_.
14103         (Layout::finalize): Call create_build_id.
14104         (Layout::create_note): New function, broken out of
14105         Layout::create_gold_note.
14106         (Layout::create_gold_note): Call create_note.
14107         (Layout::create_build_id): New function.
14108         (Layout::write_build_id): New function.
14109         (Close_task_runner::run): Call write_build_id.
14110
14111         * x86_64.cc: Correct license to GPLv3.
14112
14113 2008-03-23  Ian Lance Taylor  <iant@google.com>
14114
14115         * options.cc: Include "demangle.h".
14116         (parse_optional_string): New function.
14117         (parse_long_option): Handle takes_optional_argument.
14118         (parse_short_option): Update dash_z initializer.  Handle
14119         takes_optional_argument.
14120         (General_options::General_options): Initialize do_demangle_.
14121         (General_options::finalize): Set do_demangle_.  Handle demangling
14122         style.
14123         * options.h (parse_optional_string): Declare.
14124         (struct One_option): Add optional_arg field.  Update constructor.
14125         Update call constructor calls.  Add takes_optional_argument
14126         function.
14127         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14128         (DEFINE_optional_string): Define.
14129         (General_options::demangle): Change from DEFINE_bool to
14130         DEFINE_optional_string.
14131         (General_options::no_demangle): New function.
14132         (General_options::do_demangle): New function.
14133         (General_options::set_do_demangle): New function.
14134         (General_options::execstack_status_): Move definition to end of
14135         class definition.
14136         (General_options::static_): Likewise.
14137         (General_options::do_demangle_): New field.
14138         * object.cc (big_endian>::get_symbol_location_info): Call
14139         Options::do_demangle, not Options::demangle.
14140         * symtab.cc (demangle): Likewise.
14141
14142 2008-03-22  Ian Lance Taylor  <iant@google.com>
14143
14144         * gold.h: Include <cstddef> and <sys/types.h>
14145         * options.h: Include <cstring>.
14146
14147 2008-03-21  Ian Lance Taylor  <iant@google.com>
14148
14149         * Added source code to GNU binutils.