* options.h (General_options): Add plt_align, plt_static_chain,
[platform/upstream/binutils.git] / gold / ChangeLog
1 2012-12-06  Alan Modra  <amodra@gmail.com>
2
3         * options.h (General_options): Add plt_align, plt_static_chain,
4         plt_thread_safe.  Update stub_group_size help text.
5         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
6         for new plt_thread_safe_ var.
7         (use_plt_offset): Correct comments.
8         (Target_powerpc::do_relax): Look for thread creation symbols to
9         determine default plt_thread_safe value.  Clear plt call stubs
10         as well as branch stubs each iteration.
11         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
12         insn constants.
13         (l, hi, ha, write_insn): Move earlier.
14         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
15         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
16         plt stubs too.
17         (Stub_table::update_size): Adjust.
18         (Stub_table::prev_size, set_prev_size): Delete.
19         (Stub_table::stub_align): Let --plt-align affect result.
20         (Stub_table::plt_call_size): Calculate sizes for various stubs.
21         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
22         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
23         (Stub_table::do_write): Support more stub variants.
24
25 2012-12-04  Alan Modra  <amodra@gmail.com>
26
27         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
28         (Target_powerpc::do_define_standard_symbols): New function.
29
30 2012-12-03  Alan Modra  <amodra@gmail.com>
31
32         * output.h: Formatting, whitespace.
33
34 2012-12-03  Alan Modra  <amodra@gmail.com>
35
36         * layout.h (Layout::get_executable_sections): Declare.
37         * layout.cc (Layout::get_executable_sections): New function.
38         * arm.cc (Target_arm::group_sections): Use it.
39         (Arm_output_section::group_sections): Delete now redundant test.
40         * output.cc (Output_reloc::Output_reloc): Add is_relative.
41         param to handle relative relocs.
42         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
43         (Output_data_reloc::add_absolute): Adjust.
44         (Output_data_reloc::add_relative): New function.
45         (Output_data::reset_data_size): New function.
46         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
47         (Output_section::set_addralign): New function.
48         (Output_section::checkpoint_set_addralign): New function.
49         (Output_section::clear_section_offsets_need_adjustment): New function.
50         (Output_section::input_sections): Make public.
51         * powerpc.cc (class Output_data_brlt_powerpc): New.
52         (class Stub_table, class Stub_control): New.
53         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
54         stub_table_, set_stub_table, stub_table): New vectors and accessor
55         functions.
56         (Target_powerpc::do_may_relax, do_relax, push_branch,
57         new_stub_table, stub_tables, brlt_section, group_sections,
58         add_branch_lookup_table, find_branch_lookup_table,
59         write_branch_lookup_table, make_brlt_section): New functions.
60         (Target_powerpc::struct Sort_sections, class Branch_info): New.
61         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
62         branch_info_): New vars.
63         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
64         make call stubs here.
65         (Output_data_glink): Remove all call stub handling from this class.
66         (Target_powerpc::Scan::local, global): Save interesting branch
67         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
68         (Target_powerpc::do_finalize_sections): Only make reg save/restore
69         functions on final link.
70         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
71         Handle long branch destinations too.
72         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
73         do_plt_address_for_local): Adjust lookup of plt call stubs.
74
75 2012-11-30  Alan Modra  <amodra@gmail.com>
76
77         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
78         relocs against protected symbols when building 32-bit shared libs.
79
80 2012-11-30  Alan Modra  <amodra@gmail.com>
81
82         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
83         param.  Call got_section() to make .got.  Update all callers
84         and their callers and so on.
85
86 2012-11-30  Alan Modra  <amodra@gmail.com>
87
88         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
89         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
90         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
91         value if it already exists.
92
93 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
94
95         PR gold/14858
96         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
97
98 2012-11-14  Roland McGrath  <mcgrathr@google.com>
99
100         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
101         than bfc instruction for data sandboxing.
102
103 2012-11-08  Alan Modra  <amodra@gmail.com>
104
105         * po/POTFILES.in: Regenerate.
106
107 2012-11-05  Alan Modra  <amodra@gmail.com>
108
109         * configure.ac: Apply 2012-09-10 change to config.in here.
110         * configure: Regenerate.
111
112 2012-11-05  Alan Modra  <amodra@gmail.com>
113
114         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
115         (struct Opd_ent): Use "Address" rather than "Offset".
116         (Output_data_got_powerpc::got_base_offset): Return Valtype.
117         (Target_powerpc::got_section): Make public.
118         (Target_powerpc::scan_relocs): Move code setting symbols..
119         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
120         Create _SDA_BASE_ only when referenced.
121
122 2012-11-02  Roland McGrath  <mcgrathr@google.com>
123
124         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
125         from last change.
126
127 2012-11-01  Roland McGrath  <mcgrathr@google.com>
128
129         * target.h (Sized_target::relocate_relocs): Use Elf_Off
130         for offset_in_output_section parameter.
131         (Sized_target::relocate_special_relocatable): Likewise.
132         * arm.cc (Target_arm::relocate_relocs): Likewise.
133         (Target_arm::relocate_special_relocatable): Likewise.
134         * i386.cc (Target_i386::relocate_relocs): Likewise.
135         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
136         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
137         * target-reloc.h (relocate_relocs): Likewise.
138         * testsuite/testfile.cc (Target_test): Likewise.
139         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
140         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
141
142         * system.h: Move inclusion of <clocale> to after <libintl.h> in
143         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
144
145         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
146         parameter, which is unused in the [!F_SETFD] case.
147
148         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
149         SYMNDX to off_t before comparing it to this->data_size().
150         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
151         * incremental.cc (Output_section_incremental_inputs::do_write):
152         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
153
154         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
155
156 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
157
158         * gold.cc (Target_arm::do_adjust_elf_header): Add the
159         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
160         in EABI_VER5.
161
162 2012-10-29  Cary Coutant  <ccoutant@google.com>
163
164         * dwp.cc (usage): Add file and exit status parameters;
165         add --help and --version options.
166         (print_version): New function.
167         (main): Add --help and --version options.
168
169 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
170
171         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
172         final_layout_sequence.txt.
173         * testsuite/Makefile.in: Regenerated.
174
175 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
176
177         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
178         COMPILE generated by automake.
179         (LINK1): Likewise.
180         (CXXCOMPILE1): Likewise.
181         (CXXLINK1): Likewise.
182         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
183         (LINK): Likewise.
184         (CXXCOMPILE): Likewise.
185         (CXXLINK): Likewise.
186         * testsuite/Makefile.in: Regenerated.
187
188 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
189
190         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
191         on bad fwrite return.
192
193 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
194
195         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
196         on val.
197
198 2012-10-23  Cary Coutant  <ccoutant@google.com>
199
200         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
201         * testsuite/Makefile.in: Regenerate.
202         * testsuite/dwp_test.h: New source file.
203         * testsuite/dwp_test_1.cc: New source file.
204         * testsuite/dwp_test_1.s: New source file.
205         * testsuite/dwp_test_1.sh: New source file.
206         * testsuite/dwp_test_1b.cc: New source file.
207         * testsuite/dwp_test_1b.s: New source file.
208         * testsuite/dwp_test_2.cc: New source file.
209         * testsuite/dwp_test_2.s: New source file.
210         * testsuite/dwp_test_2.sh: New source file.
211         * testsuite/dwp_test_main.cc: New source file.
212         * testsuite/dwp_test_main.s: New source file.
213
214 2012-10-23  Cary Coutant  <ccoutant@google.com>
215
216         * dwp.h: New header file.
217         * dwp.cc: New source file.
218         * gold.h: Move shared declarations to system.h.
219         * system.h: New header file.
220         * Makefile.am: Add dwp.
221         * Makefile.in: Regenerate.
222
223 2012-10-23  Cary Coutant  <ccoutant@google.com>
224
225         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
226         Dwarf_info_reader::read_from_pointer.
227         (Dwarf_pubnames_table::read_header): Likewise.
228         (Dwarf_pubnames_table::next_name): Likewise.
229         (Dwarf_die::read_attributes): Likewise.
230         (Dwarf_die::skip_attributes): Likewise.
231         (Dwarf_info_reader::read_from_pointer): New function template.
232         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
233         (Dwarf_pubnames_table): Likewise.
234         (Dwarf_info_reader::read_from_pointer): New function template.
235         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
236         Dwarf_pubnames_table ctor.
237
238 2012-10-23  Cary Coutant  <ccoutant@google.com>
239
240         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
241         abbrev_shndx.
242         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
243         abbrev_shndx_.
244         (Dwarf_info_reader::set_abbrev_shndx): New method.
245         (Dwarf_info_reader::abbrev_shndx_): New data member.
246
247 2012-10-23  Cary Coutant  <ccoutant@google.com>
248
249         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
250         from object, not parameters.
251         (Dwarf_info_reader::parse): Likewise.
252         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
253         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
254         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
255         methods.
256
257 2012-10-23  Cary Coutant  <ccoutant@google.com>
258
259         * fileread.cc (Input_file::Input_file): New constructor.
260         * fileread.h (class Input_file): Add new constructor.
261
262 2012-10-18  Alan Modra  <amodra@gmail.com>
263
264         PR gold/14727
265         * object.cc (Relobj::is_section_name_included): Also match
266         .sdata personality section.
267
268 2012-10-18  Alan Modra  <amodra@gmail.com>
269
270         * target-reloc.h (class Default_comdat_behavior): New, package up..
271         (get_comdat_behaviour): ..this.
272         (relocate_section): Add Relocate_comdat_behavior template arg,
273         adjust code to suit.
274         * arm.cc (Target_arm::relocate_section): Adjust to suit.
275         (Target_arm::scan_reloc_section): Likewise.
276         * i386.cc (Target_i386::relocate_section): Likewise.
277         * sparc.cc (Target_sparc::relocate_section): Likewise.
278         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
279         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
280         * powerpc.cc (class Relocate_comdat_behavior): New.
281         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
282         gold::relocate_section with new template arg.
283
284 2012-10-18  Alan Modra  <amodra@gmail.com>
285
286         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
287         dynamic relocs for GOT_TPREL got entries, without symbol if
288         resolving locally.
289         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
290         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
291         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
292
293 2012-10-17  Alan Modra  <amodra@gmail.com>
294
295         PR gold/14726
296         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
297
298 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
299
300         * layout.cc (Layout::include_section): Keep sections marked
301         SHF_EXCLUDE when doing relocatable links.
302
303 2012-10-16  Alan Modra  <amodra@gmail.com>
304
305         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
306         (Target_powerpc::do_finalize_sections): Call it.
307         (Output_data_save_res): New class and supporting functions.
308         (Target_powerpc::symval_for_branch): Only look up .opd entry for
309         normal symbols defined in object files.
310
311 2012-10-12  Alan Modra  <amodra@gmail.com>
312
313         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
314         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
315         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
316         section if scan_opd_relocs not yet called.
317         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
318
319 2012-10-12  Alan Modra  <amodra@gmail.com>
320
321         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
322         add_local_ifunc_entry): Revert last change.
323         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
324
325 2012-10-05  Alan Modra  <amodra@gmail.com>
326
327         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
328         do_plt_address_for_global): New functions.
329         (Output_data_got_powerpc::do_write): Don't segfault when linking
330         statically.
331         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
332         add_local_ifunc_entry): Return true on adding entry..
333         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
334         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
335         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
336         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
337         set up symbols here.
338         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
339         syms here.  Do so even when no .iplt.  Don't segfault when linking
340         statically.
341         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
342         new variants without reloc param.
343         (Glink_sym_ent::Glink_sym_ent): Likewise.
344         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
345         reloc when refs will resolve to plt call stub.
346         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
347         R_PPC_PLTREL24 to resolve locally.
348         (Target_powerpc::Scan::global): Correct ifunc handling.
349         (Target_powerpc::Relocate::relocate): Correct local sym glink
350         lookup.  Don't destroy "value" when we have a plt call stub,
351         and when checking plt call validity.
352         (Target_powerpc::do_dynsym_value): Simplify.
353
354 2012-10-05  Alan Modra  <amodra@gmail.com>
355
356         * i386.cc (Output_data_plt_i386::address_for_global,
357         address_for_local): Add plt offset to returned value.  Adjust uses.
358         * sparc.cc (Output_data_plt_sparc::address_for_global,
359         address_for_local): Likewise.
360         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
361         address_for_local): Likewise.
362         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
363         address_for_local): Likewise.
364         * target.h (Target::plt_address_for_global, plt_address_for_local):
365         Update comment.
366         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
367         (Output_data_got::Got_entry::write): Nor here.
368         * output.h: Comment fix.
369
370 2012-10-02  Jiong Wang  <jiwang@tilera.com>
371
372         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
373         global_offset_table_ value for larget got.
374         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
375
376 2012-09-29  Alan Modra  <amodra@gmail.com>
377
378         * powerpc.cc (Target_powerpc::iplt_): New output section.
379         (Target_powerpc::iplt_section, make_iplt_section,
380         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
381         (Target_powerpc::make_plt_entry): Handle ifunc syms.
382         Target_powerpc::plt_entry_count): Count iplt entries too.
383         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
384         reloc section in constructor.  New params.
385         (Target_powerpc::make_plt_section): Create reloc section here instead.
386         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
387         functions.
388         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
389         (Output_data_glink::add_entry, find_entry): New functions to
390         deal with local syms.
391         (Glink_sym_ent): Add support for local syms.
392         (Output_data_glink::do_write): Handle ifunc plt entries.
393         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
394         (Target_powerpc::Scan::local, global): Handle ifunc syms.
395         (Target_powerpc::Relocate::relocate): Likewise.
396         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
397
398 2012-09-25  Alan Modra  <amodra@gmail.com>
399
400         * object.h (Sized_relobj_file::adjust_local_symbol,
401         do_adjust_local_symbol): New functions.
402         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
403         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
404         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
405         and irregular opd entry spacing.
406         (Powerpc_relobj::do_read_relocs): Add opd size checks.
407         (Global_symbol_visitor_opd): New functor.
408         (Target_powerpc::do_finalize_sections): Omit global symbols defined
409         on deleted opd entries.
410
411 2012-09-15  Jiong Wang  <jiwang@tilera.com>
412
413         * tilegx.cc: New file.
414         * Makefile.am (TARGETSOURCES): Add tilegx.cc
415         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
416         * configure.tgt: Add entries for tilegx*.
417         * configure.ac: Likewise.
418         * Makefile.in: Rebuild.
419         * configure: Likewise.
420         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
421         tilegx.
422
423 2012-09-13  Alan Modra  <amodra@gmail.com>
424
425         * target-reloc.h (scan_relocs): Call scan.local for relocs
426         against symbols in discarded sections.  Pass is_discarded
427         param.
428         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
429         Add is_discarded param.
430         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
431         is_discarded to flag opd entry as discarded.  Don't emit dyn
432         relocs on such entries.
433         (Target_powerpc::Scan::global): Similarly detect and handle
434         such opd entries.
435         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
436         opd_ent_.  Update all uses.
437         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
438         (Target_powerpc::relocate_section): Zero out discarded opd
439         entry relocs.
440
441 2012-09-12  Ian Lance Taylor  <iant@google.com>
442
443         PR gold/14570
444         * output.cc: Rename Output_data_got template parameter from size
445         to got_size for all functions.  Compile all variants of
446         Output_data_got.
447         (Output_data_got::Got_entry::write): Correct use of size for
448         symbol value.  Use local_is_tls rather than casting to
449         Sized_relobj_file.
450         * object.h (class Object): Add local_is_tls and do_local_is_tls.
451         (class Sized_relobj_file): Add do_local_is_tls.
452         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
453
454 2012-09-11  Alan Modra  <amodra@gmail.com>
455
456         PR gold/14566
457         * layout.cc (Layout::set_segment_offsets): When using
458         common-page-size alignment, ensure we are on a new max-page-size
459         page.
460         * output.cc (Output_segment::set_section_addresses): Use
461         abi_pagesize, not common_pagesize for relro boundary.
462         (Output_segment::set_offset): Likewise.
463
464 2012-09-11  Alan Modra  <amodra@gmail.com>
465
466         * output.h (Output_data_got::add_global_tls, add_local_tls,
467         add_local_tls_pair): New functions.
468         (Output_data_got::add_local_pair_with_rel): Remove second
469         reloc param.  Expand comment.
470         (Output_data_got::Got_entry): Rename use_plt_offset_ to
471         use_plt_or_tls_offset_, similarly for constructor param.
472         (Output_data_got::Got_entry::write): Add got_index param.
473         * output.cc (Output_data_got::add_global_tls, add_local_tls,
474         add_local_tls_pair): New functions.
475         (Output_data_got::Got_entry::write): Handle tls symbols
476         with use_plt_or_tls_offset_ set specially.
477         (Output_data_got::add_local_pair_with_rel): Only one reloc.
478         (Output_data_got::do_write): Replace iterator with index, pass
479         index to entry write function.
480         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
481         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
482         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
483         call.
484         * i386.cc (Target_i386::Scan::local): Likewise.
485         * sparc.cc (Target_sparc::Scan::local): Likewise.
486         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
487         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
488         do_tls_offset_for_global): New functions.
489         (Target_powerpc::Scan::local): Correct TLS relocations and got
490         entry values.
491         (Target_powerpc::Scan::global): Don't emit unnecessary
492         dynamic relocations on TLS GOT entries.
493
494 2012-09-10  Matthias Klose  <doko@ubuntu.com>
495
496         * config.in: Disable sanity check for kfreebsd.
497
498 2012-09-10  Sterling Augustine  <saugustine@google.com>
499
500         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
501         (Gdb_index::pubtypes_read): New parameter.
502         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
503         to calls.
504         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
505         pubtypes_object_.
506
507 2012-09-09  Alan Modra  <amodra@gmail.com>
508
509         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
510         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
511         * gc.h (gc_process_relocs): Call target gc_add_reference.
512         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
513         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
514         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
515         unnecessary cast.
516         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
517         to cater for when we don't need code offset.  Update use.
518         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
519         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
520         set_opd_valid): New functions.
521         (Target_powerpc::do_gc_add_reference): New function.
522         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
523         stashed refs.
524         (Target_powerpc::do_gc_mark_symbol): New function.
525
526 2012-09-06  Cary Coutant  <ccoutant@google.com>
527
528         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
529         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
530         (Dwarf_die::skip_attributes): Likewise.
531         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
532         * testsuite/gdb_index_test.cc (inline_func_1): New function.
533         (main): Call it.
534         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
535
536 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
537
538         * testsuite/script_test_3.t: Add .got.plt output section
539         statement.
540         * testsuite/script_test_4.t: Likewise.
541
542 2012-09-05  Alan Modra  <amodra@gmail.com>
543
544         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
545         update all uses and lose "enum" when using type.
546
547 2012-09-05  Alan Modra  <amodra@gmail.com>
548
549         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
550         * configure: Regenerate.
551         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
552         (plugin_final_layout.stdout): Likewise.
553         (memory_test): Set page sizes to 0x1000.
554         * testsuite/Makefile.in: Regenerate.
555         * testsuite/discard_locals_test.sh: Add FIXME comment.
556         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
557         * testsuite/pr14265.t: Add .got output section statement.
558         * testsuite/script_test_2.t: Likewise.
559         * testsuite/script_test_3.t: Likewise.
560         * testsuite/script_test_4.t: Likewise.
561         * testsuite/script_test_5.t: Likewise.
562         * testsuite/script_test_6.t: Likewise.
563         * testsuite/script_test_7.t: Likewise.
564         * testsuite/script_test_9.t: Likewise.
565
566 2012-09-05  Alan Modra  <amodra@gmail.com>
567
568         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
569         (Powerpc_relocate_functions::Status): New typedef.
570         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
571         (Target_powerpc::Scan::local): Handle REL64.
572         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
573         for REL32 and REL64.
574         (Target_powerpc::symval_for_branch): New function, extracted from..
575         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
576         checks.  Report overflow errors.
577
578 2012-09-05  Alan Modra  <amodra@gmail.com>
579
580         * object.h (Sized_relobj_file::emit_relocs): Delete.
581         (Sized_relobj_file::emit_relocs_reltype): Delete.
582         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
583         relocate_relocs for --emit-relocs.
584         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
585         * output.h: Update comment.
586         (Output_segment::first_section): New function.
587         (Output_segment::first_section_load_address): Use first_section.
588         * output.cc (Output_segment::first_section): New function extracted..
589         (Output_segment::first_section_load_address): ..from here.  Delete.
590         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
591         * target.h (Sized_target::relocate_for_relocatable): Likewise.
592         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
593         adjust call to target.h function.
594         * i386.cc (Target_i386): Likewise.
595         * sparc.cc (Target_sparc): Likewise.
596         * x86_64.cc (Target_x86_64): Likewise.
597         * powerpc.cc (Target_powerpc): Likewise.
598         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
599         first tls section has section symbol for optimised local dynamic
600         output relocs.
601         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
602         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
603         optimised tls code.
604         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
605         Rename to relocate_relocs.  Update error message.
606
607 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
608
609         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
610         --just-symbols.
611
612 2012-08-31  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
615         (Powerpc_relobj::toc_base_offset): New stub function.
616         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
617         got_mod_index_offset to tlsld_got_offset.  Update all refs.
618         (Target_powerpc::Relocate::enum skip_tls): New.
619         (Target_powerpc::call_tls_get_addr_): New var.
620         (Target_powerpc::is_branch_reloc): Move to file scope.
621         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
622         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
623         New functions.
624         (Target_powerpc::enum Got_type): Delete old values, add new ones.
625         (powerpc_info): Correct common_pagesize for ppc64.
626         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
627         (Powerpc_relocate_functions): Add overflow check enums and functions.
628         Add non-shift version of rela, rela_ua.  Delete all rel public
629         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
630         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
631         addr16_ha3, addr14 functions.
632         (Output_data_got_powerpc::add_constant_pair): New function.
633         (Output_data_got_powerpc::got_base_offset): Likewise.
634         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
635         (instruction constants): Sort, add some more.
636         (Output_data_glink::do_write): Add and use Address typedef.  Use
637         object->toc_base_offset() stub for 64-bit.
638         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
639         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
640         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
641         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
642         Always treat .opd relocs as against locally defined symbol.
643         Correct condition for RELATIVE relocs.
644         (Target_powerpc::do_finalize_sections): Test for NULL sections.
645         (Target_powerpc::Relocate::relocate): Use plt call stub as value
646         for 32-bit syms with a plt entry.  Correct ppc64 toc base
647         calculations.  Handle TLS relocs, and more.  Add overflow
648         checking and adjust for Powerpc_relocate_functions changes.
649         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
650         Reinstate --emit-relocs code with FIXME.
651
652 2012-08-30  Alan Modra  <amodra@gmail.com>
653
654         * layout.cc (Layout::set_segment_offsets): Set p_align to
655         abi_pagesize, not common_pagesize.
656         (Layout::relaxation_loop_body): Similarly use abi_pagesize
657         to determine whether file header can go in segment.
658
659 2012-08-30  Alan Modra  <amodra@gmail.com>
660
661         * output.h (Output_reloc::Output_reloc <output section>): Add
662         is_relative param.  Adjust calls.
663         (Output_reloc::add_output_section_relative): New functions.
664         * output.cc (Output_reloc::Output_reloc <output section>): Handle
665         is_relative.
666         (Output_reloc::symbol_value): Handle SECTION_CODE.
667
668 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
669
670         * gold.cc (queue_middle_tasks): Call layout again when unique
671         segments for sections is desired.
672         * layout.cc (Layout::Layout): Initialize new members.
673         (Layout::get_output_section_flags): New function.
674         (Layout::choose_output_section): Call get_output_section_flags.
675         (Layout::layout): Make output section for mapping to a unique segment.
676         (Layout::insert_section_segment_map): New function.
677         (Layout::attach_allocated_section_to_segment): Make unique segment for
678         output sections marked so.
679         (Layout::segment_precedes): Check for unique segments when sorting.
680         * layout.h (Layout::Unique_segment_info): New struct.
681         (Layout::Section_segment_map): New typedef.
682         (Layout::insert_section_segment_map): New function.
683         (Layout::get_output_section_flags): New function.
684         (Layout::is_unique_segment_for_sections_specified): New function.
685         (Layout::set_unique_segment_for_sections_specified): New function.
686         (Layout::unique_segment_for_sections_specified_): New member.
687         (Layout::section_segment_map_): New member.
688         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
689         Rename is_gc_pass_one to is_pass_one.
690         Rename is_gc_pass_two to is_pass_two.
691         Rename is_gc_or_icf to is_two_pass.
692         Check for which pass based on whether symbols data is present.
693         Make it two pass when unique segments for sections is desired.
694         * output.cc (Output_section::Output_section): Initialize new
695         members.
696         * output.h (Output_section::is_unique_segment): New function.
697         (Output_section::set_is_unique_segment): New function.
698         (Output_section::is_unique_segment_): New member.
699         (Output_section::extra_segment_flags): New function.
700         (Output_section::set_extra_segment_flags): New function.
701         (Output_section::extra_segment_flags_): New member.
702         (Output_section::segment_alignment): New function.
703         (Output_section::set_segment_alignment): New function.
704         (Output_section::segment_alignment_): New member.
705         (Output_segment::Output_segment): Initialize is_unique_segment_.
706         (Output_segment::is_unique_segment): New function.
707         (Output_segment::set_is_unique_segment): New function.
708         (Output_segment::is_unique_segment_): New member.
709         * plugin.cc (allow_unique_segment_for_sections): New function.
710         (unique_segment_for_sections): New function.
711         (Plugin::load): Add new functions to transfer vector.
712         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
713         * Makefile.in: Regenerate.
714         * testsuite/plugin_final_layout.sh: Check if unique segment
715         functionality works.
716         * testsuite/plugin_section_order.c (onload): Check if new interfaces
717         are available.
718         (allow_unique_segment_for_sections): New global.
719         (unique_segment_for_sections): New global.
720         (claim_file_hook): Call allow_unique_segment_for_sections.
721         (all_symbols_read_hook): Call unique_segment_for_sections.
722
723 2012-08-22  Cary Coutant  <ccoutant@google.com>
724
725         * layout.cc (Layout::include_section): Don't assert on GROUP
726         sections with --emit-relocs.
727
728 2012-08-21  Cary Coutant  <ccoutant@google.com>
729
730         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
731         if --export-dynamic-symbol names an undef symbol.
732
733 2012-08-18  Alan Modra  <amodra@gmail.com>
734
735         * powerpc.cc: Formatting and white space.
736         (Powerpc_relobj): Rename got2_section_ to special_.
737         Add opd_ent_shndx_ and opd_ent_off_ vectors.
738         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
739         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
740         (Target_powerpc): Add Address typedef and invalid_address.  Use
741         throughout.
742         (Target_powerpc::is_branch_reloc): New function.
743         (Powerpc_relocate_functions): Add Address typedef, use throughout.
744         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
745         for dst_mask, value and addend.
746         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
747         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
748         (Output_data_glink::do_write): Correct toc base.  Don't try to use
749         uint16_t for 24-bit offset.  Use get_output_section_offset and
750         check return.
751         (Target_powerpc::Scan::local): Handle more relocs.
752         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
753         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
754         Plug in toc restoring insn after plt calls.  Translate branches
755         to function descriptor symbols to corresponding entry point.
756         (Target_powerpc::relocate_for_relocatable): Check return from
757         get_output_section_offset.
758         * symtab.h: Comment typo.
759
760 2012-08-14  Ian Lance Taylor  <iant@google.com>
761
762         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
763         unsupported_relocal_local to call unsupported_reloc_global.
764
765 2012-08-14  Nick Clifton  <nickc@redhat.com>
766
767         PR ld/14265
768         * script-sections.cc (Sections_element::output_section_name): Add
769         keep return parameter.
770         (Output_section_element::match_name): Add keep return parameter.
771         Return the value of the keep_ member.
772         * script-sections.h (class Output_section): Update
773         output_section_name prototype.
774         * layout.cc (Layout::keep_input_section): New public member
775         function.
776         (Layout::choose_output_section): Pass keep parameter to
777         output_section_name.
778         * layout.h (class Layout): Add keep_input_section.
779         * object.cc (Sized_relobj_file::do_layout): Check for kept input
780         sections.
781         * testsuite/Makefile.am: Add a test.
782         * testsuite/Makefile.in: Regenerate.
783         * testsuite/pr14265.c: Source file for the test.
784         * testsuite/pr14265.t: Linker script for the test.
785         * testsuite/pr14265.sh: Shell script for the test.
786
787 2012-08-14  Alan Modra  <amodra@gmail.com>
788
789         * target.h (Target::output_section_name): New function.
790         (Target::do_output_section_name): New function.
791         * layout.cc (Layout::choose_output_section): Call the above.
792         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
793
794 2012-08-14  Alan Modra  <amodra@gmail.com>
795
796         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
797         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
798         for replace_constant call.
799         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
800         (Output_data_glink::do_print_to_mapfile): New function.
801         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
802         (Target_powerpc::Relocate::relocate): Likewise.
803
804 2012-08-14  Alan Modra  <amodra@gmail.com>
805
806         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
807         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
808         (Output_data_glink::add_entry,find_entry): Remove shndx param.
809         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
810         all references to shndx_.  Handle special case for R_PPC_PLTREL24
811         here.
812         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
813         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
814         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
815         here.
816         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
817         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
818
819 2012-08-12  Alan Modra  <amodra@gmail.com>
820
821         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
822         (glink insn constants): Use uint32_t.
823         (Output_data_glink::add_entry): Use insert, not [] operator.
824
825 2012-08-11  Alan Modra  <amodra@gmail.com>
826
827         * object.h (Sized_relobj_file::find_shdr): New function.
828         (Sized_relobj_file::find_special_sections): New function.
829         * object.cc (Sized_relobj_file::find_shdr): New function.
830         (Sized_relobj_file::find_eh_frame): Use find_shdr.
831         (Sized_relobj_file::find_special_sections): New function, split out..
832         (Sized_relobj_file::do_read_symbols): ..from here.
833         * output.h (Output_data_got::replace_constant): New function.
834         (Output_data_got::num_entries): New function.
835         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
836         (Output_data_got::got_offset): Protected rather than private.
837         (Output_data_got::replace_got_entry): New function.
838         * output.cc (Output_data_got::replace_got_entry): New function.
839         * powerpc.cc (class Powerpc_relobj): New.
840         (class Powerpc_relocate_functions): Delete all psymval variants or
841         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
842         Implement _ha functions using corresponding _hi function.
843         (Powerpc_relobj::find_special_sections): New function.
844         (Target_powerpc::do_make_elf_object): New function.
845         (class Output_data_got_powerpc): New.
846         (class Output_data_glink): New.
847         (class Powerpc_scan_relocatable_reloc): New.
848         Many more changes througout file.
849
850 2012-08-09  Nick Clifton  <nickc@redhat.com>
851
852         * po/vi.po: Updated Vietnamese translation.
853
854 2012-08-07  Ian Lance Taylor  <iant@google.com>
855
856         * layout.cc (Layout::add_target_dynamic_tags): If
857         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
858         plt_rel.
859
860 2012-07-30  Nick Clifton  <nickc@redhat.com>
861
862         * po/gold.pot: Updated template.
863         * po/es.po: Updated Spanish translation.
864
865 2012-07-18  Cary Coutant  <ccoutant@google.com>
866
867         PR gold/14344
868         * configure.ac: Add check for -gpubnames support.
869         * configure: Regenerate.
870         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
871         support; force -gno-pubnames.
872         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
873         support.
874         (gdb_index_test_4): New test.
875         * testsuite/Makefile.in: Regenerate.
876         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
877         * testsuite/gdb_index_test_2.sh: Likewise.
878         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
879         * testsuite/gdb_index_test_4.sh: New script.
880         * testsuite/gdb_index_test_comm.sh: New script with common code;
881         don't look for space after colon.
882
883 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
884
885         * gold.cc (queue_middle_tasks): Update function order only after
886         deferred objects due to plugins are processed.
887
888 2012-07-11  Ian Lance Taylor  <iant@google.com>
889
890         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
891         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
892         (Target_arm::scan_reloc_for_stub): Likewise.
893         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
894         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
895         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
896         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
897         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
898
899 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
900             Ian Lance Taylor  <iant@google.com>
901
902         PR gold/14309
903         * configure.ac: Test whether std::tr1::hash<off_t> works.
904         * gold.h: Add a specialization for std::tr1::hash<off_t> if
905         needed.
906         * output.h (class Output_fill): Add virtual destructor.
907         * configure, config.in: Rebuild.
908
909 2012-06-22  Roland McGrath  <mcgrathr@google.com>
910
911         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
912
913 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
914
915         * plugin.cc (Plugin::load): Handle position independent executables.
916
917 2012-06-06  Cary Coutant  <ccoutant@google.com>
918
919         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
920         add .debug_macro.
921         (lines_only_debug_sections): Likewise.
922         (gdb_fast_lookup_sections): New static array.
923         (is_gdb_debug_section): Rename formal parameter.
924         (is_lines_only_debug_section): Likewise.
925         (is_gdb_fast_lookup_section): New function.
926         (Layout::include_section): Check for ".zdebug_" prefix; pass
927         section name suffix to is_gdb_debug_section, et al.; check for
928         fast-lookup sections when building .gdb_index.
929         * options.h (--strip-debug-gdb): Update GDB version number.
930
931 2012-06-06  Cary Coutant  <ccoutant@google.com>
932
933         * configure.ac: Add check for fallocate.
934         * configure: Regenerate.
935         * config.in: Regenerate.
936
937         * options.h (class General_options): Add --mmap-output-file and
938         --posix-fallocate options.
939         * output.cc: (posix_fallocate): Remove; replace with...
940         (gold_fallocate): New function.
941         (Output_file::map_no_anonymous): Call gold_fallocate.
942         (Output_file::map): Check --mmap-output-file option.
943
944 2012-06-05  Jing Yu  <jingyu@google.com>
945
946         * gold.h (textdomain): Add do {} to empty while(0).
947         (bindtextdomain): Likewise.
948
949 2012-06-04  Cary Coutant  <ccoutant@google.com>
950
951         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
952         has_dynsym_index.
953
954 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
955
956         * symtab.cc (Symbol_table::define_special_symbol):
957         Initialize *poldsym to prevent uninitialized variable errors.
958
959 2012-05-23  Cary Coutant  <ccoutant@google.com>
960
961         * layout.cc (Layout::section_name_mapping): Add rules to handle
962         exact match on .data.rel.ro.local or .data.rel.ro.
963         (Layout::output_section_name): Check for exact matches.
964
965 2012-05-23  Cary Coutant  <ccoutant@google.com>
966
967         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
968         more carefully.
969
970 2012-05-22  Cary Coutant  <ccoutant@google.com>
971
972         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
973         object before exporting symbol.
974
975 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
976
977         * testsuite/tls_test.cc: Include "config.h" first.
978         * testsuite/tls_test_c.c: Likewise.
979
980 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
981             Nick Clifton  <nickc@redhat.com>
982
983         PR 14072
984         * configure.in: Add check that sysdep.h has been included before
985         any system header files.
986         * configure: Regenerate.
987         * config.in: Regenerate.
988
989 2012-05-14  Cary Coutant  <ccoutant@google.com>
990
991         * layout.cc (Layout::make_output_section): Mark .tdata section
992         as RELRO.
993         * testsuite/relro_test.cc: Add a TLS variable.
994
995 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
996
997         PR gold/14091
998         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
999         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1000         R_X86_64_64.
1001
1002 2012-05-08  Cary Coutant  <ccoutant@google.com>
1003
1004         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1005         (lines_only_debug_sections): Likewise.
1006
1007 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1008
1009         * nacl.cc: New file.
1010         * nacl.h: New file.
1011         * Makefile.am (CCFILES, HFILES): Add them.
1012         * Makefile.in: Regenerate.
1013         * i386.cc (Output_data_plt_i386_nacl): New class.
1014         (Output_data_plt_i386_nacl_exec): New class.
1015         (Output_data_plt_i386_nacl_dyn): New class.
1016         (Target_i386_nacl): New class.
1017         (Target_selector_i386_nacl): New class.
1018         (target_selector_i386): Use it instead of Target_selector_i386.
1019         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1020         (Target_x86_64_nacl): New class.
1021         (Target_selector_x86_64_nacl): New class.
1022         (target_selector_x86_64, target_selector_x32): Use it instead of
1023         Target_selector_x86_64.
1024         * arm.cc (Output_data_plt_arm_nacl): New class.
1025         (Target_arm_nacl): New class.
1026         (Target_selector_arm_nacl): New class.
1027         (target_selector_arm, target_selector_armbe): Use it instead of
1028         Target_selector_arm.
1029
1030         * target-select.cc (select_target): Take new Input_file* and off_t
1031         arguments, pass them on to recognize method of selector.
1032         * object.cc (make_elf_sized_object): Update caller.
1033         * parameters.cc (parameters_force_valid_target): Likewise.
1034         * incremental.cc (make_sized_incremental_binary): Likewise.
1035         * target-select.h: Update decl.
1036         (Target_selector::recognize): Take new Input_file* argument,
1037         pass it on to do_recognize.
1038         (Target_selector::do_recognize): Take new Input_file* argument.
1039         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1040         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1041         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1042         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1043
1044         * target.h (Target::Target_info): New members isolate_execinstr
1045         and rosegment_gap.
1046         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1047         * arm.cc (Target_arm::arm_info): Update initializer.
1048         * i386.cc (Target_i386::i386_info): Likewise.
1049         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1050         * sparc.cc (Target_sparc::sparc_info): Likewise.
1051         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1052         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1053         * layout.cc (Layout::attach_allocated_section_to_segment):
1054         Take new const Target* argument.  If target->isolate_execinstr(), act
1055         like --rosegment.
1056         (Layout::find_first_load_seg): Take new const Target* argument;
1057         if target->isolate_execinstr(), reject PF_X segments.
1058         (Layout::relaxation_loop_body): Update caller.
1059         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1060         reset file offset to zero when we hit LOAD_SEG, and then do a second
1061         loop over the segments before LOAD_SEG to reassign offsets after
1062         addresses have been determined.  Handle target->rosegment_gap().
1063         (Layout::attach_section_to_segment): Take new const Target* argument;
1064         pass it to attach_allocated_section_to_segment.
1065         (Layout::make_output_section): Update caller.
1066         (Layout::attach_sections_to_segments): Take new const Target* argument;
1067         pass it to attach_section_to_segment.
1068         * gold.cc (queue_middle_tasks): Update caller.
1069         * layout.h (Layout): Update method decls with new arguments.
1070
1071         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1072         Target_info pointer to use.
1073         (Target_arm::do_make_data_plt): New virtual method.
1074         (Target_arm::make_data_plt): New method that calls it.
1075         (Target_arm::make_plt_entry): Use it.
1076         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1077         for the section alignment.
1078         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1079         method.
1080         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1081         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1082         method.
1083         (Output_data_plt_arm::get_plt_entry_size): Call it.
1084         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1085         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1086         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1087         method.
1088         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1089         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1090         method instead of sizeof(plt_entry).
1091         (Output_data_plt_arm::add_entry): Likewise.
1092         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1093         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1094         than static method.
1095         (Target_arm::plt_entry_size): Likewise.
1096         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1097         Move to ...
1098         (Output_data_plt_arm_standard): ... here, new class.
1099         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1100         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1101         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1102
1103         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1104         Take additional argument for the PLT entry size.
1105         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1106         Use get_plt_entry_size method rather than plt_entry_size variable.
1107         (Output_data_plt_x86_64::reserve_slot): Likewise.
1108         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1109         (Output_data_plt_x86_64::add_entry): Likewise.
1110         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1111         (Output_data_plt_x86_64::address_for_global): Likewise.
1112         (Output_data_plt_x86_64::address_for_local): Likewise.
1113         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1114         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1115         Make method non-static.
1116         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1117         method.
1118         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1119         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1120         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1121         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1122         virtual method.
1123         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1124         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1125         virtual method.
1126         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1127         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1128         virtual method.
1129         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1130         (Output_data_plt_x86_64::plt_entry_size)
1131         (Output_data_plt_x86_64::first_plt_entry)
1132         (Output_data_plt_x86_64::plt_entry)
1133         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1134         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1135         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1136         (Output_data_plt_x86_64_standard): ... here, new class.
1137         (Target_x86_64::Target_x86_64): Take optional argument for the
1138         Target_info pointer to use.
1139         (Target_x86_64::do_make_data_plt): New virtual method.
1140         (Target_x86_64::make_data_plt): New method to call it.
1141         (Target_x86_64::init_got_plt_for_update): Use that.
1142         Call this->plt_->add_eh_frame method here.
1143         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1144         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1145         rather than static method.
1146         (Target_x86_64::plt_entry_size): Likewise.
1147         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1148         rather than plt_entry_size variable.  Move guts of PLT filling to...
1149         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1150         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1151         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1152
1153         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1154         additional argument for the section alignment.
1155         Don't do add_eh_frame_for_plt here.
1156         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1157         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1158         variable.
1159         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1160         method.
1161         (Output_data_plt_i386::get_plt_entry_size): Call it.
1162         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1163         (Output_data_plt_i386::add_eh_frame): New method to call it.
1164         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1165         method.
1166         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1167         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1168         method.
1169         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1170         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1171         method instead of plt_entry_size.
1172         (Output_data_plt_i386::plt_entry_size)
1173         (Output_data_plt_i386::plt_eh_frame_fde_size)
1174         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1175         (Output_data_plt_i386_standard): ... here, new class.
1176         (Output_data_plt_i386_exec): New class.
1177         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1178         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1179         (Output_data_plt_i386::exec_plt_entry): Move to ...
1180         (Output_data_plt_i386_exec::plt_entry): ... here.
1181         (Output_data_plt_i386_dyn): New class.
1182         (Output_data_plt_i386::first_plt_entry): Move to ...
1183         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1184         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1185         (Output_data_plt_i386_dyn::plt_entry): ... here.
1186         (Target_i386::Target_i386): Take optional argument for the Target_info
1187         pointer to use.
1188         (Target_i386::do_make_data_plt): New virtual method.
1189         (Target_i386::make_data_plt): New method to call it.
1190         (Target_i386::make_plt_section): Use that.
1191         Call this->plt_->add_eh_frame method here.
1192         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1193         rather than plt_entry_size variable.
1194         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1195         (Output_data_plt_i386::address_for_local): Likewise.
1196         (Output_data_plt_i386::do_write): Likewise.
1197         Move guts of PLT filling to...
1198         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1199         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1200         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1201         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1202
1203 2012-05-01  Cary Coutant  <ccoutant@google.com>
1204
1205         * dwarf_reader.cc (Dwarf_die::read_attributes)
1206         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1207         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1208         * reduced_debug_output.cc
1209         (Output_reduced_debug_info_section::get_die_end): Remove
1210         DW_FORM_GNU_ref_index.  Add default case.
1211
1212 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1213
1214         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1215         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1216         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1217         DW_AT_high_pc as offset from DW_AT_low_pc.
1218
1219         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1220         * testsuite/Makefile.in: Regenerate.
1221         * testsuite/gdb_index_test_3.c: New test source file.
1222         * testsuite/gdb_index_test_3.sh: New test source file.
1223
1224 2012-04-25  Ian Lance Taylor  <iant@google.com>
1225
1226         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1227         pointer.
1228         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1229         as a class, not a struct.
1230         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1231         (Target_arm::apply_cortex_a8_workaround): Likewise.
1232         * gc.h: Declare Reloc_types as a struct, not a class.
1233         * object.h: Declare Symbols_data as a struct.
1234         * reloc.h: Declare Read_relocs_data as a struct.
1235         * target.h: Declare Relocate_info as a struct.
1236
1237 2012-04-24  David S. Miller  <davem@davemloft.net>
1238
1239         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1240         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1241         and R_SPARC_WPLT30.
1242
1243 2012-04-24  Cary Coutant  <ccoutant@google.com>
1244
1245         * incremental-dump.cc (find_input_containing_global): Replace
1246         magic number with symbolic constant.
1247         (dump_incremental_inputs): Update version number.
1248         * incremental.cc (Output_section_incremental_inputs): Update version
1249         number; import symbolic constants from Incremental_inputs_reader.
1250         (Incremental_inputs::create_data_sections): Align relocations
1251         section correctly for 64-bit targets.
1252         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1253         constants; add padding.
1254         (Output_section_incremental_inputs::write_header): Add assert for
1255         header_size.
1256         (Output_section_incremental_inputs::write_input_files): Add assert
1257         for input_entry_size.
1258         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1259         add assert for object_info_size, input_section_entry_size,
1260         global_sym_entry_size.
1261         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1262         for data structure sizes; use them.
1263         (Incremental_input_entry_reader): Import symbolic constants from
1264         Incremental_inputs_reader; use them.
1265
1266 2012-04-23  David S. Miller  <davem@davemloft.net>
1267
1268         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1269         and elf_flags_set_.
1270         (Target_sparc::Target_sparc): Initialize new fields.
1271         (Target_sparc::do_make_elf_object): New function.
1272         (Target_sparc::do_adjust_elf_header): New function.
1273
1274 2012-04-23  Cary Coutant  <ccoutant@google.com>
1275
1276         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1277         CU range table of gdb index.
1278
1279 2012-04-20  David S. Miller  <davem@davemloft.net>
1280
1281         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1282         instead of false.
1283
1284 2012-04-16  David S. Miller  <davem@davemloft.net>
1285
1286         * sparc.cc (Target_sparc::got_address): New function.
1287         (Sparc_relocate_functions::gdop_hix22): New function.
1288         (Sparc_relocate_functions::gdop_lox10): New function.
1289         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1290         relocs.
1291         (Target_sparc::Scan::local): Likewise if the global symbol is not
1292         preemptible and is not IFUNC.
1293         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1294         transformations for local and non-preemptible non-IFUNC global
1295         symbols.
1296
1297         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1298         writing out 64-bit part of ranges.
1299
1300         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1301         -fpic and -fpie respectively.
1302         * Makefile.in: Regenerate.
1303
1304         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1305         (Target_sparc::Target_sparc): Initialize new field.
1306         (Target_sparc::do_plt_section_for_global): New function.
1307         (Target_sparc::do_plt_section_for_local): New function.
1308         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1309         (Target_sparc::make_plt_section): New function, broken out of
1310         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1311         (Target_sparc::make_plt_entry): Call make_plt_section.
1312         (Target_sparc::make_local_ifunc_plt_entry): New function.
1313         (Target_sparc::rela_ifunc_section): New function.
1314         (Target_sparc::plt_section): Remove const.
1315         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1316         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1317         and ifunc_count_ fields.
1318         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1319         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1320         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1321         (Output_data_plt_sparc::rela_ifunc): New function.
1322         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1323         (Output_data_plt_sparc::has_ifunc_section): New function.
1324         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1325         (Output_data_plt_sparc::address_for_global): New function.
1326         (Output_data_plt_sparc::address_for_local): New function.
1327         (Output_data_plt_sparc::plt_index_to_offset): New function.
1328         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1329         and entry_count.
1330         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1331         entry_count.
1332         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1333         R_SPARC_JMP_IREL to switch.
1334         (Target_sparc::Scan::check_non_pic): Likewise.
1335         (Target_sparc::Scan::local): Handle IFUNC symbols.
1336         (Target_sparc::Scan::local): Likewise.
1337         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1338         and plt_address_for_local.
1339         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1340         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1341
1342         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1343         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1344         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1345         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1346         global relocs too.
1347         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1348         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1349         calls.
1350         * sparc.cc (Target_sparc::Scan::global): Likewise.
1351         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1352
1353 2012-04-16  Cary Coutant  <ccoutant@google.com>
1354
1355         * archive.cc (Library_base::should_include_member): Check for
1356         --export-dynamic-symbol.
1357         * options.h (class General_options): Add --export-dynamic-symbol.
1358         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1359         --export-dynamic-symbol.
1360         (Symbol_table::gc_mark_undef_symbols): Likewise.
1361         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1362
1363 2012-04-12  David S. Miller  <davem@davemloft.net>
1364
1365         * sparc.cc (Reloc::wdisp10): New relocation method.
1366         (Reloc::h34): Likewise.
1367         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1368         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1369         R_SPARC_WDISP10.
1370         (Target_sparc::Scan::local): Likewise.
1371         (Target_sparc::Scan::global): Likewise.
1372         (Target_sparc::Relocate::relocate): Likewise.
1373
1374 2012-04-09  Cary Coutant  <ccoutant@google.com>
1375
1376         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1377         low_pc == 0.
1378
1379 2012-04-06  Ian Lance Taylor  <iant@google.com>
1380
1381         * timer.cc: #include <unistd.h>.
1382
1383 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1384
1385         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1386         * config.in: Regenerate.
1387         * configure: Regenerate.
1388
1389 2012-04-05  Nick Clifton  <nickc@redhat.com>
1390
1391         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1392         (AM_LC_MESSAGES): Add.
1393         * aclocal.m4: Regenerate.
1394         * config.in: Regenerate.
1395         * configure: Regenerate.
1396
1397 2012-03-21  Cary Coutant  <ccoutant@google.com>
1398
1399         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1400         * Makefile.in: Regenerate.
1401         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1402         (Sized_elf_reloc_mapper::symbol_section): New function.
1403         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1404         (make_elf_reloc_mapper): New function.
1405         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1406         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1407         (Dwarf_abbrev_table::do_get_abbrev): New function.
1408         (Dwarf_ranges_table::read_ranges_table): New function.
1409         (Dwarf_ranges_table::read_range_list): New function.
1410         (Dwarf_pubnames_table::read_section): New function.
1411         (Dwarf_pubnames_table::read_header): New function.
1412         (Dwarf_pubnames_table::next_name): New function.
1413         (Dwarf_die::Dwarf_die): New function.
1414         (Dwarf_die::read_attributes): New function.
1415         (Dwarf_die::skip_attributes): New function.
1416         (Dwarf_die::set_name): New function.
1417         (Dwarf_die::set_linkage_name): New function.
1418         (Dwarf_die::attribute): New function.
1419         (Dwarf_die::string_attribute): New function.
1420         (Dwarf_die::int_attribute): New function.
1421         (Dwarf_die::uint_attribute): New function.
1422         (Dwarf_die::ref_attribute): New function.
1423         (Dwarf_die::child_offset): New function.
1424         (Dwarf_die::sibling_offset): New function.
1425         (Dwarf_info_reader::check_buffer): New function.
1426         (Dwarf_info_reader::parse): New function.
1427         (Dwarf_info_reader::do_parse): New function.
1428         (Dwarf_info_reader::do_read_string_table): New function.
1429         (Dwarf_info_reader::lookup_reloc): New function.
1430         (Dwarf_info_reader::get_string): New function.
1431         (Dwarf_info_reader::visit_compilation_unit): New function.
1432         (Dwarf_info_reader::visit_type_unit): New function.
1433         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1434         Sized_elf_reloc_mapper.
1435         (Sized_dwarf_line_info::symbol_section): Remove function.
1436         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1437         (Sized_dwarf_line_info::read_line_mappings): Remove object
1438         parameter, adjust callers.
1439         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1440         * dwarf_reader.h: Include <sys/types.h>.
1441         (class Track_relocs): Remove forward declaration.
1442         (class Elf_reloc_mapper): New class.
1443         (class Sized_elf_reloc_mapper): New class.
1444         (class Dwarf_abbrev_table): New class.
1445         (class Dwarf_range_list): New class.
1446         (class Dwarf_ranges_table): New class.
1447         (class Dwarf_pubnames_table): New class.
1448         (class Dwarf_die): New class.
1449         (class Dwarf_info_reader): New class.
1450         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1451         (Sized_dwarf_line_info::symbol_section): Remove member function.
1452         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1453         base class.
1454         * gdb-index.cc: New source file.
1455         * gdb-index.h: New source file.
1456         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1457         and .debug_types sections, call Layout::add_to_gdb_index.
1458         (Sized_relobj_incr::do_section_name): Implement.
1459         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1460         return type; Implement.
1461         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1462         return type.
1463         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1464         parameter list and return type.
1465         (Sized_incr_dynobj::do_section_contents): Likewise.
1466         * layout.cc: Include gdb-index.h.
1467         (Layout::Layout): Initialize gdb_index_data_.
1468         (Layout::init_fixed_output_section): Check for .gdb_index section.
1469         (Layout::add_to_gdb_index): New function. Instantiate.
1470         * layout.h: Add forward declaration for class Gdb_index.
1471         (Layout::add_to_gdb_index): New member function.
1472         (Layout::gdb_index_data_): New data member.
1473         * main.cc: Include gdb-index.h.
1474         (main): Print statistics for gdb index.
1475         * object.cc (Object::section_contents): Move code into
1476         do_section_contents.
1477         (need_decompressed_section): Check for sections needed when building
1478         gdb index.
1479         (build_compressed_section_map): Likewise.
1480         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1481         gdb index.
1482         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1483         sections; call Layout::add_to_gdb_index.
1484         (Sized_relobj_file::do_decompressed_section_contents): Call
1485         do_section_contents directly.
1486         * object.h (Object::do_section_contents): Adjust parameter list and
1487         return type.
1488         (Object::do_decompressed_section_contents): Call do_section_contents
1489         directly.
1490         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1491         return type.
1492         * options.h (class General_options): Add --gdb-index option.
1493         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1494         list and return type.
1495         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1496         * reloc.h (Track_relocs::checkpoint): New function.
1497         (Track_relocs::reset): New function.
1498
1499         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1500         New test cases.
1501         * testsuite/Makefile.in: Regenerate.
1502         * testsuite/gdb_index_test.cc: New test source file.
1503         * testsuite/gdb_index_test_1.sh: New test source file.
1504         * testsuite/gdb_index_test_2.sh: New test source file.
1505
1506 2012-03-19  Doug Kwan  <dougkwan@google.com>
1507
1508         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1509         (Target_arm::do_finalize_sections): Remove code which defines
1510         __exidx_start and __exidx_end.  Make symbol table parameter
1511         anonymous as it is not used.
1512         * gold.cc (queue_middle_tasks): Call target hook to define any
1513         target-specific symbols.
1514         * target.h (Target::define_standard_symbols): New method.
1515         (Target::do_define_standard_symbols): Same.
1516         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1517         * testsuite/Makefile.in: Regenerate.
1518         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1519         and __exidx_end.
1520         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1521         relocations are generated for __exidx_start and __exidx_end.
1522
1523 2012-03-16  Doug Kwan  <dougkwan@google.com>
1524
1525         * testsuite/Makefile.am: Disable test initpri3b.
1526         * testsuite/Makefile.in: Regenerate.
1527
1528 2012-03-15  Doug Kwan  <dougkwan@google.com>
1529
1530         * arm.cc (Target_arm::got_section): Make .got section read-only
1531         if -z now is given.
1532
1533 2012-03-15  Ian Lance Taylor  <iant@google.com>
1534
1535         PR gold/13850
1536         * layout.cc (Layout::make_output_section): Correctly mark
1537         SHT_INIT_ARRAY, et. al., as relro.
1538
1539 2012-03-14  Doug Kwan  <dougkwan@google.com>
1540
1541         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1542         dynamic relocations for protected symbols in shared objects.
1543
1544 2012-03-13  Ian Lance Taylor  <iant@google.com>
1545
1546         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1547         keep the larger alignment.
1548
1549 2012-03-12  Cary Coutant  <ccoutant@google.com>
1550
1551         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1552         handling of DW_LNE_define_file.
1553
1554 2012-03-12  Cary Coutant  <ccoutant@google.com>
1555
1556         * reduced_debug_output.cc
1557         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1558         codes to switch.
1559
1560 2012-02-29  Cary Coutant  <ccoutant@google.com>
1561
1562         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1563
1564 2012-02-29  Cary Coutant  <ccoutant@google.com>
1565
1566         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1567         Call Object::decompressed_section_contents.
1568         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1569         New dtor.
1570         (Sized_dwarf_line_info::buffer_start_): New data member.
1571         * merge.cc (Output_merge_data::do_add_input_section): Call
1572         Object::decompressed_section_contents.
1573         (Output_merge_string::do_add_input_section): Likewise.
1574         * object.cc (need_decompressed_section): New function.
1575         (build_compressed_section_map): Decompress sections needed later.
1576         (Sized_relobj_file::do_decompressed_section_contents): New function.
1577         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1578         * object.h (Object::decompressed_section_contents): New function.
1579         (Object::discard_decompressed_sections): New function.
1580         (Object::do_decompressed_section_contents): New function.
1581         (Object::do_discard_decompressed_sections): New function.
1582         (Compressed_section_info): New type.
1583         (Compressed_section_map): Include decompressed section contents.
1584         (Sized_relobj_file::do_decompressed_section_contents): New function.
1585         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1586
1587 2012-02-16  Cary Coutant  <ccoutant@google.com>
1588
1589         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1590         * testsuite/Makefile.in: Regenerate.
1591
1592 2012-02-14  Cary Coutant  <ccoutant@google.com>
1593
1594         * options.cc (General_options::finalize): Disallow -pie and -static.
1595
1596 2012-02-03  Doug Kwan  <dougkwan@google.com>
1597
1598         * arm.cc (Arm_relocate_functions::abs8,
1599         Arm_relocate_functions::abs16): Use
1600         Bits::has_signed_unsigned_overflow32.
1601         (Arm_relocate_functions::thm_abs8): Correct range of
1602         overflow check.
1603         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1604         in assertions.
1605
1606 2012-02-02  Doug Kwan  <dougkwan@google.com>
1607
1608         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1609         position independent outputs, not just shared objects.
1610
1611 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1612
1613         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1614         * configure: Regenerated.
1615
1616 2012-01-27  Ian Lance Taylor  <iant@google.com>
1617
1618         * reloc.h (Bits): New class with static functions, copied from
1619         namespace utils in arm.cc.
1620         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1621         instead.
1622
1623 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1624
1625         * incremental.cc (write_info_blocks): Correct relocation offset.
1626
1627 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1628
1629         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1630         (Relocate::tls_gd_to_le): Likewise.
1631
1632 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1633
1634         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1635
1636 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1637
1638         * configure.ac: Check if -mcmodel=medium works.
1639         * configure: Regenerated.
1640
1641 2012-01-24  Cary Coutant  <ccoutant@google.com>
1642
1643         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1644         definition and ...
1645         (read_unsigned_LEB_128_x): ... this new function.
1646         (read_signed_LEB_128): Replaced with inline definition and ...
1647         (read_signed_LEB_128_x): ... this new function.
1648         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1649         (read_unsigned_LEB_128): Add inline definition.
1650         (read_signed_LEB_128_x): New function.
1651         (read_signed_LEB_128): Add inline definition.
1652         * testsuite/Makefile.am (leb128_unittest): New unit test.
1653         * testsuite/Makefile.in: Regenerate.
1654         * testsuite/leb128_unittest.cc: New unit test.
1655
1656 2012-01-23  Ian Lance Taylor  <iant@google.com>
1657
1658         PR gold/13617
1659         * i386.cc (Target_i386::do_code_fill): When using a jmp
1660         instruction, pad with nop instructions.
1661         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1662
1663 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1664
1665         * x86_64.cc (gc_process_relocs): Add typename on types used in
1666         template.
1667         (scan_relocs): Likewise.
1668         (relocate_section): Likewise.
1669         (apply_relocation): Likewise.
1670
1671 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1672
1673         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1674         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1675         under x32.
1676
1677 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1678
1679         * x86_64.cc: Initial support for x32.
1680
1681 2012-01-03  Cary Coutant  <ccoutant@google.com>
1682
1683         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1684         Use abstract base class for GOT.
1685         * gold/output.h (class Output_data_got_base): New abstract base class.
1686         (class Output_data_got): Derive from new base class, adjust ctors.
1687         (Output_data_got::reserve_slot): Make virtual; rename to
1688         do_reserve_slot; Adjust callers.
1689         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1690         pointer to abstract base class.
1691         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1692
1693 2011-12-18  Ian Lance Taylor  <iant@google.com>
1694
1695         * object.h (Relobj::local_symbol_value): New function.
1696         (Relobj::local_plt_offset): New function.
1697         (Relobj::local_has_got_offset): New function.
1698         (Relobj::local_got_offset): New function.
1699         (Relobj::set_local_got_offset): New function.
1700         (Relobj::do_local_symbol_value): New pure virtual function.
1701         (Relobj::do_local_plt_offset): Likewise.
1702         (Relobj::do_local_has_got_offset): Likewise.
1703         (Relobj::do_local_got_offset): Likewise.
1704         (Relobj::do_set_local_got_offset): Likewise.
1705         (Sized_relobj::do_local_has_got_offset): Rename from
1706         local_has_got_offset.
1707         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1708         (Sized_relobj::do_set_local_got_offset): Rename from
1709         set_local_got_offset.
1710         (Sized_relobj_file::do_local_plt_offset): Rename from
1711         local_plt_offset.
1712         (Sized_relobj_file::do_local_symbol_value): New function.
1713         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1714         local_plt_offset.
1715         * output.cc (Output_data_got::Got_entry::write): Change object to
1716         Relobj.  Use local_symbol_value.
1717         (Output_data_got::add_global_with_rel): Change rel_dyn to
1718         Output_data_reloc_generic*.  Use add_global_generic.
1719         (Output_data_got::add_global_with_rela): Remove.  Change all
1720         callers to use add_global_with_rel.
1721         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1722         Output_data_reloc_generic*.  Use add_global_generic.
1723         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1724         callers to use add_global_pair_with_rel.
1725         (Output_data_got::add_local): Change object to Relobj*.
1726         (Output_data_got::add_local_plt): Likewise.
1727         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1728         change rel_dyn to Output_data_reloc_generic*.  Use
1729         add_local_generic.
1730         (Output_data_got::add_local_with_rela): Remove.  Change all
1731         callers to use all_local_with_rel.
1732         (Output_data_got::add_local_pair_with_rel): Change object to
1733         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1734         add_output_section_generic.
1735         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1736         callers to use add_local_pair_with_rel.
1737         (Output_data_got::reserve_local): Change object to Relobj*.
1738         * output.h: (class Output_data_reloc_generic): Add pure virtual
1739         declarations for add_global_generic, add_local_generic,
1740         add_output_section_generic.
1741         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1742         functions for Output_data_reloc_generic.  Update declarations for
1743         changes listed in output.cc.
1744         (class Output_data_got): Change template parameter to got_size.
1745         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1746         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1747         function.
1748         (Sized_relobj_incr::do_local_plt_offset): New function.
1749         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1750         add_global_generic.
1751
1752 2011-12-17  Cary Coutant  <ccoutant@google.com>
1753
1754         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1755         * resolve.cc (Symbol_table::resolve): Likewise.
1756         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1757         arrays.
1758         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1759
1760 2011-12-16  Ian Lance Taylor  <iant@google.com>
1761
1762         * output.h (Output_data_reloc_generic::add): Only call
1763         add_dynamic_reloc if this is a dynamic reloc section.
1764
1765 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1766
1767         PR gold/13505
1768         * target-reloc.h (apply_relocation): Replace <64, false> with
1769         <size, big_endian>.
1770
1771 2011-11-25  Nick Clifton  <nickc@redhat.com>
1772
1773         * po/it.po: New Italian translation.
1774
1775 2011-11-17  Sterling Augustine  <saugustine@google.com>
1776
1777         * script.cc (script_include_directive): Implement.
1778         (read_script_file): New local variables name and search_path. Update
1779         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1780         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1781         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1782
1783 2011-11-11  Sterling Augustine  <saugustine@google.com>
1784
1785         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1786         (file_or_sections_cmd): Likewise.
1787
1788 2011-11-11  Doug Kwan  <dougkwan@google.com>
1789
1790         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1791         if --just-symbols is given.
1792
1793 2011-11-10  Doug Kwan  <dougkwan@google.com>
1794
1795         PR gold/13362
1796         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1797         when processing data relocs.
1798         * reloc.h (Relocate_functions::rel_unaligned): New method.
1799         (Relocate_functions::pcrel_unaligned): Ditto.
1800         (Relocate_functions::rel32_unaligned): Ditto.
1801         (Relocate_functions::pcrel32_unaligned): Ditto.
1802
1803 2011-11-09  Doug Kwan  <dougkwan@google.com>
1804
1805         PR gold/13362
1806         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1807         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1808         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1809         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1810         (Relocate_functions::rel_unaligned): New.
1811         (Relocate_functions::rel32_unaligned): New.
1812         * target-reloc.h (relocate_for_relocatable): Add code to handle
1813         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1814         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1815         arm_unaligned_reloc_r): New targets.
1816         * testsuite/Makefile.in: Regenerate.
1817         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1818         linking.
1819
1820 2011-11-02  Ian Lance Taylor  <iant@google.com>
1821
1822         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1823         NATIVE_LINKER.
1824         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1825         * options.cc (General_options::finalize): Use library search path
1826         from configure script if specified.  If not native and no sysroot,
1827         only search TOOLLIBDIR.
1828         * options.h (Search_directory::Search_directory): Change name to
1829         const std::string&.
1830         (General_options::add_to_library_path_with_sysroot): Change arg to
1831         const std::string&.
1832         * configure, Makefile.in, config.in: Rebuild.
1833
1834 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1835
1836         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1837         we are working around the ARM1176 Erratum.
1838         * options.h (General_options::fix_arm1176): Add option.
1839         * testsuite/Makefile.am: Add testcases, and keep current ones
1840         working.
1841         * testsuite/Makefile.in: Regenerate.
1842         * testsuite/arm_fix_1176.s: New file.
1843         * testsuite/arm_fix_1176.sh: Likewise.
1844
1845 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1846
1847         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1848         may_use_blx_.
1849         (Target_arm::may_use_blx): Remove method.
1850         (Target_arm::set_may_use_blx): Likewise.
1851         (Target_arm::may_use_v4t_interworking): New method.
1852         (Target_arm::may_use_v5t_interworking): Likewise.
1853         (Target_arm::may_use_blx_): Remove member variable.
1854         (Arm_relocate_functions::arm_branch_common): Check for v5T
1855         interworking.
1856         (Arm_relocate_functions::thumb_branch_common): Likewise.
1857         (Reloc_stub::stub_type_for_reloc): Likewise.
1858         (Target_arm::do_finalize_sections): Correct interworking checks.
1859         * testsuite/Makefile.am: Add new tests.
1860         * testsuite/Makefile.in: Regenerate.
1861         * testsuite/arm_farcall_arm_arm.s: New test.
1862         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1863         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1864         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1865         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1866         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1867         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1868         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1869
1870 2011-10-31  Cary Coutant  <ccoutant@google.com>
1871
1872         PR gold/13023
1873         * expression.cc (Expression::eval_with_dot): Add
1874         is_section_dot_assignment parameter.
1875         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1876         absolute and assigning to dot within a section.
1877         * script-sections.cc
1878         (Output_section_element_assignment::set_section_addresses): Pass
1879         dot_section to set_if_absolute.
1880         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1881         as is_section_dot_assignment flag to eval_with_dot.
1882         (Output_section_element_dot_assignment::set_section_addresses):
1883         Likewise.
1884         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1885         parameter.  Also set value if relative to dot_section; set the
1886         symbol's output_section.
1887         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1888         parameter.  Adjust all callers.
1889         (Expression::eval_maybe_dot): Likewise.
1890         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1891         Adjust all callers.
1892         * testsuite/script_test_2.t: Test assignment of an absolute value
1893         to dot within an output section element.
1894
1895 2011-10-31  Cary Coutant  <ccoutant@google.com>
1896
1897         * options.h (class General_options): Add --[no-]gnu-unique options.
1898         * symtab.cc (Symbol_table::sized_write_globals): Convert
1899         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1900
1901 2011-10-31  Cary Coutant  <ccoutant@google.com>
1902
1903         PR gold/13359
1904         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1905         unnecessary assertion.
1906         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1907
1908 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1909
1910         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1911         gc_mark_symbol.
1912         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1913         gc_mark_symbol.
1914         Change to just keep the section associated with symbol.
1915         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1916         they are externally visible and --export-dynamic is turned on.
1917         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1918
1919 2011-10-19  Ian Lance Taylor  <iant@google.com>
1920
1921         PR gold/13163
1922         * script-sections.cc
1923         (Output_section_element_dot_assignment::needs_output_section): New
1924         function.
1925
1926 2011-10-19  Ian Lance Taylor  <iant@google.com>
1927
1928         PR gold/13204
1929         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1930         --section-start option was seen.
1931         * options.h (General_options::any_section_start): New function.
1932
1933 2011-10-18  David S. Miller  <davem@davemloft.net>
1934
1935         PR binutils/13301
1936         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1937         member to track relocation locations that have moved during TLS
1938         reloc optimizations.
1939         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1940         (Target_sparc::Relocate::relocate): Adjust view down by 4
1941         bytes if it matches reloc_adjust_addr_.
1942         (Target_sparc::Relocate::relocate_tls): Always move the
1943         __tls_get_addr call delay slot instruction forward 4 bytes when
1944         performing relaxation.
1945
1946 2011-10-18  Cary Coutant  <ccoutant@google.com>
1947
1948         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1949         (Output_file::map_no_anonymous): Check for non-zero
1950         return code from posix_fallocate.
1951
1952 2011-10-17  Cary Coutant  <ccoutant@google.com>
1953
1954         PR gold/13245
1955         * plugin.cc (is_visible_from_outside): Check for symbols
1956         referenced from dynamic objects.
1957         * resolve.cc (Symbol_table::resolve): Don't count references
1958         from dynamic objects as references from real ELF files.
1959         * testsuite/plugin_test_2.sh: Adjust expected result.
1960
1961 2011-10-17  Cary Coutant  <ccoutant@google.com>
1962
1963         * gold.cc: Include timer.h.
1964         (queue_middle_tasks): Stamp time.
1965         (queue_final_tasks): Likewise.
1966         * main.cc (main): Store timer in parameters.  Print timers
1967         for each pass.
1968         * parameters.cc (Parameters::Parameters): Initialize timer_.
1969         (Parameters::set_timer): New function.
1970         (set_parameters_timer): New function.
1971         * parameters.h (Parameters::set_timer): New function.
1972         (Parameters::timer): New function.
1973         (Parameters::timer_): New data member.
1974         (set_parameters_timer): New function.
1975         * timer.cc (Timer::stamp): New function.
1976         (Timer::get_pass_time): New function.
1977         * timer.h (Timer::stamp): New function.
1978         (Timer::get_pass_time): New function.
1979         (Timer::pass_times_): New data member.
1980
1981 2011-10-17  Cary Coutant  <ccoutant@google.com>
1982
1983         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
1984         task for members of lib groups.
1985
1986 2011-10-17  Cary Coutant  <ccoutant@google.com>
1987
1988         PR gold/13288
1989         * fileread.cc (File_read::find_view): Add assert.
1990         (File_read::make_view): Move bounds check (replace with assert)...
1991         (File_read::find_or_make_view): ... to here.
1992
1993 2011-10-12  Cary Coutant  <ccoutant@google.com>
1994
1995         * output.cc (Output_file::open_base_file): Handle case where
1996         ::read returns less than requested size.
1997
1998 2011-10-10  Cary Coutant  <ccoutant@google.com>
1999
2000         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2001         Initialize defined_count_.
2002         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2003         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2004         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2005         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2006         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2007         * incremental.h (Sized_relobj_incr::defined_count_): New data
2008         member.
2009         (Sized_incr_dynobj::defined_count_): New data member.
2010         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2011         Return zeroes instead of internal error.
2012
2013 2011-10-10  Cary Coutant  <ccoutant@google.com>
2014
2015         PR gold/13249
2016         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2017         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2018         * output.h (class Output_reloc): Add use_plt_offset flag.
2019         (Output_reloc::type_): Adjust size of bit field.
2020         (Output_reloc::use_plt_offset_): New bit field.
2021         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2022         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2023         flag.  Adjust all callers.
2024         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2025         creating RELATIVE relocations.
2026
2027 2011-10-10  Nick Clifton  <nickc@redhat.com>
2028
2029         * po/es.po: Updated Spanish translation.
2030         * po/fi.po: Updated Finnish translation.
2031
2032 2011-10-03   Diego Novillo  <dnovillo@google.com>
2033
2034         * options.cc (parse_uint): Fix dereference of RETVAL.
2035
2036 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2037
2038         * layout.h (section_order_map_): New member.
2039         (get_section_order_map): New member function.
2040         * output.cc (Output_section::add_input_section): Check for patterns
2041         only when --section-ordering-file is specified.
2042         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2043         output_sections have been formed.
2044         * layout.cc (Layout_Layout): Initialize section_order_map_.
2045         * plugin.cc (update_section_order): Store order in order_map. Do not
2046         update the order.
2047         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2048         * testsuite/Makefile.in: Regenerate.
2049         * testsuite/plugin_section_order.c: New file.
2050         * testsuite/plugin_final_layout.cc: New file.
2051         * testsuite/plugin_final_layout.sh: New file.
2052
2053 2011-09-29  Cary Coutant  <ccoutant@google.com>
2054
2055         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2056         Check for NULL.
2057         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2058         symbols during incremental update.
2059         (Symbol_table::add_from_dynobj): Likewise.
2060
2061 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2062             Ian Lance Taylor  <iant@google.com>
2063
2064         * symtab.cc (Symbol_table::define_special_symbol): Always
2065         canonicalize version string.
2066
2067 2011-09-26  Cary Coutant  <ccoutant@google.com>
2068
2069         * gold.cc (queue_initial_tasks): Move option checks ...
2070         * options.cc (General_options::finalize): ... to here. Disable
2071         some options; make others fatal.
2072
2073 2011-09-26  Cary Coutant  <ccoutant@google.com>
2074
2075         gcc PR lto/47247
2076         * plugin.cc (get_symbols_v2): New function.
2077         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2078         (is_referenced_from_outside): New function.
2079         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2080         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2081         (get_symbols): Pass version parameter.
2082         (get_symbols_v2): New function.
2083         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2084         parameter.
2085         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2086         (onload): Add LDPT_GET_SYMBOLS_V2.
2087         (all_symbols_read_hook): Use get_symbols_v2; check for
2088         LDPR_PREVAILING_DEF_IRONLY_EXP.
2089         * testsuite/plugin_test_3.sh: Update expected results.
2090
2091 2011-09-23  Simon Baldwin  <simonb@google.com>
2092
2093         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2094         configuration options.
2095         * configure: Regenerate.
2096         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2097         * Makefile.in: Regenerate.
2098         * testsuite/Makefile.in: Regenerate.
2099
2100 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2101
2102         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2103
2104 2011-09-19  Cary Coutant  <ccoutant@google.com>
2105
2106         * incremental.cc (can_incremental_update): Fix typo in comment.
2107         * incremental.h (can_incremental_update): Likewise.
2108
2109 2011-09-18  Cary Coutant  <ccoutant@google.com>
2110
2111         * incremental.cc (can_incremental_update): New function.
2112         * incremental.h (can_incremental_update): New function.
2113         * layout.cc (Layout::init_fixed_output_section): Call it.
2114         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2115         * object.cc (Sized_relobj_file::do_layout): Call
2116         can_incremental_update.
2117
2118 2011-09-13  Cary Coutant  <ccoutant@google.com>
2119
2120         * configure.ac: Check for glibc support for gnu_indirect_function
2121         support with static linking, setting automake conditional
2122         IFUNC_STATIC.
2123         * Makefile.in: Regenerate.
2124         * configure: Regenerate.
2125
2126         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2127         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2128         for IFUNC_STATIC.
2129         * testsuite/Makefile.in: Regenerate.
2130
2131 2011-09-13  Cary Coutant  <ccoutant@google.com>
2132
2133         * incremental.cc (Sized_relobj_incr::do_layout): Call
2134         report_comdat_group for kept comdat sections.
2135         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2136         * testsuite/Makefile.in: Regenerate.
2137         * testsuite/incr_comdat_test_1.cc: New source file.
2138         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2139         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2140         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2141
2142 2011-09-13  Ian Lance Taylor  <iant@google.com>
2143
2144         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2145         variable external_symbols_offset.
2146
2147 2011-09-12  Ian Lance Taylor  <iant@google.com>
2148
2149         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2150         triggered if object has no symbols.
2151
2152 2011-09-09  David S. Miller  <davem@davemloft.net>
2153
2154         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2155         (Output_fill_debug_line::do_write): Likewise.
2156
2157 2011-08-29  Cary Coutant  <ccoutant@google.com>
2158
2159         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2160         casts to match formatting specs.
2161         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2162
2163 2011-08-26  Cary Coutant  <ccoutant@google.com>
2164
2165         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2166         remaining hole size when allocating.
2167         (Layout::make_output_section): Set fill methods for debug sections.
2168         * layout.h (Free_list::Free_list_node): Move from private to
2169         public.
2170         (Free_list::set_min_hole_size): New function.
2171         (Free_list::begin, Free_list::end): New functions.
2172         (Free_list::min_hole_): New data member.
2173         * output.cc: Include dwarf.h.
2174         (Output_fill_debug_info::do_minimum_hole_size): New function.
2175         (Output_fill_debug_info::do_write): New function.
2176         (Output_fill_debug_line::do_minimum_hole_size): New function.
2177         (Output_fill_debug_line::do_write): New function.
2178         (Output_section::Output_section): Initialize new data member.
2179         (Output_section::set_final_data_size): Ensure patch space is larger
2180         than minimum hole size.
2181         (Output_section::do_write): Fill holes in debug sections.
2182         * output.h (Output_fill): New class.
2183         (Output_fill_debug_info): New class.
2184         (Output_fill_debug_line): New class.
2185         (Output_section::set_free_space_fill): New function.
2186         (Output_section::free_space_fill_): New data member.
2187         * testsuite/Makefile.am (incremental_test_3): Add
2188         --incremental-patch option.
2189         (incremental_test_4): Likewise.
2190         (incremental_test_5): Likewise.
2191         (incremental_test_6): Likewise.
2192         (incremental_copy_test): Likewise.
2193         (incremental_common_test_1): Likewise.
2194         * testsuite/Makefile.in: Regenerate.
2195
2196 2011-08-26  Nick Clifton  <nickc@redhat.com>
2197
2198         * po/es.po: Updated Spanish translation.
2199
2200 2011-08-01  Cary Coutant  <ccoutant@google.com>
2201
2202         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2203         * gold/testsuite/Makefile.in: Regenerate.
2204         * gold/testsuite/justsyms_exec.c: New source file.
2205         * gold/testsuite/justsyms_lib.c: New source file.
2206
2207 2011-08-01  Cary Coutant  <ccoutant@google.com>
2208
2209         * layout.cc (Layout::set_segment_offsets): Don't realign text
2210         segment if -Ttext was specified.
2211         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2212         file type.
2213         * object.h (Sized_relobj_file::e_type): New function.
2214         (Sized_relobj_file::e_type_): New data member.
2215         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2216         base address for ET_EXEC files.
2217         * target.cc (Target::do_make_elf_object_implementation): Allow
2218         ET_EXEC files with --just-symbols option.
2219
2220 2011-07-28  Cary Coutant  <ccoutant@google.com>
2221
2222         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2223         Add thread_number parameter.
2224         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2225         * workqueue-threads.cc
2226         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2227         current thread if its thread number is greater than desired thread
2228         count.
2229         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2230         Add thread_number parameter.
2231         (Workqueue::should_cancel_thread): Likewise.
2232         (Workqueue::find_runnable_or_wait): Pass thread_number to
2233         should_cancel_thread.
2234         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2235         parameter.
2236
2237 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2238
2239         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2240         only after checking if it cannot be forced local.
2241         * symtab.h (is_externally_visible): Check if the symbol is not forced
2242         local.
2243
2244 2011-07-15  Ian Lance Taylor  <iant@google.com>
2245
2246         * options.h (class General_options): Add --print-output-format.
2247         Move -EL next to -EB, for  better --help output.
2248         * target-select.cc: Include <cstdio>, "options.h", and
2249         "parameters.h".
2250         (Target_selector::do_target_bfd_name): New function.
2251         (print_output_format): New function.
2252         * target-select.h (class Target_selector): Update declarations.
2253         (Target_selector::target_bfd_name): New function.
2254         (print_output_format): Declare.
2255         * main.cc: Include "target-select.h".
2256         (main): Handle --print-output-format.
2257         * gold.cc: Include "target-select.h".
2258         (queue_initial_tasks): Handle --print-output-format when there are
2259         no input files.
2260         * parameters.cc (parameters_force_valid_target): Give a better
2261         error message if -EB/-EL does not match target.
2262         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2263         function.
2264
2265 2011-07-15  Ian Lance Taylor  <iant@google.com>
2266
2267         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2268         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2269         (Output_data_plt_i386::do_write): Write address of .dynamic
2270         section to first entry in .got.plt section.
2271         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2272         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2273         Initialize layout_.
2274         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2275         section to first entry in .got.plt section.
2276         * layout.h (Layout::dynamic_section): New function.
2277
2278 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2279
2280         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2281         to claim_file call.
2282         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2283         input_section_position_, and input_section_glob_.
2284         (read_layout_from_file): Call function section_ordering_specified.
2285         * layout.h (is_section_ordering_specified): New function.
2286         (section_ordering_specified): New function.
2287         (section_ordering_specified_): New boolean member.
2288         * main.cc(main): Call load_plugins after layout object is defined.
2289         * output.cc (Output_section::add_input_section): Use
2290         function section_ordering_specified to check if section ordering is
2291         needed.
2292         * output.cc (Output_section::add_relaxed_input_section): Use
2293         function section_ordering_specified to check if section ordering is
2294         needed.
2295         (Output_section::update_section_layout): New function.
2296         (Output_section::sort_attached_input_sections): Check if input section
2297         must be reordered.
2298         * output.h (Output_section::update_section_layout): New function.
2299         * plugin.cc (get_section_count): New function.
2300         (get_section_type): New function.
2301         (get_section_name): New function.
2302         (get_section_contents): New function.
2303         (update_section_order): New function.
2304         (allow_section_ordering): New function.
2305         (Plugin::load): Add the new interfaces to the transfer vector.
2306         (Plugin_manager::load_plugins): New parameter.
2307         (Plugin_manager::all_symbols_read): New parameter.
2308         (Plugin_manager::claim_file): New parameter. Save the elf object for
2309         unclaimed objects.
2310         (Plugin_manager::get_elf_object): New function.
2311         (Plugin_manager::get_view): Change to directly use the bool to check
2312         if get_view is called from claim_file_hook.
2313         * plugin.h (input_objects): New function
2314         (Plugin__manager::load_plugins): New parameter.
2315         (Plugin_manager::claim_file): New parameter.
2316         (Plugin_manager::get_elf_object): New function.
2317         (Plugin_manager::in_claim_file_handler): New function.
2318         (Plugin_manager::in_claim_file_handler_): New member.
2319         (layout): New function.
2320         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2321         handler with an extra parameter. Make the elf object before calling
2322         claim_file handler.
2323         * testsuite/plugin_test.c (get_section_count): New function pointer.
2324         (get_section_type): New function pointer.
2325         (get_section_name): New function pointer.
2326         (get_section_contents): New function pointer.
2327         (update_section_order): New function pointer.
2328         (allow_section_ordering): New function pointer.
2329         (onload): Check if the new interfaces exist.
2330
2331 2011-07-13  Ian Lance Taylor  <iant@google.com>
2332
2333         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2334         relro section.
2335         * x86_64.cc (Target_x86_64::got_section): Likewise.
2336         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2337         (relro_now_test_SOURCES): New variable.
2338         (relro_now_test_DEPENDENCIES): New variable.
2339         (relro_now_test_LDFLAGS): New variable.
2340         (relro_now_test_LDADD): New variable.
2341         (relro_now_test.so): New target.
2342         * testsuite/Makefile.in: Rebuild.
2343
2344 2011-07-12  Ian Lance Taylor  <iant@google.com>
2345
2346         PR gold/12980
2347         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2348         GLOB_DAT relocation rather than a RELATIVE relocation for a
2349         protected symbol when creating a shared library.
2350         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2351         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2352         * testsuite/protected_main_1.cc (main): Test that protected
2353         function has same address.
2354
2355 2011-07-11  Ian Lance Taylor  <iant@google.com>
2356
2357         PR gold/12979
2358         * options.h (class General_options): Add -Bgroup.
2359         * options.cc (General_options::finalize): If -Bgroup is set,
2360         default to --unresolved-symbols=report-all.
2361         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2362         * target-reloc.h (issue_undefined_symbol_error): Handle
2363         --unresolved-symbols=report-all.
2364
2365 2011-07-08  Ian Lance Taylor  <iant@google.com>
2366
2367         PR gold/11985
2368         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2369         if linker script discards key sections.
2370         (Layout::create_dynamic_symtab): Likewise.
2371         (Layout::assign_local_dynsym_offsets): Likewise.
2372         (Layout::sized_create_version_sections): Likewise.
2373         (Layout::create_interp): Likewise.
2374         (Layout::finish_dynamic_section): Likewise.
2375         (Layout::set_dynamic_symbol_size): Likewise.
2376
2377 2011-07-08  Ian Lance Taylor  <iant@google.com>
2378
2379         PR gold/12386
2380         * options.h (class General_options): Add --unresolved-symbols.
2381         * target-reloc.h (issue_undefined_symbol_error): Check
2382         --unresolved-symbols.  Add comments.
2383
2384 2011-07-08  Ian Lance Taylor  <iant@google.com>
2385
2386         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2387         expression more complex.
2388
2389 2011-07-08  Ian Lance Taylor  <iant@google.com>
2390
2391         PR gold/11317
2392         * target-reloc.h (issue_undefined_symbol_error): New inline
2393         function, broken out of relocate_section.
2394         (relocate_section): Call issue_undefined_symbol_error.
2395         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2396         there is no TLS segment if we are about to issue an undefined
2397         symbol error.
2398         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2399
2400 2011-07-08  Ian Lance Taylor  <iant@google.com>
2401
2402         PR gold/12279
2403         * resolve.cc (Symbol_table::should_override): Add fromtype
2404         parameter.  Change all callers.  Give error when linking together
2405         TLS and non-TLS symbol.
2406         (Symbol_table::should_override_with_special): Add fromtype
2407         parameter.  Change all callers.
2408         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2409         there is no TLS segment if we have reported some errors.
2410         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2411
2412 2011-07-08  Ian Lance Taylor  <iant@google.com>
2413
2414         PR gold/12372
2415         * target.h (Target::plt_address_for_global): New function.
2416         (Target::plt_address_for_local): New function.
2417         (Target::plt_section_for_global): Remove.
2418         (Target::plt_section_for_local): Remove.
2419         (Target::do_plt_address_for_global): New virtual function.
2420         (Target::do_plt_address_for_local): New virtual function.
2421         (Target::do_plt_section_for_global): Remove.
2422         (Target::do_plt_section_for_local): Remove.
2423         (Target::register_global_plt_entry): Add Symbol_table and Layout
2424         parameters.
2425         * output.cc (Output_data_got::Got_entry::write): Use
2426         plt_address_for_global and plt_address_for_local.
2427         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2428         address of output section.
2429         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2430         got_irelative_, and irelative_count_ fields.  Update
2431         declarations.
2432         (Output_data_plt_i386::has_irelative_section): New function.
2433         (Output_data_plt_i386::entry_count): Add irelative_count_.
2434         (Output_data_plt_i386::set_final_data_size): Likewise.
2435         (class Target_i386): Add got_irelative_ and rel_irelative_
2436         fields.  Update declarations.
2437         (Target_i386::Target_i386): Initialize new fields.
2438         (Target_i386::do_plt_address_for_global): New function replacing
2439         do_plt_section_for_global.
2440         (Target_i386::do_plt_address_for_local): New function replacing
2441         do_plt_section_for_local.
2442         (Target_i386::got_section): Create got_irelative_.
2443         (Target_i386::rel_irelative_section): New function.
2444         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2445         fields.  Don't define __rel_iplt_{start,end}.
2446         (Output_data_plt_i386::add_entry): Add symtab and layout
2447         parameters.  Change all callers.  Use different PLT and GOT for
2448         IFUNC symbols.
2449         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2450         layout parameters.  Change all callers.  Use different PLT and
2451         GOT.
2452         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2453         (Output_data_plt_i386::rel_irelative): New function.
2454         (Output_data_plt_i386::address_for_global): New function.
2455         (Output_data_plt_i386::address_for_local): New function.
2456         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2457         IRELATIVE GOT when changing IFUNC GOT entries.
2458         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2459         reloc.
2460         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2461         if we didn't create an IRELATIVE GOT.
2462         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2463         plt_address_for_local.
2464         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2465         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2466         got_irelative_, and irelative_count_ fields.  Update
2467         declarations.
2468         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2469         Initialize new fields.  Remove symtab parameter.  Change all
2470         callers.
2471         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2472         irelative_count_.
2473         (Output_data_plt_x86_64::has_irelative_section): New function.
2474         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2475         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2476         fields.  Update declarations.
2477         (Target_x86_64::Target_x86_64): Initialize new fields.
2478         (Target_x86_64::do_plt_address_for_global): New function replacing
2479         do_plt_section_for_global.
2480         (Target_x86_64::do_plt_address_for_local): New function replacing
2481         do_plt_section_for_local.
2482         (Target_x86_64::got_section): Create got_irelative_.
2483         (Target_x86_64::rela_irelative_section): New function.
2484         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2485         all callers.  Don't create __rel_iplt_{start,end}.
2486         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2487         parameters.  Change all callers.  Use different PLT and GOT for
2488         IFUNC symbols.
2489         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2490         layout parameters.  Change all callers.  Use different PLT and
2491         GOT.
2492         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2493         parameters.  Change all callers.  Use different PLT and GOT for
2494         IFUNC symbols.
2495         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2496         (Output_data_plt_x86_64::rela_irelative): New function.
2497         (Output_data_plt_x86_64::address_for_global): New function.
2498         (Output_data_plt_x86_64::address_for_local): New function.
2499         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2500         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2501         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2502         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2503         parameters.
2504         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2505         reloc.
2506         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2507         symbols if we didn't create an IRELATIVE GOT.
2508         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2509         plt_address_for_local.
2510         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2511         * testsuite/ifuncvar1.c: New test file.
2512         * testsuite/ifuncvar2.c: New test file.
2513         * testsuite/ifuncvar3.c: New test file.
2514         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2515         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2516         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2517         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2518         * testsuite/Makefile.in: Rebuild.
2519
2520 2011-07-07  Cary Coutant  <ccoutant@google.com>
2521
2522         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2523         (two_file_test_1_ndebug.o): Likewise.
2524         (two_file_test_1b_ndebug.o): Likewise.
2525         (two_file_test_2_ndebug.o): Likewise.
2526         (two_file_test_main_ndebug.o): Likewise.
2527         (incremental_test_2): Link with no-debug versions.
2528
2529 2011-07-06  Cary Coutant  <ccoutant@google.com>
2530
2531         * gold/incremental.cc
2532         (Output_section_incremental_inputs::write_info_blocks): Check for
2533         hidden and internal symbols.
2534
2535 2011-07-06  Cary Coutant  <ccoutant@google.com>
2536
2537         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2538         Check disposition for startup file.
2539         (Incremental_inputs::report_command_line): Ignore
2540         --incremental-startup-unchanged option.
2541         * options.cc (General_options::parse_incremental_startup_unchanged):
2542         New function.
2543         (General_options::General_options): Initialize new data member.
2544         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2545         (General_options): Add --incremental-startup-unchanged option.
2546         (General_options::incremental_startup_disposition): New function.
2547         (General_options::incremental_startup_disposition_): New data member.
2548
2549 2011-07-06  Cary Coutant  <ccoutant@google.com>
2550
2551         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2552         input file index to Script_info ctor.
2553         (Sized_incremental_binary::do_file_has_changed): Find the
2554         command-line argument for files named in scripts.
2555         * incremental.h (Script_info::Script_info): New ctor
2556         with input file index.
2557         (Script_info::input_file_index): New function.
2558         (Script_info::input_file_index_): New data member.
2559         (Incremental_binary::get_library): Add const.
2560         (Incremental_binary::get_script_info): Add const.
2561         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2562         * testsuite/Makefile.am (incremental_test_5): New test case.
2563         (incremental_test_6): New test case.
2564         * testsuite/Makefile.in: Regenerate.
2565
2566 2011-07-06  Cary Coutant  <ccoutant@google.com>
2567
2568         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2569         debug output when command lines differ.
2570
2571 2011-07-06  Cary Coutant  <ccoutant@google.com>
2572
2573         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2574         --incremental-patch option.
2575         * layout.cc (Free_list::allocate): Extend allocation beyond original
2576         end if enabled.
2577         (Layout::make_output_section): Mark sections that should get
2578         patch space.
2579         * options.cc (parse_percent): New function.
2580         * options.h (parse_percent): New function.
2581         (DEFINE_percent): New macro.
2582         (General_options): Add --incremental-patch option.
2583         * output.cc (Output_section::Output_section): Initialize new data
2584         members.
2585         (Output_section::add_input_section): Print section name when out
2586         of patch space.
2587         (Output_section::add_output_section_data): Likewise.
2588         (Output_section::set_final_data_size): Add patch space when
2589         doing --incremental-full.
2590         (Output_section::do_reset_address_and_file_offset): Remove patch
2591         space.
2592         (Output_segment::set_section_list_addresses): Print debug output
2593         only if --incremental-update.
2594         * output.h (Output_section::set_is_patch_space_allowed): New function.
2595         (Output_section::is_patch_space_allowed_): New data member.
2596         (Output_section::patch_space_): New data member.
2597         * parameters.cc (Parameters::incremental_full): New function.
2598         * parameters.h (Parameters::incremental_full): New function
2599         * testsuite/Makefile.am (incremental_test_2): Add test for
2600         --incremental-patch option.
2601         * testsuite/Makefile.in: Regenerate.
2602         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2603         (t18): Remove function body.
2604
2605 2011-07-05  Doug Kwan  <dougkwan@google.com>
2606
2607         PR gold/12771
2608         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2609         Arm_Address type for relocation result.
2610         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2611         overflow check.
2612         (Arm_relocate_functions::abs32): Use unaligned access.
2613         (Arm_relocate_functions::rel32): Ditto.
2614         (Arm_relocate_functions::prel31): Ditto.
2615         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2616         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2617         static data relocations.
2618         * testsuite/Makefile.in: Regnerate.
2619         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2620
2621 2011-07-05  Ian Lance Taylor  <iant@google.com>
2622
2623         PR gold/12392
2624         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2625         symbols if necessary.
2626         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2627
2628 2011-07-05  Ian Lance Taylor  <iant@google.com>
2629
2630         PR gold/12952
2631         * resolve.cc (Symbol::override_base_with_special): Simply override
2632         version with special symbol version, ignoring previous version.
2633
2634 2011-07-05  Ian Lance Taylor  <iant@google.com>
2635
2636         * object.cc (Sized_relobj_file::include_section_group): Add
2637         information to comment about signature location.
2638
2639 2011-07-02  Ian Lance Taylor  <iant@google.com>
2640
2641         PR gold/12957
2642         * options.h (class General_options): Add -f and -F.
2643         * options.cc (General_options::finalize): Fatal error if -f/-F
2644         are used without -shared.
2645         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2646
2647 2011-07-02  Ian Lance Taylor  <iant@google.com>
2648
2649         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2650
2651 2011-07-01  Ian Lance Taylor  <iant@google.com>
2652
2653         PR gold/12525
2654         PR gold/12952
2655         * resolve.cc (Symbol::override_base_with_special): Don't override
2656         the version if the overriding symbol has a different name.
2657         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2658         all callers.  If we give an error about an undefined version,
2659         define the base version if necessary.
2660         * dynobj.h (class Versions): Update declaration.
2661         * testsuite/weak_alias_test_5.cc: New file.
2662         * testsuite/weak_alias_test.script: New file.
2663         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2664         and versioned_alias have the right value, and call t2.
2665         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2666         weak_alias_test_5.so.
2667         (weak_alias_test_LDADD): Likewise.
2668         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2669         * testsuite/Makefile.in: Rebuild.
2670
2671 2011-07-01  Ian Lance Taylor  <iant@google.com>
2672
2673         PR gold/12525
2674         * options.h (class General_options): Support -z notext.
2675         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2676         -Wl,-z,notext.
2677         (two_file_shared_nonpic.so): Likewise.
2678         (two_file_shared_mixed.so): Likewise.
2679         (two_file_shared_mixed_1.so): Likewise.
2680         (weak_undef_lib_nonpic.so): Likewise.
2681         (alt/weak_undef_lib_nonpic.so): Likewise.
2682         (tls_test_shared_nonpic.so): Likewise.
2683         * testsuite/Makefile.in: Rebuild.
2684
2685 2011-07-01  Ian Lance Taylor  <iant@google.com>
2686
2687         PR gold/12525
2688         * configure.ac: Test whether static linking works, setting
2689         the automake conditional HAVE_STATIC.
2690         * testsuite/Makefile.am: Disable tests using -static if
2691         HAVE_STATIC is not true.
2692         * configure, testsuite/Makefile.in: Rebuild.
2693
2694 2011-07-01  Ian Lance Taylor  <iant@google.com>
2695
2696         PR gold/12525
2697         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2698         Assert if we see DW_EH_PE_indirect.
2699         * target.h (Target::ehframe_datarel_base): New function.
2700         (Target::do_ehframe_datarel_base): New target function.
2701         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2702         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2703         function.
2704
2705 2011-07-01  Ian Lance Taylor  <iant@google.com>
2706
2707         PR gold/12571
2708         * options.h (class General_options): Add
2709         --ld-generated-unwind-info.
2710         * ehframe.cc (Fde::write): Add address parameter.  Change all
2711         callers.  If associated with PLT, fill in address and size.
2712         (Cie::set_output_offset): Only add merge mapping if there is an
2713         object.
2714         (Cie::write): Add address parameter.  Change all callers.
2715         (Eh_frame::add_ehframe_for_plt): New function.
2716         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2717         input_offset_ fields into union u_, with new plt field.
2718         (Fde::Fde): Adjust for new union field.
2719         (Fde::Fde) [Output_data version]: New constructor.
2720         (Fde::add_mapping): Only add merge mapping if there is an object.
2721         (class Cie): Update declarations.
2722         (class Eh_frame): Declare add_ehframe_for_plt.
2723         * layout.cc (Layout::layout_eh_frame): Break out code into
2724         make_eh_frame_section, and call it.
2725         (Layout::make_eh_frame_section): New function.
2726         (Layout::add_eh_frame_for_plt): New function.
2727         * layout.h (class Layout): Update declarations.
2728         * merge.cc (Merge_map::add_mapping): Add assertion.
2729         * i386.cc: Include "dwarf.h".
2730         (class Output_data_plt_i386): Make first_plt_entry,
2731         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2732         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2733         and plt_eh_frame_fde.
2734         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2735         boundary.  Call add_eh_frame_for_plt if appropriate.
2736         * x86_64.cc: Include "dwarf.h".
2737         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2738         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2739         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2740         and plt_eh_frame_fde.
2741         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2742         appropriate.
2743
2744 2011-06-29  Ian Lance Taylor  <iant@google.com>
2745
2746         PR gold/12629
2747         * object.cc (Sized_relobj_file::layout_section): Change shdr
2748         parameter to be const.
2749         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2750         out of do_layout.
2751         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2752         appropriate.  Call layout_eh_frame_section.
2753         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2754         sections.
2755         * object.h (class Sized_relobj_file): Update declarations.
2756
2757 2011-06-29  Ian Lance Taylor  <iant@google.com>
2758
2759         PR gold/12652
2760         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2761         modifier.
2762         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2763
2764 2011-06-29  Ian Lance Taylor  <iant@google.com>
2765
2766         PR gold/12675
2767         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2768         SHT_X86_64_UNWIND.
2769         * layout.cc (Layout::layout_eh_frame): Likewise.
2770
2771 2011-06-29  Ian Lance Taylor  <iant@google.com>
2772
2773         PR gold/12695
2774         * layout.cc (Layout::symtab_section_shndx): New function.
2775         * layout.h (class Layout): Declare symtab_section_shndx.
2776         * output.cc (Output_section::write_header): Call it.
2777
2778 2011-06-29  Ian Lance Taylor  <iant@google.com>
2779
2780         PR gold/12818
2781         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2782         symbols which are not used in a relocation.
2783
2784 2011-06-28  Ian Lance Taylor  <iant@google.com>
2785
2786         PR gold/12898
2787         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2788         script create indistinguishable segments.
2789         (Layout::set_segment_offsets): Use stable_sort when sorting
2790         segments.  Pass this to Compare_segments constructor.
2791         * layout.h (class Layout): Make segment_precedes non-static.
2792         (class Compare_segments): Change from struct to class.  Add
2793         layout_ field.  Add constructor.
2794         * script-sections.cc
2795         (Script_sections::attach_sections_using_phdrs_clause): Rename
2796         local orphan to is_orphan.  Don't report failure to put empty
2797         section in segment.  On attachment failure, report name of
2798         section, and attach to first PT_LOAD segment.
2799
2800 2011-06-28  Ian Lance Taylor  <iant@google.com>
2801
2802         PR gold/12934
2803         * target-select.cc (Target_selector::Target_selector): Add
2804         emulation parameter.  Change all callers.
2805         (select_target_by_bfd_name): Rename from select_target_by_name.
2806         Change all callers.
2807         (select_target_by_emulation): New function.
2808         (supported_emulation_names): New function.
2809         * target-select.h (class Target_selector): Add emulation_ field.
2810         Update declarations.
2811         (Target_selector::recognize_by_bfd_name): Rename from
2812         recognize_by_name.  Change all callers.
2813         (Target_selector::supported_bfd_names): Rename from
2814         supported_names.  Change all callers.
2815         (Target_selector::recognize_by_emulation): New function.
2816         (Target_selector::supported_emulations): New function.
2817         (Target_selector::emulation): New function.
2818         (Target_selector::do_recognize_by_bfd_name): Rename from
2819         do_recognize_by_name.  Change all callers.
2820         (Target_selector::do_supported_bfd_names): Rename from
2821         do_supported_names.  Change all callers.
2822         (Target_selector::do_recognize_by_emulation): New function.
2823         (Target_selector::do_supported_emulations): New function.
2824         (select_target_by_bfd_name): Change name in declaration.
2825         (select_target_by_emulation): Declare.
2826         (supported_emulation_names): Declare.
2827         * parameters.cc (parameters_force_valid_target): Try to find
2828         target based on emulation from -m option.
2829         * options.h (class General_options): Change doc string for -m.
2830         * options.cc (help): Print emulations.
2831         (General_options::parse_V): Likewise.
2832         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2833         Add emulation parameter.  Change all callers.
2834
2835 2011-06-28  Ian Lance Taylor  <iant@google.com>
2836
2837         * target.h (class Target): Add osabi_ field.
2838         (Target::osabi): New function.
2839         (Target::set_osabi): New function.
2840         (Target::Target): Initialize osabi_.
2841         (Target::do_adjust_elf_header): Make pure virtual.
2842         (Sized_target::do_adjust_elf_header): Declare.
2843         * target.cc (Sized_target::do_adjust_elf_header): New function.
2844         (class Sized_target): Instantiate all versions.
2845         * freebsd.h (class Target_freebsd): Remove.
2846         (Target_selector_freebsd::do_recognize): Call set_osabi on
2847         Target.
2848         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2849         (Target_selector_freebsd::set_osabi): Remove.
2850         * i386.cc (class Target_i386): Inherit from Sized_target rather
2851         than Target_freebsd.
2852         * x86_64.cc (class Target_x86_64): Likewise.
2853
2854 2011-06-28  Ian Lance Taylor  <iant@google.com>
2855
2856         * target.h (Target::can_check_for_function_pointers): Rewrite.
2857         Make non-virtual.
2858         (Target::can_icf_inline_merge_sections): Likewise.
2859         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2860         (Target::Target_info): Add can_icf_inline_merge_sections field.
2861         (Target::do_can_check_for_function_pointers): New virtual
2862         function.
2863         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2864         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2865         from can_check_for_function_pointers, move in file.
2866         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2867         section_may_have_icf_unsafe_poineters, move in file.
2868         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2869         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2870         Rename from can_check_for_function_pointers, move in file.
2871         (Target_i386::can_icf_inline_merge_sections): Remove.
2872         (Target_i386::i386_info): Initialize
2873         can_icf_inline_merge_sections.
2874         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2875         Initialize can_icf_inline_merge_sections.
2876         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2877         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2878         Rename from can_check_for_function_pointers, move in file.
2879         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2880         (Target_x86_64::x86_64_info): Initialize
2881         can_icf_inline_merge_sections.
2882         * testsuite/testfile.cc (Target_test::test_target_info):
2883         Likewise.
2884         * icf.cc (get_section_contents): Correct formatting.
2885
2886 2011-06-27  Ian Lance Taylor  <iant@google.com>
2887
2888         * symtab.cc (Symbol::versioned_name): New function.
2889         (Symbol_table::add_to_final_symtab): Use versioned_name when
2890         appropriate.
2891         (Symbol_table::sized_write_symbol): Likewise.
2892         * symtab.h (class Symbol): Declare versioned_name.
2893         * stringpool.h (class Stringpool_template): Add variant of add
2894         which takes a std::basic_string.
2895         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2896         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2897         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2898         (ver_test_12.o): New target.
2899         * testsuite/Makefile.in: Rebuild.
2900
2901 2011-06-27  Doug Kwan  <dougkwan@google.com>
2902
2903         * arm.cc (Arm_relocate_functions::thm_jump8,
2904         Arm_relocate_functions::thm_jump11): Use a wider signed
2905         type to compute offset.
2906         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2907         arm_thm_jump8.
2908         * testsuite/Makefile.in: Regenerate.
2909         * testsuite/arm_branch_in_range.sh: Check test results of
2910         arm_thm_jump11 and arm_thm_jump8.
2911         * testsuite/arm_thm_jump11.s: New test source file.
2912         * testsuite/arm_thm_jump11.t: New linker script.
2913         * testsuite/arm_thm_jump8.s: New test source file.
2914         * testsuite/arm_thm_jump8.t: New linker script.
2915
2916 2011-06-24  Ian Lance Taylor  <iant@google.com>
2917
2918         * layout.cc: Include "object.h".
2919         (ctors_sections_in_init_array): New static variable.
2920         (Layout::is_ctors_in_init_array): New function.
2921         (Layout::layout): Add entry to ctors_sections_in_init_array if
2922         appropriate.
2923         * layout.h (class Layout): Declare is_ctors_in_init_array.
2924         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2925         is_ctors_reverse_view is set.
2926         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2927         all callers.  Set is_ctors_reverse_view field of View_size.
2928         (Sized_relobj_file::reverse_words): New function.
2929         * object.h (Sized_relobj_file::View_size): Add
2930         is_ctors_reverse_view field.
2931         (class Sized_relobj_file): Update declarations.
2932         * testsuite/initpri3.c: New test.
2933         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2934         initpri3b.
2935         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2936         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2937         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2938         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2939         * testsuite/Makefile.in: Rebuild.
2940
2941 2011-06-24  Cary Coutant  <ccoutant@google.com>
2942
2943         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2944         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2945         (debug_msg_cdebug.err): New targets.
2946         * testsuite/Makefile.in: Regenerate.
2947         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2948         Fix checks for link with shared library.
2949
2950 2011-06-24  Doug Kwan  <dougkwan@google.com>
2951
2952         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2953         skip empty text sections.
2954         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2955
2956 2011-06-22  Ian Lance Taylor  <iant@google.com>
2957
2958         PR gold/12910
2959         * options.h (class General_options): Add --ctors-in-init-array.
2960         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2961         friends as SHT_PROGBITS for merging sections.
2962         (Layout::layout): Remove special handling of .init_array and
2963         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2964         and .dtors if ctors_in_init_array.
2965         (Layout::make_output_section): Force correct section types for
2966         .init_array and friends.  Don't sort if doing relocatable link,
2967         Don't sort .ctors and .dtors if ctors_in_init_array.
2968         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2969         (Layout::output_section_name): Add relobj parameter.  Change all
2970         callers.  Handle .ctors. and .dtors. in code rather than table.
2971         Handle .ctors and .dtors if ctors_in_init_array.
2972         (Layout::match_file_name): New function, moved from output.cc.
2973         * layout.h (class Layout): Update declarations.
2974         * output.cc: Include "layout.h".
2975         (Input_section_sort_entry::get_priority): New function.
2976         (Input_section_sort_entry::match_file_name): Just call
2977         Layout::match_file_name.
2978         (Output_section::Input_section_sort_init_fini_compare::operator()):
2979         Handle .ctors and .dtors.  Sort by explicit priority rather than
2980         by name.
2981         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
2982         * testsuite/initpri2.c: New test.
2983         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
2984         (check_PROGRAMS): Add initpri2.
2985         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
2986         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
2987         * configure, testsuite/Makefile.in: Rebuild.
2988
2989 2011-06-19  Ian Lance Taylor  <iant@google.com>
2990
2991         PR gold/12880
2992         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
2993         .interp section to a PT_INTERP segment even if we have seen a
2994         --dynamic-linker option.  Don't do it if we have seen a PHDRS
2995         clause in a linker script.
2996         (Layout::finalize): Don't create a .interp section if we've
2997         already create a PT_INTERP segment.
2998         (Layout::create_interp): Always call choose_output_section (revert
2999         patch of 2011-06-17).  Don't create PT_INTERP segment.
3000         * script-sections.cc
3001         (Script_sections::create_note_and_tls_segments): Add a .interp
3002         section to a PT_INTERP segment even if we have seen a
3003         --dynamic-linker option.
3004
3005 2011-06-18  Ian Lance Taylor  <iant@google.com>
3006
3007         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3008         merely because a non-PT_LOAD segment has a dynamic reloc.
3009
3010 2011-06-18  Ian Lance Taylor  <iant@google.com>
3011
3012         * layout.cc (Layout::finish_dynamic_section): Don't create
3013         DT_FLAGS entry if not needed.
3014
3015 2011-06-18  Ian Lance Taylor  <iant@google.com>
3016
3017         PR gold/12745
3018         * layout.cc (Layout::layout_eh_frame): Correct handling of
3019         writable .eh_frame section.
3020
3021 2011-06-17  Ian Lance Taylor  <iant@google.com>
3022
3023         PR gold/12893
3024         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3025         symbol is redefined with the exact same object and value.
3026
3027 2011-06-17  Ian Lance Taylor  <iant@google.com>
3028
3029         PR gold/12880
3030         * layout.h (class Layout): Add interp_segment_ field.
3031         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3032         (Layout::attach_allocated_section_to_segment): If making shared
3033         library, put .interp section in PT_INTERP segment.
3034         (Layout::finalize): Also call create_interp if -dynamic-linker
3035         option was used.
3036         (Layout::create_interp): Assert that there is no PT_INTERP
3037         segment.  If not using a SECTIONS clause, use make_output_section.
3038         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3039         * script-sections.cc
3040         (Script_sections::create_note_and_tls_segments): If making shared
3041         library, put .interp section in PT_INTERP segment.
3042
3043 2011-06-17  Ian Lance Taylor  <iant@google.com>
3044
3045         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3046         when making a shared library.
3047
3048 2011-06-17  Ian Lance Taylor  <iant@google.com>
3049
3050         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3051         parameter.  Change all callers.  Don't issue warning about PC32
3052         against locally defined symbol.
3053
3054 2011-06-16  Ian Lance Taylor  <iant@google.com>
3055
3056         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3057         occurs in same object.
3058
3059 2011-06-14  Alan Modra  <amodra@gmail.com>
3060
3061         * po/POTFILES.in: Regenerate.
3062
3063 2011-06-09  Ian Lance Taylor  <iant@google.com>
3064
3065         * script-sections.cc
3066         (Orphan_output_section::set_section_addresses): For a relocatable
3067         link set address to 0.
3068
3069 2011-06-09  Cary Coutant  <ccoutant@google.com>
3070
3071         PR gold/12804
3072         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3073         used with --compress-debug-sections.
3074         * gold/object.cc (Sized_relobj_file::do_layout): Report
3075         uncompressed size of compressed input sections.
3076
3077 2011-06-08  Cary Coutant  <ccoutant@google.com>
3078
3079         PR gold/12804
3080         * testsuite/two_file_test_2_v1.cc: Change initialization of
3081         v2 to keep it in .data.
3082
3083 2011-06-07  Cary Coutant  <ccoutant@google.com>
3084
3085         * common.cc (Symbol_table::do_allocate_commons_list): Call
3086         gold_fallback.
3087         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3088         (Errors::fallback): New function.
3089         (gold_fallback): New function.
3090         * errors.h (Errors::fallback): New function.
3091         * gold.cc (gold_exit): Change status parameter to enum; adjust
3092         all callers.
3093         (queue_initial_tasks): Call gold_fallback.
3094         * gold.h: Include cstdlib.
3095         (Exit_status): New enum type.
3096         (gold_exit): Change status parameter to enum.
3097         (gold_fallback): New function.
3098         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3099         (Layout::create_symtab_sections): Likewise.
3100         (Layout::create_shdrs): Likewise.
3101         * main.cc (main): Adjust call to gold_exit.
3102         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3103         (Output_data_got::add_got_entry_pair): Likewise.
3104         (Output_section::add_input_section): Likewise.
3105         (Output_section::add_output_section_data): Likewise.
3106         (Output_segment::set_section_list_addresses): Likewise.
3107         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3108
3109 2011-06-07  Cary Coutant  <ccoutant@google.com>
3110
3111         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3112         for incremental links.
3113         * output.cc (Output_segment::set_section_list_addresses): Remove
3114         FIXME and test for TLS or BSS.
3115
3116 2011-06-07  Cary Coutant  <ccoutant@google.com>
3117
3118         * testsuite/Makefile.am: Add incremental_copy_test,
3119         incremental_common_test_1.
3120         * testsuite/Makefile.in: Regenerate.
3121         * testsuite/common_test_1_v1.c: New source file.
3122         * testsuite/common_test_1_v2.c: New source file.
3123         * testsuite/copy_test_v1.cc: New source file.
3124
3125 2011-06-07  Cary Coutant  <ccoutant@google.com>
3126
3127         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3128         update, allocate common from bss section's free list.
3129         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3130         linker-defined symbols.
3131         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3132         Skip GOT and PLT entries that are no longer referenced.
3133         (Output_section_incremental_inputs::write_info_blocks): Mark
3134         linker-defined symbols.
3135         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3136         * output.cc (Output_section::allocate): New function.
3137         * output.h (Output_section::allocate): New function.
3138         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3139         linker-defined symbols.
3140         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3141         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3142         (Symbol::init_base_output_data): Likewise.
3143         (Symbol::init_base_output_segment): Likewise.
3144         (Symbol::init_base_constant): Likewise.
3145         (Sized_symbol::init_output_data): Likewise.
3146         (Sized_symbol::init_output_segment): Likewise.
3147         (Sized_symbol::init_constant): Likewise.
3148         (Symbol_table::do_define_in_output_data): Likewise.
3149         (Symbol_table::do_define_in_output_segment): Likewise.
3150         (Symbol_table::do_define_as_constant): Likewise.
3151         * symtab.h (Symbol::is_predefined): New function.
3152         (Symbol::init_base_output_data): Add is_predefined parameter.
3153         (Symbol::init_base_output_segment): Likewise.
3154         (Symbol::init_base_constant): Likewise.
3155         (Symbol::is_predefined_): New data member.
3156         (Sized_symbol::init_output_data): Add is_predefined parameter.
3157         (Sized_symbol::init_output_segment): Likewise.
3158         (Sized_symbol::init_constant): Likewise.
3159         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3160
3161 2011-06-07  Cary Coutant  <ccoutant@google.com>
3162
3163         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3164         instead of emit_copy_reloc.
3165         (Copy_relocs::emit_copy_reloc): Refactor.
3166         (Copy_relocs::make_copy_reloc): New function.
3167         (Copy_relocs::add_copy_reloc): Remove.
3168         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3169         section.
3170         (Copy_relocs::make_copy_reloc): New function.
3171         (Copy_relocs::add_copy_reloc): Remove.
3172         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3173         unchanged input files.
3174         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3175         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3176         Reserve BSS space for COPY relocations.
3177         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3178         (Output_section_incremental_inputs::write_info_blocks): Record
3179         whether a symbol is copied from a shared object.
3180         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3181         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3182         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3183         (Incremental_input_entry_reader::get_output_symbol_index): Add
3184         is_copy parameter.
3185         (Incremental_binary::emit_copy_relocs): New function.
3186         (Incremental_binary::do_emit_copy_relocs): New function.
3187         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3188         new data member.
3189         (Sized_incremental_binary::add_copy_reloc): New function.
3190         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3191         (Sized_incremental_binary::Copy_reloc): New struct.
3192         (Sized_incremental_binary::Copy_relocs): New typedef.
3193         (Sized_incremental_binary::copy_relocs_): New data member.
3194         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3195         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3196         * target.h (Sized_target::emit_copy_reloc): New function.
3197         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3198
3199 2011-06-02  Cary Coutant  <ccoutant@google.com>
3200
3201         PR gold/12163
3202         * gold/archive.cc (Archive::Archive): Initialize new data member.
3203         (Archive::include_all_members): Return if archive has already been
3204         included.
3205         * gold/archive.h (Archive::include_all_members_): New data member.
3206
3207 2011-06-02  Nick Clifton  <nickc@redhat.com>
3208
3209         * dynobj.h: Fix spelling mistake in comment.
3210         * output.cc: Likewise.
3211
3212 2011-05-31  Doug Kwan  <dougkwan@google.com>
3213             Asier Llano
3214
3215         PR gold/12826
3216         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3217         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3218         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3219         redundant arm_exidx_test.so.
3220         * testsuite/Makefile.in: Regenerate.
3221         (check_SCRIPTS): Add pr12826.sh
3222         (check_DATA): Add pr12826.stdout
3223         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3224         * testsuite/pr12826.sh: New file.
3225         * testsuite/pr12826_1.s: Ditto.
3226         * testsuite/pr12826_1.s: Ditto.
3227
3228 2011-05-30  Ian Lance Taylor  <iant@google.com>
3229
3230         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3231         sections.
3232
3233 2011-05-29  Ian Lance Taylor  <iant@google.com>
3234
3235         PR gold/12804
3236         * testsuite/Makefile.am: Use different file name for two_file_test
3237         temporary file for each incremental test.
3238         * testsuite/Makefile.in: Rebuild.
3239
3240 2011-05-29  Ian Lance Taylor  <iant@google.com>
3241
3242         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3243         binary input file is empty.
3244
3245 2011-05-27  Ian Lance Taylor  <iant@google.com>
3246
3247         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3248         (ver_test_9.so): Likewise.
3249         * testsuite/Makefile.in: Rebuild.
3250
3251 2011-05-26 Cary Coutant  <ccoutant@google.com>
3252
3253         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3254         * incremental.cc (Incremental_inputs::report_input_section): Fix
3255         comment, indentation.
3256         (Incremental_inputs::report_comdat_group): New function.
3257         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3258         of data for incremental input file entry.
3259         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3260         group count, COMDAT group signatures.
3261         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3262         an unchanged input file.
3263         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3264         Initialize new data member.
3265         (Incremental_object_entry::add_comdat_group): New function.
3266         (Incremental_object_entry::get_comdat_group_count): New function.
3267         (Incremental_object_entry::get_comdat_signature_key): New function.
3268         (Incremental_object_entry::groups_): New data member.
3269         (Incremental_inputs::report_comdat_group): New function.
3270         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3271         data for incremental input file entry.
3272         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3273         (Incremental_input_entry_reader::get_input_section): Adjust size of
3274         data for incremental input file entry.
3275         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3276         (Incremental_input_entry_reader::get_comdat_group_signature): New
3277         function.
3278         * object.cc (Sized_relobj::include_section_group): Report kept
3279         COMDAT groups for incremental links.
3280
3281 2011-05-24  David Meyer  <pdox@google.com>
3282
3283         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3284         with name parameter.  Add found_name parameter.
3285         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3286         * dirsearch.h (class Dirsearch): Update declaration.
3287
3288 2011-05-24  Ian Lance Taylor  <iant@google.com>
3289
3290         * archive.cc (Library_base::should_include_member): Pull in object
3291         from archive if it defines the entry symbol.
3292         * parameters.cc (Parameters::entry): New function.
3293         * parameters.h (class Parameters): Declare entry.
3294         * output.h (class Output_file_header): Remove entry_ field.
3295         * output.cc (Output_file_header::Output_file_header): Remove entry
3296         parameter.  Change all callers.
3297         (Output_file_header::entry): Use parameters->entry.
3298         * gold.cc (queue_middle_tasks): Likewise.
3299         * plugin.cc (Plugin_hook::run): Likewise.
3300
3301 2011-05-24 Cary Coutant  <ccoutant@google.com>
3302
3303         * gold.cc (queue_initial_tasks): Pass incremental base filename
3304         to Output_file::open_base_file; don't print error message.
3305         * incremental-dump.cc (main): Adjust call to
3306         Output_file::open_for_modification.
3307         * incremental-dump.cc (main): Likewise.
3308         * incremental.cc (Incremental_inputs::report_command_line):
3309         Ignore --incremental-base option when comparing command lines.
3310         Ignore parameter when given as separate argument.
3311         * options.h (class General_options): Add --incremental-base.
3312         * output.cc (Output_file::Output_file):
3313         (Output_file::open_base_file): Add base_name and writable parameters;
3314         read base file into new file; print error message here.
3315         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3316         callers.
3317         * output.h (Output_file::open_for_modification): Rename to...
3318         (Output_file::open_base_file): ...this; add base_name and
3319         writable parameters; adjust all callers.
3320         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3321         callers.
3322         * testsuite/Makefile.am (incremental_test_4): Test
3323         --incremental-base.
3324         * testsuite/Makefile.in: Regenerate.
3325
3326 2011-05-24 Cary Coutant  <ccoutant@google.com>
3327
3328         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3329         incremental_test_4.
3330         * testsuite/Makefile.in: Regenerate.
3331         * testsuite/two_file_test_1_v1.cc: New test source file.
3332         * testsuite/two_file_test_1b_v1.cc: New test source file.
3333         * testsuite/two_file_test_2_v1.cc: New test source file.
3334
3335 2011-05-24 Cary Coutant  <ccoutant@google.com>
3336
3337         * dynobj.h (Dynobj::do_dynobj): New function.
3338         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3339         flag and soname for shared objects.
3340         * incremental.cc (Incremental_inputs::report_object): Make
3341         either Incremental_object_entry or Incremental_dynobj_entry; add
3342         soname to string table.
3343         (Incremental_inputs::report_input_section): Add assertion.
3344         (Output_section_incremental_inputs::set_final_data_size): Adjust
3345         type of input file entry for shared libraries; adjust size of
3346         shared library info entry.
3347         (Output_section_incremental_inputs::write_input_files): Write
3348         as_needed flag for shared libraries.
3349         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3350         of input file entry for shared libraries; write soname.
3351         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3352         soname from incremental info.
3353         * incremental.h (enum Incremental_input_flags): Add
3354         INCREMENTAL_INPUT_AS_NEEDED.
3355         (Incremental_input_entry::Incremental_input_entry): Initialize new
3356         data member.
3357         (Incremental_input_entry::set_as_needed): New function.
3358         (Incremental_input_entry::as_needed): New function.
3359         (Incremental_input_entry::do_dynobj_entry): New function.
3360         (Incremental_input_entry::as_needed_): New data member.
3361         (Incremental_object_entry::Incremental_object_entry): Don't check
3362         for shared library.
3363         (Incremental_object_entry::do_type): Likewise.
3364         (class Incremental_dynobj_entry): New class.
3365         (Incremental_input_entry_reader::as_needed): New function.
3366         (Incremental_input_entry_reader::get_soname): New function.
3367         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3368         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3369         size of shared library info entry.
3370         * layout.cc (Layout::finish_dynamic_section): Don't test for
3371         incremental link when adding DT_NEEDED entries.
3372         * object.h (Object::Object): Initialize new data member.
3373         (Object::dynobj): New function.
3374         (Object::set_as_needed): New function.
3375         (Object::as_needed): New function.
3376         (Object::do_dynobj): New function.
3377         (Object::as_needed_): New data member.
3378
3379 2011-05-24 Cary Coutant  <ccoutant@google.com>
3380
3381         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3382         info; adjust display of GOT entries.
3383         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3384         vector of input objects; remove file_status_.
3385         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3386         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3387         got_plt reader; call target hooks to reserve GOT entries.
3388         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3389         of input file info header and GOT info entry.
3390         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3391         relocation info.
3392         (Got_plt_view_info::got_descriptor): Remove.
3393         (Got_plt_view_info::sym_index): New data member.
3394         (Got_plt_view_info::input_index): New data member.
3395         (Local_got_offset_visitor::visit): Write input file index.
3396         (Global_got_offset_visitor::visit): Write 0 for input file index.
3397         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3398         with sym_index and input_index.
3399         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3400         incremental info GOT entry; replace got_descriptor with input_index.
3401         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3402         map from input file index to object.
3403         (Sized_relobj_incr::do_layout): Replace direct data member reference
3404         with accessor function.
3405         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3406         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3407         Adjust size of input file info header.
3408         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3409         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3410         (Incremental_input_entry_reader::get_input_section): Adjust size of
3411         input file info header.
3412         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3413         of incremental info GOT entry.
3414         (Incremental_got_plt_reader::get_got_desc): Remove.
3415         (Incremental_got_plt_reader::get_got_symndx): New function.
3416         (Incremental_got_plt_reader::get_got_input_index): New function.
3417         (Sized_incremental_binary::Sized_incremental_binary): Remove
3418         file_status_; add input_objects_.
3419         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3420         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3421         (Sized_incremental_binary::file_is_unchanged): Remove.
3422         (Sized_incremental_binary::set_input_object): New function.
3423         (Sized_incremental_binary::input_object): New function.
3424         (Sized_incremental_binary::file_status_): Remove.
3425         (Sized_incremental_binary::input_objects_): New data member.
3426         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3427         references.
3428         (Sized_relobj_incr::invalid_address): Move to base class.
3429         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3430         class.
3431         (Sized_relobj_incr::do_output_section_offset): Likewise.
3432         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3433         (Sized_relobj_incr::section_offsets_): Likewise.
3434         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3435         function.
3436         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3437         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3438         with accessor function.
3439         (Sized_relobj_file::do_layout): Likewise.
3440         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3441         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3442         (Sized_relobj_file::compute_final_local_value): Replace refs to
3443         section_offsets_ with accessor function.
3444         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3445         * object.h (Relobj::Relobj): Initialize new data members.
3446         (Relobj::add_dyn_reloc): New function.
3447         (Relobj::first_dyn_reloc): New function.
3448         (Relobj::dyn_reloc_count): New function.
3449         (Relobj::first_dyn_reloc_): New data member.
3450         (Relobj::dyn_reloc_count_): New data member.
3451         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3452         references.
3453         (Sized_relobj::Address): New typedef.
3454         (Sized_relobj::invalid_address): Move here from child class.
3455         (Sized_relobj::Sized_relobj): Initialize new data members.
3456         (Sized_relobj::sized_relobj): New function.
3457         (Sized_relobj::is_output_section_offset_invalid): Move here from
3458         child class.
3459         (Sized_relobj::get_output_section_offset): Likewise.
3460         (Sized_relobj::local_has_got_offset): Likewise.
3461         (Sized_relobj::local_got_offset): Likewise.
3462         (Sized_relobj::set_local_got_offset): Likewise.
3463         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3464         (Sized_relobj::clear_got_offsets): New function.
3465         (Sized_relobj::section_offsets): Move here from child class.
3466         (Sized_relobj::do_output_section_offset): Likewise.
3467         (Sized_relobj::do_set_section_offset): Likewise.
3468         (Sized_relobj::Local_got_offsets): Likewise.
3469         (Sized_relobj::local_got_offsets_): Likewise.
3470         (Sized_relobj::section_offsets_): Likewise.
3471         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3472         references.
3473         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3474         class.
3475         (Sized_relobj_file::sized_relobj): New function
3476         (Sized_relobj_file::local_has_got_offset): Move to base class.
3477         (Sized_relobj_file::local_got_offset): Likewise.
3478         (Sized_relobj_file::set_local_got_offset): Likewise.
3479         (Sized_relobj_file::get_output_section_offset): Likewise.
3480         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3481         (Sized_relobj_file::do_output_section_offset): Likewise.
3482         (Sized_relobj_file::do_set_section_offset): Likewise.
3483         (Sized_relobj_file::Local_got_offsets): Likewise.
3484         (Sized_relobj_file::local_got_offsets_): Likewise.
3485         (Sized_relobj_file::section_offsets_): Likewise.
3486         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3487         (all constructors).
3488         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3489         (Output_reloc::get_symbol_index): Likewise.
3490         (Output_reloc::local_section_offset): Likewise.
3491         (Output_reloc::get_address): Likewise.
3492         (Output_reloc::symbol_value): Likewise.
3493         (Output_data_got::reserve_slot): Move to class definition.
3494         (Output_data_got::reserve_local): New function.
3495         (Output_data_got::reserve_slot_for_global): Remove.
3496         (Output_data_got::reserve_global): New function.
3497         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3498         (all constructors, two instantiations).
3499         (Output_reloc::get_relobj): New function (two instantiations).
3500         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3501         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3502         (Output_data_reloc::add_global): Adjust type of relobj.
3503         (Output_data_reloc::add_global_relative): Likewise.
3504         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3505         (Output_data_reloc::add_local): Likewise.
3506         (Output_data_reloc::add_local_relative): Likewise.
3507         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3508         (Output_data_reloc::add_local_section): Likewise.
3509         (Output_data_reloc::add_output_section): Likewise.
3510         (Output_data_reloc::add_absolute): Likewise.
3511         (Output_data_reloc::add_target_specific): Likewise.
3512         (Output_data_got::reserve_slot): Move definition here.
3513         (Output_data_got::reserve_local): New function.
3514         (Output_data_got::reserve_global): New function.
3515         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3516         section_offsets_ with accessor function.
3517         (Sized_relobj_file::write_sections): Likewise.
3518         (Sized_relobj_file::do_relocate_sections): Likewise.
3519         * target.h (Sized_target::reserve_local_got_entry): New function.
3520         (Sized_target::reserve_global_got_entry): New function.
3521         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3522         (Target_x86_64::reserve_global_got_entry): New function.
3523         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3524
3525 2011-05-23 Cary Coutant  <ccoutant@google.com>
3526
3527         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3528         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3529         bit when checking got_type.
3530         * incremental.cc (Sized_incremental_binary::setup_readers):
3531         Store symbol table and string table locations; initialize bit vector
3532         of file status flags.
3533         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3534         unchanged files.
3535         (Sized_incremental_binary::do_process_got_plt): New function.
3536         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3537         (Output_section_incremental_inputs::set_final_data_size): Record
3538         file index for each input file.
3539         (Output_section_incremental_inputs::write_got_plt): Store file index
3540         instead of input entry offset for each GOT entry.
3541         * incremental.h
3542         (Incremental_input_entry::Incremental_input_entry): Initialize new
3543         data member.
3544         (Incremental_input_entry::set_offset): Store file index.
3545         (Incremental_input_entry::get_file_index): New function.
3546         (Incremental_input_entry::file_index_): New data member.
3547         (Incremental_binary::process_got_plt): New function.
3548         (Incremental_binary::do_process_got_plt): New function.
3549         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3550         data members.
3551         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3552         (Sized_incremental_binary::set_file_is_unchanged): New function.
3553         (Sized_incremental_binary::file_is_unchanged): New function.
3554         (Sized_incremental_binary::do_process_got_plt): New function.
3555         (Sized_incremental_binary::file_status_): New data member.
3556         (Sized_incremental_binary::main_symtab_loc_): New data member.
3557         (Sized_incremental_binary::main_strtab_loc_): New data member.
3558         * output.cc (Output_data_got::Got_entry::write): Add case
3559         RESERVED_CODE.
3560         (Output_data_got::add_global): Call add_got_entry.
3561         (Output_data_got::add_global_plt): Likewise.
3562         (Output_data_got::add_global_with_rel): Likewise.
3563         (Output_data_got::add_global_with_rela): Likewise.
3564         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3565         (Output_data_got::add_global_pair_with_rela): Likewise.
3566         (Output_data_got::add_local): Call add_got_entry.
3567         (Output_data_got::add_local_plt): Likewise.
3568         (Output_data_got::add_local_with_rel): Likewise.
3569         (Output_data_got::add_local_with_rela): Likewise.
3570         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3571         (Output_data_got::add_local_pair_with_rela): Likewise.
3572         (Output_data_got::reserve_slot): New function.
3573         (Output_data_got::reserve_slot_for_global): New function.
3574         (Output_data_got::add_got_entry): New function.
3575         (Output_data_got::add_got_entry_pair): New function.
3576         (Output_section::add_output_section_data): Edit FIXME.
3577         * output.h
3578         (Output_section_data_build::Output_section_data_build): New
3579         constructor with size parameter.
3580         (Output_data_space::Output_data_space): Likewise.
3581         (Output_data_got::Output_data_got): Initialize new data member; new
3582         constructor with size parameter.
3583         (Output_data_got::add_constant): Call add_got_entry.
3584         (Output_data_got::reserve_slot): New function.
3585         (Output_data_got::reserve_slot_for_global): New function.
3586         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3587         (Output_data_got::add_got_entry): New function.
3588         (Output_data_got::add_got_entry_pair): New function.
3589         (Output_data_got::free_list_): New data member.
3590         * target.h (Sized_target::init_got_plt_for_update): New function.
3591         (Sized_target::register_global_plt_entry): New function.
3592         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3593         Initialize new data member; call init; add constructor with PLT count.
3594         (Output_data_plt_x86_64::init): New function.
3595         (Output_data_plt_x86_64::add_relocation): New function.
3596         (Output_data_plt_x86_64::reserve_slot): New function.
3597         (Output_data_plt_x86_64::free_list_): New data member.
3598         (Target_x86_64::init_got_plt_for_update): New function.
3599         (Target_x86_64::register_global_plt_entry): New function.
3600         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3601         incremental updates.
3602         (Output_data_plt_x86_64::add_relocation): New function.
3603         * testsuite/object_unittest.cc (Object_test): Set default options.
3604
3605 2011-05-16  Ian Lance Taylor  <iant@google.com>
3606
3607         * options.h (class General_options): Make -i a synonym for -r.
3608
3609 2011-05-16  Ian Lance Taylor  <iant@google.com>
3610
3611         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3612
3613 2011-05-10 Cary Coutant  <ccoutant@google.com>
3614
3615         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3616         strip_all (-s).
3617
3618 2011-05-06  Ian Lance Taylor  <iant@google.com>
3619
3620         * layout.cc (Layout::layout): If the output section flags change,
3621         update the ordering.
3622
3623 2011-04-25 Cary Coutant  <ccoutant@google.com>
3624
3625         * incremental-dump.cc (dump_incremental_inputs): Print local
3626         symbol info for each input file.
3627         * incremental.cc
3628         (Output_section_incremental_inputs::set_final_data_size): Add local
3629         symbol info to input file entries in incremental info.
3630         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3631         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3632         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3633         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3634         implementation.
3635         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3636         (Sized_incr_relobj::do_relocate): Write the local symbols.
3637         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3638         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3639         Adjust size of input file header.
3640         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3641         (Incremental_inputs_reader::get_local_symbol_count): New function.
3642         (Incremental_inputs_reader::get_input_section): Adjust size of input
3643         file header.
3644         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3645         (Sized_incr_relobj::This): New typedef.
3646         (Sized_incr_relobj::sym_size): New const data member.
3647         (Sized_incr_relobj::Local_symbol): New struct.
3648         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3649         (Sized_incr_relobj::do_local_symbol_offset): New function.
3650         (Sized_incr_relobj::local_symbol_count_): New data member.
3651         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3652         (Sized_incr_relobj::local_symbol_index_): New data member.
3653         (Sized_incr_relobj::local_symbol_offset_): New data member.
3654         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3655         (Sized_incr_relobj::local_symbols_): New data member.
3656         * object.h (Relobj::output_local_symbol_count): New function.
3657         (Relobj::local_symbol_offset): New function.
3658         (Relobj::do_output_local_symbol_count): New function.
3659         (Relobj::do_local_symbol_offset): New function.
3660         (Sized_relobj::do_output_local_symbol_count): New function.
3661         (Sized_relobj::do_local_symbol_offset): New function.
3662
3663 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3664
3665         * descriptors.cc (set_close_on_exec): New function.
3666         (Descriptors::open): Use set_close_on_exec.
3667         * output.cc (S_ISLNK): Define if not defined.
3668
3669 2011-04-22 Cary Coutant  <ccoutant@google.com>
3670
3671         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3672         global symbol map.
3673         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3674         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3675         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3676         relocations.
3677         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3678         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3679         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3680         * incremental.h
3681         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3682         function.
3683         (Incremental_binary::apply_incremental_relocs): New function.
3684         (Incremental_binary::do_apply_incremental_relocs): New function.
3685         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3686         data member.
3687         (Sized_incremental_binary::add_global_symbol): New function.
3688         (Sized_incremental_binary::global_symbol): New function.
3689         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3690         (Sized_incremental_binary::symbol_map_): New data member.
3691         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3692         * target.h (Sized_target::apply_relocation): New function.
3693         * target-reloc.h (apply_relocation): New function.
3694         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3695
3696 2011-04-22  Doug Kwan  <dougkwan@google.com>
3697
3698         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3699         flag of a SHT_ARM_EXIDX section.
3700         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3701         * testsuite/Makefile.in: Regenerate.
3702         * testsuite/arm_exidx_test.s: New file.
3703         * testsuite/arm_exidx_test.sh: Same.
3704
3705 2011-04-20 Cary Coutant  <ccoutant@google.com>
3706
3707         PR gold/12689
3708         * archive.h (Incremental_archive_entry::Archive_member):
3709         Initialize arg_serial_ (second constructor).
3710
3711 2011-04-17  Ian Lance Taylor  <iant@google.com>
3712
3713         * object.cc (Relocate_info::location): Simplify location string.
3714         * errors.cc (Errors::error_at_location): Don't print program
3715         name.
3716         (Errors::warning_at_location): Likewise.
3717         (Errors::undefined_symbol): Likewise.
3718         * testsuite/debug_msg.sh: Update accordingly.
3719
3720 2011-04-14 Cary Coutant  <ccoutant@google.com>
3721
3722         * gold/layout.cc (Layout::symtab_section_offset): New function.
3723         * gold/layout.h (Layout::symtab_section_offset): New function.
3724         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3725
3726 2011-04-12  Ian Lance Taylor  <iant@google.com>
3727
3728         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3729         with MREMAP_MAYMOVE.
3730         * output.h (class Output_file): Add map_is_allocated_ field.
3731         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3732         not available, provide stubs.  If mremap is not available, #define
3733         it to gold_mremap.
3734         (MREMAP_MAYMOVE): Define if not defined.
3735         (Output_file::Output_file): Initialize map_is_allocated_.
3736         (Output_file::resize): Check map_is_allocated_.
3737         (Output_file::map_anonymous): If mmap fails, use malloc.
3738         (Output_file::unmap): Don't do anything for an anonymous map.
3739         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3740         is not available, provide stubs.
3741         (File_read::View::~View): Use free rather than delete[].
3742         (File_read::make_view): Use malloc rather than new[].  If mmap
3743         fails, use malloc.
3744         (File_read::find_or_make_view): Use malloc rather than new[].
3745         * gold.h: Remove HAVE_REMAP code.
3746         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3747         exists.  Rename mremap to gold_mremap.  If mmap is not available
3748         don't do anything.
3749         * configure, config.in: Rebuild.
3750
3751 2011-04-11  Ian Lance Taylor  <iant@google.com>
3752
3753         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3754         initialize local variable v.
3755
3756 2011-04-11  Cary Coutant  <ccoutant@google.com>
3757
3758         * archive.cc (Archive::include_member): Adjust call to
3759         report_object.
3760         (Add_archive_symbols::run): Track argument serial numbers.
3761         (Lib_group::include_member): Likewise.
3762         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3763         * archive.h (Incremental_archive_entry::Archive_member):
3764         Initialize arg_serial_.
3765         (Archive_member::arg_serial_): New data member.
3766         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3767         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3768         incremental link.
3769         (Sized_dynobj::do_for_all_local_got_entries): New function.
3770         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3771         function.
3772         * fileread.cc (get_mtime): New function.
3773         * fileread.h (get_mtime): New function.
3774         * gold.cc (queue_initial_tasks): Check for incremental update.
3775         (process_incremental_input): New function.
3776         (queue_middle_tasks): Don't force valid target for incremental
3777         update.
3778         * incremental-dump.cc (find_input_containing_global): Adjust
3779         size of symbol info entry.
3780         (dump_incremental_inputs): Dump argument serial number and
3781         in_system_directory flag; bias shndx by 1; print symbol names
3782         when dumping per-file symbol lists; use new symbol info readers.
3783         * incremental.cc
3784         (Output_section_incremental_inputs:update_data_size): New function.
3785         (Sized_incremental_binary::setup_readers): Setup input readers
3786         for each input file; build maps for files added from libraries
3787         and scripts.
3788         (Sized_incremental_binary::check_input_args): New function.
3789         (Sized_incremental_binary::do_check_inputs): Build map of argument
3790         serial numbers to input arguments.
3791         (Sized_incremental_binary::do_file_has_changed): Rename
3792         do_file_is_unchanged to this; compare file modification times.
3793         (Sized_incremental_binary::do_init_layout): New function.
3794         (Sized_incremental_binary::do_reserve_layout): New function.
3795         (Sized_incremental_binary::do_get_input_reader): Remove.
3796         (Sized_incremental_binary::get_symtab_view): New function.
3797         (Incremental_checker::can_incrementally_link_output_file): Remove.
3798         (Incremental_inputs::report_command_line): Exclude --debug options.
3799         (Incremental_inputs::report_archive_begin): Add parameter; track
3800         argument serial numbers; don't put input file entry for archive
3801         before archive members.
3802         (Incremental_inputs::report_archive_end): Put input file entry
3803         for archive after archive members.
3804         (Incremental_inputs::report_object): Add parameter; track argument
3805         serial numbers and in_system_directory flag.
3806         (Incremental_inputs::report_script): Add parameter; track argument
3807         serial numbers.
3808         (Output_section_incremental_inputs::set_final_data_size): Adjust
3809         size of symbol info entry; check for forwarding symbols.
3810         (Output_section_incremental_inputs::write_input_files): Write
3811         in_system_directory flag and argument serial number.
3812         (Output_section_incremental_inputs::write_info_blocks): Map section
3813         indices between incremental info and original input file; store
3814         input section index for each symbol.
3815         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3816         change operator() to visit().
3817         (class Global_got_offset_visitor): Likewise.
3818         (class Global_symbol_visitor_got_plt):
3819         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3820         classes.
3821         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3822         (Sized_incr_relobj::do_read_symbols): New function.
3823         (Sized_incr_relobj::do_layout): New function.
3824         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3825         (Sized_incr_relobj::do_add_symbols): New function.
3826         (Sized_incr_relobj::do_should_include_member): New function.
3827         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3828         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3829         (Sized_incr_relobj::do_section_size): New function.
3830         (Sized_incr_relobj::do_section_name): New function.
3831         (Sized_incr_relobj::do_section_contents): New function.
3832         (Sized_incr_relobj::do_section_flags): New function.
3833         (Sized_incr_relobj::do_section_entsize): New function.
3834         (Sized_incr_relobj::do_section_address): New function.
3835         (Sized_incr_relobj::do_section_type): New function.
3836         (Sized_incr_relobj::do_section_link): New function.
3837         (Sized_incr_relobj::do_section_info): New function.
3838         (Sized_incr_relobj::do_section_addralign): New function.
3839         (Sized_incr_relobj::do_initialize_xindex): New function.
3840         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3841         (Sized_incr_relobj::do_read_relocs): New function.
3842         (Sized_incr_relobj::do_gc_process_relocs): New function.
3843         (Sized_incr_relobj::do_scan_relocs): New function.
3844         (Sized_incr_relobj::do_count_local_symbols): New function.
3845         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3846         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3847         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3848         (Sized_incr_relobj::do_relocate): New function.
3849         (Sized_incr_relobj::do_set_section_offset): New function.
3850         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3851         (Sized_incr_dynobj::do_read_symbols): New function.
3852         (Sized_incr_dynobj::do_layout): New function.
3853         (Sized_incr_dynobj::do_add_symbols): New function.
3854         (Sized_incr_dynobj::do_should_include_member): New function.
3855         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3856         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3857         (Sized_incr_dynobj::do_section_size): New function.
3858         (Sized_incr_dynobj::do_section_name): New function.
3859         (Sized_incr_dynobj::do_section_contents): New function.
3860         (Sized_incr_dynobj::do_section_flags): New function.
3861         (Sized_incr_dynobj::do_section_entsize): New function.
3862         (Sized_incr_dynobj::do_section_address): New function.
3863         (Sized_incr_dynobj::do_section_type): New function.
3864         (Sized_incr_dynobj::do_section_link): New function.
3865         (Sized_incr_dynobj::do_section_info): New function.
3866         (Sized_incr_dynobj::do_section_addralign): New function.
3867         (Sized_incr_dynobj::do_initialize_xindex): New function.
3868         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3869         (make_sized_incremental_object): New function.
3870         (Incremental_library::copy_unused_symbols): New function.
3871         (Incremental_library::do_for_all_unused_symbols): New function.
3872         * incremental.h (enum Incremental_input_flags): New type.
3873         (class Incremental_checker): Remove.
3874         (Incremental_input_entry::Incremental_input_entry): Add argument
3875         serial number.
3876         (Incremental_input_entry::arg_serial): New function.
3877         (Incremental_input_entry::set_is_in_system_directory): New function.
3878         (Incremental_input_entry::is_in_system_directory): New function.
3879         (Incremental_input_entry::arg_serial_): New data member.
3880         (Incremental_input_entry::is_in_system_directory_): New data member.
3881         (class Script_info): Move here from script.h.
3882         (Script_info::Script_info): Add filename parameter.
3883         (Script_info::filename): New function.
3884         (Script_info::filename_): New data member.
3885         (Incremental_script_entry::Incremental_script_entry): Add argument
3886         serial number.
3887         (Incremental_object_entry::Incremental_object_entry): Likewise.
3888         (Incremental_object_entry::add_input_section): Build list of input
3889         sections with map to original shndx.
3890         (Incremental_object_entry::get_input_section_index): New function.
3891         (Incremental_object_entry::shndx_): New data member.
3892         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3893         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3894         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3895         serial number.
3896         (Incremental_inputs::report_archive_begin): Likewise.
3897         (Incremental_inputs::report_object): Likewise.
3898         (Incremental_inputs::report_script): Likewise.
3899         (class Incremental_global_symbol_reader): New class.
3900         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3901         and store flags and input file type.
3902         (Incremental_input_entry_reader::arg_serial): New function.
3903         (Incremental_input_entry_reader::type): Extract type from flags.
3904         (Incremental_input_entry_reader::is_in_system_directory): New function.
3905         (Incremental_input_entry_reader::get_input_section_count): Call
3906         accessor function for type.
3907         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3908         function for type; adjust size of global symbol entry.
3909         (Incremental_input_entry_reader::get_global_symbol_count): Call
3910         accessor function for type.
3911         (Incremental_input_entry_reader::get_object_count): Likewise.
3912         (Incremental_input_entry_reader::get_object_offset): Likewise.
3913         (Incremental_input_entry_reader::get_member_count): Likewise.
3914         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3915         (Incremental_input_entry_reader::get_member_offset): Likewise.
3916         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3917         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3918         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3919         (Incremental_input_entry_reader::get_global_symbol_reader): New
3920         function.
3921         (Incremental_input_entry_reader::get_output_symbol_index): New
3922         function.
3923         (Incremental_input_entry_reader::type_): Remove.
3924         (Incremental_input_entry_reader::flags_): New data member.
3925         (Incremental_inputs_reader::input_file_offset): New function.
3926         (Incremental_inputs_reader::input_file_index): New function.
3927         (Incremental_inputs_reader::input_file): Call input_file_offset.
3928         (Incremental_inputs_reader::input_file_at_offset): New function.
3929         (Incremental_relocs_reader::get_r_type): Reformat.
3930         (Incremental_relocs_reader::get_r_shndx): Reformat.
3931         (Incremental_relocs_reader::get_r_offset): Reformat.
3932         (Incremental_relocs_reader::data): New function.
3933         (Incremental_binary::Incremental_binary): Initialize new data members.
3934         (Incremental_binary::check_inputs): Add cmdline parameter.
3935         (Incremental_binary::file_is_unchanged): Remove.
3936         (Input_reader::arg_serial): New function.
3937         (Input_reader::get_unused_symbol_count): New function.
3938         (Input_reader::get_unused_symbol): New function.
3939         (Input_reader::do_arg_serial): New function.
3940         (Input_reader::do_get_unused_symbol_count): New function.
3941         (Input_reader::do_get_unused_symbol): New function.
3942         (Incremental_binary::input_file_count): New function.
3943         (Incremental_binary::get_input_reader): Change signature to use
3944         index instead of filename.
3945         (Incremental_binary::file_has_changed): New function.
3946         (Incremental_binary::get_input_argument): New function.
3947         (Incremental_binary::get_library): New function.
3948         (Incremental_binary::get_script_info): New function.
3949         (Incremental_binary::init_layout): New function.
3950         (Incremental_binary::reserve_layout): New function.
3951         (Incremental_binary::output_file): New function.
3952         (Incremental_binary::do_check_inputs): New function.
3953         (Incremental_binary::do_file_is_unchanged): Remove.
3954         (Incremental_binary::do_file_has_changed): New function.
3955         (Incremental_binary::do_init_layout): New function.
3956         (Incremental_binary::do_reserve_layout): New function.
3957         (Incremental_binary::do_input_file_count): New function.
3958         (Incremental_binary::do_get_input_reader): Change signature.
3959         (Incremental_binary::input_args_map_): New data member.
3960         (Incremental_binary::library_map_): New data member.
3961         (Incremental_binary::script_map_): New data member.
3962         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3963         new data members.
3964         (Sized_incremental_binary::output_section): New function.
3965         (Sized_incremental_binary::inputs_reader): Add const.
3966         (Sized_incremental_binary::symtab_reader): Add const.
3967         (Sized_incremental_binary::relocs_reader): Add const.
3968         (Sized_incremental_binary::got_plt_reader): Add const.
3969         (Sized_incremental_binary::get_symtab_view): New function.
3970         (Sized_incremental_binary::Inputs_reader): New typedef.
3971         (Sized_incremental_binary::Input_entry_reader): New typedef.
3972         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
3973         (Sized_incremental_binary::do_file_is_unchanged): Remove.
3974         (Sized_incremental_binary::do_file_has_changed): New function.
3975         (Sized_incremental_binary::do_init_layout): New function.
3976         (Sized_incremental_binary::do_reserve_layout): New function.
3977         (Sized_input_reader::Inputs_reader): Remove.
3978         (Sized_input_reader::Input_entry_reader): Remove.
3979         (Sized_input_reader::do_arg_serial): New function.
3980         (Sized_input_reader::do_get_unused_symbol_count): New function.
3981         (Sized_input_reader::do_get_unused_symbol): New function.
3982         (Sized_incremental_binary::do_input_file_count): New function.
3983         (Sized_incremental_binary::do_get_input_reader): Change signature;
3984         use index instead of filename.
3985         (Sized_incremental_binary::section_map_): New data member.
3986         (Sized_incremental_binary::input_entry_readers_): New data member.
3987         (class Sized_incr_relobj): New class.
3988         (class Sized_incr_dynobj): New class.
3989         (make_sized_incremental_object): New function.
3990         (class Incremental_library): New class.
3991         * layout.cc (Free_list::num_lists): New static data member.
3992         (Free_list::num_nodes): New static data member.
3993         (Free_list::num_removes): New static data member.
3994         (Free_list::num_remove_visits): New static data member.
3995         (Free_list::num_allocates): New static data member.
3996         (Free_list::num_allocate_visits): New static data member.
3997         (Free_list::init): New function.
3998         (Free_list::remove): New function.
3999         (Free_list::allocate): New function.
4000         (Free_list::dump): New function.
4001         (Free_list::print_stats): New function.
4002         (Layout_task_runner::run): Resize output file for incremental updates.
4003         (Layout::Layout): Initialize new data members.
4004         (Layout::set_incremental_base): New function.
4005         (Layout::init_fixed_output_section): New function.
4006         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4007         incremental updates.
4008         (Layout::create_gold_note): Do not create gold note section for
4009         incremental updates.
4010         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4011         for incremental updates.
4012         (Layout::set_section_offsets): For incremental updates, allocate space
4013         from free list.
4014         (Layout::create_symtab_sections): Layout with offsets relative to
4015         start of section; for incremental updates, allocate space from free
4016         list.
4017         (Layout::create_shdrs): For incremental updates, allocate space from
4018         free list.
4019         (Layout::finish_dynamic_section): For incremental updates, do not
4020         check --as-needed (fixed in subsequent patch).
4021         * layout.h (class Free_list): New class.
4022         (Layout::set_incremental_base): New function.
4023         (Layout::incremental_base): New function.
4024         (Layout::init_fixed_output_section): New function.
4025         (Layout::allocate): New function.
4026         (Layout::incremental_base_): New data member.
4027         (Layout::free_list_): New data member.
4028         * main.cc (main): Print Free_list statistics.
4029         * object.cc (Relobj::finalize_incremental_relocs): Add
4030         clear_counts parameter; clear counts only when clear_counts is set.
4031         (Sized_relobj::Sized_relobj): Initialize new base class.
4032         (Sized_relobj::do_layout): Don't report special sections.
4033         (Sized_relobj::do_for_all_local_got_entries): New function.
4034         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4035         symtab_off to all symbol table offsets.
4036         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4037         * object.h (class Got_offset_list): Move to top of file.
4038         (Object::Object): Allow case where input_file == NULL.
4039         (Object::~Object): Likewise.
4040         (Object::input_file): Assert that input_file != NULL.
4041         (Object::lock): Allow case where input_file == NULL.
4042         (Object::unlock): Likewise.
4043         (Object::is_locked): Likewise.
4044         (Object::token): Likewise.
4045         (Object::release): Likewise.
4046         (Object::is_incremental): New function.
4047         (Object::get_mtime): New function.
4048         (Object::for_all_local_got_entries): New function.
4049         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4050         (Object::set_is_in_system_directory): New function.
4051         (Object::is_in_system_directory): New function.
4052         (Object::do_is_incremental): New function.
4053         (Object::do_get_mtime): New function.
4054         (Object::do_for_all_local_got_entries): New function.
4055         (Object::is_in_system_directory_): New data member.
4056         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4057         (class Sized_relobj_base): New class.
4058         (class Sized_relobj): Derive from Sized_relobj_base.
4059         (class Sized_relobj::Symbols): Redeclare from base class.
4060         (class Sized_relobj::local_got_offset_list): Remove.
4061         (class Sized_relobj::Output_sections): Redeclare from base class.
4062         (class Sized_relobj::do_for_all_local_got_entries): New function.
4063         (class Sized_relobj::write_local_symbols): Add offset parameter.
4064         (class Sized_relobj::local_symbol_offset_): Update comment.
4065         (class Sized_relobj::local_dynsym_offset_): Update comment.
4066         * options.cc (Input_arguments::add_file): Remove const.
4067         * options.h (Input_file_argument::Input_file_argument):
4068         Initialize arg_serial_ (all constructors).
4069         (Input_file_argument::set_arg_serial): New function.
4070         (Input_file_argument::arg_serial): New function.
4071         (Input_file_argument::arg_serial_): New data member.
4072         (Input_arguments::Input_arguments): Initialize file_count_.
4073         (Input_arguments::add_file): Remove const.
4074         (Input_arguments::number_of_input_files): New function.
4075         (Input_arguments::file_count_): New data member.
4076         (Command_line::number_of_input_files): Call
4077         Input_arguments::number_of_input_files.
4078         * output.cc (Output_segment_headers::Output_segment_headers):
4079         Set current size.
4080         (Output_section::Input_section::current_data_size): New function.
4081         (Output_section::Output_section): Initialize new data members.
4082         (Output_section::add_input_section): Don't do merge sections for
4083         an incremental link; allocate space from free list for an
4084         incremental update.
4085         (Output_section::add_output_section_data): Allocate space from
4086         free list for an incremental update.
4087         (Output_section::update_data_size): New function.
4088         (Output_section::set_fixed_layout): New function.
4089         (Output_section::reserve): New function.
4090         (Output_segment::set_section_addresses): Remove const.
4091         (Output_segment::set_section_list_addresses): Remove const; allocate
4092         space from free list for an incremental update.
4093         (Output_segment::set_offset): Adjust size of RELRO segment for an
4094         incremental update.
4095         * output.h (Output_data::current_data_size): Move here from
4096         child classes.
4097         (Output_data::pre_finalize_data_size): New function.
4098         (Output_data::update_data_size): New function.
4099         (Output_section_headers::update_data_size): new function.
4100         (Output_section_data_build::current_data_size): Move to Output_data.
4101         (Output_data_strtab::update_data_size): New function.
4102         (Output_section::current_data_size): Move to Output_data.
4103         (Output_section::set_fixed_layout): New function.
4104         (Output_section::has_fixed_layout): New function.
4105         (Output_section::reserve): New function.
4106         (Output_section::update_data_size): New function.
4107         (Output_section::has_fixed_layout_): New data member.
4108         (Output_section::free_list_): New data member.
4109         (Output_segment::set_section_addresses): Remove const.
4110         (Output_segment::set_section_list_addresses): Remove const.
4111         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4112         New function.
4113         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4114         New function.
4115         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4116         parameter when calling Add_symbols constructor; store argument
4117         serial number for members of a lib group.
4118         (Add_symbols::locks): Allow case where token == NULL.
4119         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4120         (Read_member::~Read_member): New function.
4121         (Read_member::is_runnable): New function.
4122         (Read_member::locks): New function.
4123         (Read_member::run): New function.
4124         (Check_script::~Check_script): New function.
4125         (Check_script::is_runnable): New function.
4126         (Check_script::locks): New function.
4127         (Check_script::run): New function.
4128         (Check_library::~Check_library): New function.
4129         (Check_library::is_runnable): New function.
4130         (Check_library::locks): New function.
4131         (Check_library::run): New function.
4132         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4133         (Add_symbols::library_): New data member.
4134         (class Read_member): New class.
4135         (class Check_script): New class.
4136         (class Check_library): New class.
4137         * reloc.cc (Read_relocs::is_runnable): Allow case where
4138         token == NULL.
4139         (Read_relocs::locks): Likewise.
4140         (Scan_relocs::locks): Likewise.
4141         (Relocate_task::locks): Likewise.
4142         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4143         to clear counters.
4144         (Sized_relobj::incremental_relocs_scan): Fix comment.
4145         (Sized_relobj::do_relocate): Pass output file offset to
4146         write_local_symbols.
4147         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4148         from class declaration.
4149         * script.cc (read_input_script): Allocate Script_info; pass
4150         argument serial number to report_script.
4151         * script.h (class Script_info): Move to incremental.h.
4152         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4153         * symtab.h (Symbol_table::add_from_incrobj): New function.
4154         (Symbol_table::set_file_offset): New function.
4155
4156 2011-04-05  Cary Coutant  <ccoutant@google.com>
4157
4158         * incremental-dump.cc (dump_incremental_inputs): Change signature
4159         to take a Sized_incremental_binary; change caller.  Use readers
4160         in Sized_incremental_binary.
4161         * incremental.cc
4162         (Sized_incremental_binary::find_incremental_inputs_sections):
4163         Rename do_find_incremental_inputs_sections to this.
4164         (Sized_incremental_binary::setup_readers): New function.
4165         (Sized_incremental_binary::do_check_inputs): Check
4166         has_incremental_info_ flag; move setup code to setup_readers;
4167         use input readers.
4168         (Sized_incremental_binary::do_file_is_unchanged): New function.
4169         (Sized_incremental_binary::do_get_input_reader): New function.
4170         * incremental.h (class Incremental_binary): Move to end of file.
4171         (Incremental_binary::file_is_unchanged): New function.
4172         (Incremental_binary::do_file_is_unchanged): New function.
4173         (Incremental_binary::Input_reader): New class.
4174         (Incremental_binary::get_input_reader): New function.
4175         (class Sized_incremental_binary): Move to end of file.
4176         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4177         input section reader classes.
4178         (Sized_incremental_binary::has_incremental_info): New function.
4179         (Sized_incremental_binary::inputs_reader): New function.
4180         (Sized_incremental_binary::symtab_reader): New function.
4181         (Sized_incremental_binary::relocs_reader): New function.
4182         (Sized_incremental_binary::got_plt_reader): New function.
4183         (Sized_incremental_binary::do_file_is_unchanged): New function.
4184         (Sized_incremental_binary::Sized_input_reader): New class.
4185         (Sized_incremental_binary::get_input_reader): New function.
4186         (Sized_incremental_binary::find_incremental_inputs_sections):
4187         Rename do_find_incremental_inputs_sections to this.
4188         (Sized_incremental_binary::setup_readers): New function.
4189         (Sized_incremental_binary::has_incremental_info_): New data member.
4190         (Sized_incremental_binary::inputs_reader_): New data member.
4191         (Sized_incremental_binary::symtab_reader_): New data member.
4192         (Sized_incremental_binary::relocs_reader_): New data member.
4193         (Sized_incremental_binary::got_plt_reader_): New data member.
4194         (Sized_incremental_binary::current_input_file_): New data member.
4195
4196 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4197
4198         PR gold/12640
4199         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4200         violation.
4201
4202 2011-03-30  Cary Coutant  <ccoutant@google.com>
4203
4204         * archive.cc (Archive::include_member): Adjust call to report_object.
4205         (Add_archive_symbols::run): Add script_info to call to
4206         report_archive_begin.
4207         (Lib_group::include_member): Adjust call to report_object.
4208         (Add_lib_group_symbols::run): Adjust call to report_object.
4209         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4210         blocks.  Add object count for script input files.
4211         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4212         script_info parameter; change all callers.
4213         (Incremental_inputs::report_object): Add script_info parameter;
4214         change all callers.
4215         (Incremental_inputs::report_script): Store backpointer to
4216         incremental info entry.
4217         (Output_section_incremental_inputs::set_final_data_size): Record
4218         additional information for scripts.
4219         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4220         * incremental.h (Incremental_script_entry::add_object): New function.
4221         (Incremental_script_entry::get_object_count): New function.
4222         (Incremental_script_entry::get_object): New function.
4223         (Incremental_script_entry::objects_): New data member; adjust
4224         constructor.
4225         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4226         (Incremental_inputs::report_object): Add script_info parameter.
4227         (Incremental_inputs_reader::get_object_count): New function.
4228         (Incremental_inputs_reader::get_object_offset): New function.
4229         * options.cc (Input_arguments::add_file): Return reference to
4230         new input argument.
4231         * options.h (Input_argument::set_script_info): New function.
4232         (Input_argument::script_info): New function.
4233         (Input_argument::script_info_): New data member; adjust all
4234         constructors.
4235         (Input_file_group::add_file): Return reference to new input argument.
4236         (Input_file_lib::add_file): Likewise.
4237         (Input_arguments::add_file): Likewise.
4238         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4239         * script.cc (Parser_closure::Parser_closure): Add script_info
4240         parameter; adjust all callers.
4241         (Parser_closure::script_info): New function.
4242         (Parser_closure::script_info_): New data member.
4243         (read_input_script): Report scripts earlier to incremental info.
4244         (script_add_file): Set script_info in Input_argument.
4245         (script_add_library): Likewise.
4246         * script.h (Script_options::Script_info): Rewrite class.
4247
4248 2011-03-29  Cary Coutant  <ccoutant@google.com>
4249
4250         * archive.cc (Library_base::should_include_member): Move
4251         method here from class Archive.
4252         (Archive::Archive): Initialize base class.
4253         (Archive::should_include_member): Move to base class.
4254         (Archive::do_for_all_unused_symbols): New function.
4255         (Add_archive_symbols::run): Remove redundant access to
4256         incremental_inputs.
4257         (Lib_group::Lib_group): Initialize base class.
4258         (Lib_group::do_filename): New function.
4259         (Lib_group::include_member): Pass pointer to Lib_group to
4260         report_object.
4261         (Lib_group::do_for_all_unused_symbols): New function.
4262         (Add_lib_group_symbols::run): Report archive information for
4263         incremental links.
4264         * archive.h (class Library_base): New base class.
4265         (class Archive): Derive from Library_base.
4266         (Archive::filename): Move to base class.
4267         (Archive::set_incremental_info): Likewise.
4268         (Archive::incremental_info): Likewise.
4269         (Archive::Should_include): Likewise.
4270         (Archive::should_include_member): Likewise.
4271         (Archive::Armap_entry): Remove.
4272         (Archive::Unused_symbol_iterator): Remove.
4273         (Archive::unused_symbols_begin): Remove.
4274         (Archive::unused_symbols_end): Remove.
4275         (Archive::do_filename): New function.
4276         (Archive::do_get_mtime): New function.
4277         (Archive::do_for_all_unused_symbols): New function.
4278         (Archive::task_): Move to base class.
4279         (Archive::incremental_info_): Likewise.
4280         (class Lib_group): Derive from Library_base.
4281         (Lib_group::do_filename): New function.
4282         (Lib_group::do_get_mtime): New function.
4283         (Lib_group::do_for_all_unused_symbols): New function.
4284         (Lib_group::task_): Move to base class.
4285         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4286         function.
4287         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4288         function.
4289         * incremental.cc (Incremental_inputs::report_archive_begin):
4290         Use Library_base; call library's get_mtime; add incremental inputs
4291         entry before members.
4292         (class Unused_symbol_visitor): New class.
4293         (Incremental_inputs::report_archive_end): Use Library_base; use
4294         visitor class to record unused symbols; don't add incremental inputs
4295         entry after members.
4296         (Incremental_inputs::report_object): Use Library_base.
4297         * incremental.h
4298         (Incremental_archive_entry::Incremental_archive_entry): Remove
4299         unused Archive parameter.
4300         (Incremental_inputs::report_archive_begin): Use Library_base.
4301         (Incremental_inputs::report_archive_end): Likewise.
4302         (Incremental_inputs::report_object): Likewise.
4303         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4304         function.
4305         * object.h (Object::for_all_global_symbols): New function.
4306         (Object::do_for_all_global_symbols): New function.
4307         (Sized_relobj::do_for_all_global_symbols): New function.
4308         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4309         function.
4310         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4311         function.
4312
4313 2011-03-27  Ian Lance Taylor  <iant@google.com>
4314
4315         * archive.cc (Archive::interpret_header): Return -1 if something
4316         goes wrong.  Change callers accordingly.
4317
4318 2011-03-25  Cary Coutant  <ccoutant@google.com>
4319
4320         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4321         * testsuite/Makefile.in: Regenerate.
4322
4323 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4324
4325         * plugin.cc (get_view): New.
4326         (Plugin::load): Pass get_view to the plugin.
4327         (Plugin_manager::get_view): New.
4328
4329 2011-03-21  Ian Lance Taylor  <iant@google.com>
4330
4331         * testsuite/final_layout.sh: Rewrite to not use dc.
4332         * testsuite/relro_test.sh: Fail if dc is not present.
4333
4334 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4335
4336         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4337         Change == to -eq.
4338         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4339         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4340         Change == to -eq.
4341         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4342         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4343
4344 2011-03-14  Ian Lance Taylor  <iant@google.com>
4345
4346         * script-sections.cc (Sort_output_sections::script_compare):
4347         Rename from is_before, change return type.
4348         (Sort_output_sections::operator()): Adjust accordingly.
4349
4350 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4351
4352         PR gold/12572
4353         * testsuite/odr_violation2.cc: Add comment to make all error line
4354         numbers double digits.
4355         * testsuite/debug_msg.sh: Adjust expected errors.
4356
4357 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4358
4359         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4360         but mark earlier ones as non-canonical
4361         (offset_to_iterator): Update search target and example
4362         (do_addr2line): Return extra lines in a vector*
4363         (format_file_lineno): Extract from do_addr2line
4364         (one_addr2line): Add vector* out-param
4365         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4366         when a lineno entry appeared last for its instruction
4367         (Dwarf_line_info): Add vector* out-param
4368         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4369         * symtab.cc (Odr_violation_compare): Include the lineno in the
4370         comparison again.
4371         (linenos_from_loc): New. Combine the canonical line for an
4372         address with its other lines.
4373         (True_if_intersect): New. Helper functor to make
4374         std::set_intersection a query.
4375         (detect_odr_violations): Compare sets of lines instead of just
4376         one line for each function. This became less deterministic, but
4377         has fewer false positives.
4378         * symtab.h: Declarations.
4379         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4380         mix an optimized and non-optimized object in the same binary
4381         (odr_violation2.so): Same.
4382         * testsuite/Makefile.in: Regenerate from Makefile.am.
4383         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4384         * testsuite/debug_msg.sh: Update line numbers and add
4385         assertions.
4386         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4387         non-optimized context.
4388         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4389         isn't inlined, and use OdrDerived in an optimized context.
4390         * testsuite/odr_header1.h: Defines OdrDerived, where
4391         optimization will change the
4392         first-instruction-in-the-destructor's file and line number.
4393         * testsuite/odr_header2.h: Defines OdrBase.
4394
4395 2011-03-09  Ian Lance Taylor  <iant@google.com>
4396
4397         * fileread.cc (File_read::clear_views): Don't delete the whole
4398         file view.
4399
4400 2011-03-08  Ian Lance Taylor  <iant@google.com>
4401
4402         PR gold/12525
4403         * fileread.cc: #include <climits>.
4404         (GOLD_IOV_MAX): Define.
4405         (File_read::read_multiple): Limit number of entries by iov_max.
4406         * fileread.h (class File_read): Always set max_readv_entries to
4407         128.
4408
4409 2011-03-07  Ian Lance Taylor  <iant@google.com>
4410
4411         PR gold/12525
4412         * options.h (class General_options): Add -dy and -dn.
4413
4414 2011-03-02  Cary Coutant  <ccoutant@google.com>
4415
4416         * testsuite/script_test_9.t: Add TLS segment.
4417
4418 2011-03-02  Simon Baldwin  <simonb@google.com>
4419
4420         * configure.ac: Add check for gnu_indirect_function support in
4421         the toolchain building binutils.
4422         * configure: Rebuild.
4423
4424 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4425
4426         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4427         plugin only symbols.
4428         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4429         in plugin files as not needed in the symbol table.
4430
4431 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4432
4433         * output.cc (Output_section::add_input_section): Delay fill
4434         generation for section ordering.
4435
4436 2011-02-09  Ian Lance Taylor  <iant@google.com>
4437
4438         PR gold/12316
4439         * object.h (class Sized_relobj): Remove clear_local_symbols.
4440         * reloc.cc (Sized_relobj::do_relocate): Don't call
4441         clear_local_symbols.
4442
4443 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4444
4445         * plugin.cc (is_visible_from_outside): Return true for symbols
4446         in the -u option.
4447
4448 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4449
4450         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4451         filename.
4452
4453 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4454
4455         * icf.h (is_section_foldable_candidate): Change type of parameter
4456         to std::string.
4457         * icf.cc (Icf::find_identical_sections): Change type of local variable
4458         section_name to be std::string.
4459         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4460
4461 2011-01-25  Ian Lance Taylor  <iant@google.com>
4462
4463         * script.cc (script_add_extern): Rewrite to use
4464         add_symbol_reference.
4465
4466 2011-01-25  Doug Kwan  <dougkwan@google.com>
4467
4468         * icf.cc (get_section_contents): Always lock section's object.
4469
4470 2011-01-24  Ian Lance Taylor  <iant@google.com>
4471
4472         * options.h (class General_options): Accept
4473         --no-detect-odr-violations.
4474
4475 2011-01-24  Ian Lance Taylor  <iant@google.com>
4476
4477         * version.cc (version_string): Bump to 1.11.
4478
4479 2011-01-24  Ian Lance Taylor  <iant@google.com>
4480
4481         * plugin.cc (class Plugin_rescan): Define new class.
4482         (Plugin_manager::claim_file): Set any_claimed_.
4483         (Plugin_manager::save_archive): New function.
4484         (Plugin_manager::save_input_group): New function.
4485         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4486         necessary.
4487         (Plugin_manager::new_undefined_symbol): New function.
4488         (Plugin_manager::rescan): New function.
4489         (Plugin_manager::rescannable_defines): New function.
4490         (Plugin_manager::add_input_file): Set any_added_.
4491         * plugin.h (class Plugin_manager): define new fields rescannable_,
4492         undefined_symbols_, any_claimed_, and any_added_.  Declare
4493         Plugin_rescan as friend.  Declare new functions.
4494         (Plugin_manager::Rescannable): Define type.
4495         (Plugin_manager::Rescannable_list): Define type.
4496         (Plugin_manager::Undefined_symbol_list): Define type.
4497         (Plugin_manager::Plugin_manager): Initialize new fields.
4498         * archive.cc (Archive::defines_symbol): New function.
4499         (Add_archive_symbols::run): Pass archive to plugins if any.
4500         * archive.h (class Archive): Declare defines_symbol.
4501         * readsyms.cc (Input_group::~Input_group): New function.
4502         (Finish_group::run): Pass input_group to plugins if any.
4503         * readsyms.h (class Input_group): Declare destructor.
4504         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4505         any.
4506
4507 2011-01-10  Ian Lance Taylor  <iant@google.com>
4508
4509         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4510         section as relro.
4511         (Layout::set_segment_offsets): Reset increase_relro before calling
4512         set_section_addresses a second time.
4513
4514 2011-01-04  Cary Coutant  <ccoutant@google.com>
4515
4516         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4517         sections before NOBITS sections.
4518
4519 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4520
4521         * version.cc (print_version): Update copyright to 2011.
4522
4523 2010-12-23  Cary Coutant  <ccoutant@google.com>
4524
4525         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4526         of OS to this->add.  Add OD parameter to second form of the function.
4527
4528 2010-12-20  Ian Lance Taylor  <iant@google.com>
4529
4530         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4531         second of two consecutive entries with same offset.
4532
4533 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4534
4535         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4536         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4537         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4538         to avoid unneeded links against $(LDADD).
4539         * testsuite/Makefile.in: Regenerate.
4540
4541 2010-12-15  Ian Lance Taylor  <iant@google.com>
4542
4543         PR gold/12324
4544         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4545         for R_X86_64_32 and R_X86_64_PC32.
4546         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4547         ver_matching_def_pic.o.
4548         (ver_matching_def_pic.o): New target.
4549
4550 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4551
4552         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4553         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4554         Move definition before File_read::View member definitions.
4555         (File_read::View::~View): Initialize and hold lock before
4556         updating current_mapped_bytes.
4557
4558 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4559
4560         * dwarf_reader.cc: Remove outdated comment.
4561         * gold-threads.cc: Fix typo in error message.
4562         * archive.cc: Fix typos in comments.
4563         * archive.h: Likewise.
4564         * arm-reloc-property.cc: Likewise.
4565         * arm-reloc-property.h: Likewise.
4566         * arm-reloc.def: Likewise.
4567         * arm.cc: Likewise.
4568         * attributes.h: Likewise.
4569         * cref.cc: Likewise.
4570         * ehframe.cc: Likewise.
4571         * fileread.h: Likewise.
4572         * gold.h: Likewise.
4573         * i386.cc: Likewise.
4574         * icf.cc: Likewise.
4575         * incremental.h: Likewise.
4576         * int_encoding.cc: Likewise.
4577         * layout.h: Likewise.
4578         * main.cc: Likewise.
4579         * merge.h: Likewise.
4580         * object.cc: Likewise.
4581         * object.h: Likewise.
4582         * options.cc: Likewise.
4583         * readsyms.cc: Likewise.
4584         * reduced_debug_output.cc: Likewise.
4585         * reloc.cc: Likewise.
4586         * script-sections.cc: Likewise.
4587         * sparc.cc: Likewise.
4588         * symtab.h: Likewise.
4589         * target-reloc.h: Likewise.
4590         * target.cc: Likewise.
4591         * target.h: Likewise.
4592         * timer.cc: Likewise.
4593         * timer.h: Likewise.
4594         * x86_64.cc: Likewise.
4595
4596 2010-12-09  Cary Coutant  <ccoutant@google.com>
4597
4598         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4599         stack.
4600         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4601         parameter; change all callers.
4602         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4603         * options.h (warn_execstack): New option.
4604
4605 2010-12-07  Doug Kwan  <dougkwan@google.com>
4606
4607         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4608         like function call relocations.
4609
4610 2010-12-07  Ian Lance Taylor  <iant@google.com>
4611
4612         * archive.cc (Archive::get_elf_object_for_member): Permit
4613         punconfigured to be NULL.
4614         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4615         (Archive::include_member): Pass NULL to get_elf_object_for_member
4616         if we searched for the archive and this is the first included
4617         object.
4618
4619 2010-12-01  Ian Lance Taylor  <iant@google.com>
4620
4621         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4622         track_relocs_type_ field.
4623         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4624         Set track_relocs_type_.
4625         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4626         contents when using RELA relocs.
4627         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4628         reloc_map_.
4629         * reloc.cc (Track_relocs::next_addend): New function.
4630         * reloc.h (class Track_relocs): Declare next_addend.
4631
4632 2010-12-01  Ian Lance Taylor  <iant@google.com>
4633
4634         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4635         virtual destructor.
4636
4637 2010-12-01  Ian Lance Taylor  <iant@google.com>
4638
4639         * README: Update compilers known to work and fail.
4640
4641 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4642
4643         * configure.in: For --enable-gold, handle value `default' instead of
4644         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4645         not the default.
4646         * configure: Regenerate.
4647
4648 2010-11-18  Doug Kwan  <dougkwan@google.com>
4649
4650         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4651         and right_alignment to be zero.  Store result alignment only if it is
4652         greater than existing alignment.
4653
4654 2010-11-16  Cary Coutant  <ccoutant@google.com>
4655
4656         PR gold/12220
4657         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4658         Check for ".zdebug_line".
4659
4660 2010-11-16  Doug Kwan  <dougkwan@google.com>
4661             Cary Coutant  <ccoutant@google.com>
4662
4663         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4664         by reference; adjust all callers.
4665         * output.cc (Output_segment::set_section_addresses): Adjust references
4666         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4667         list is empty.
4668         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4669         end at page boundary.
4670
4671 2010-11-16  Cary Coutant  <ccoutant@google.com>
4672
4673         PR gold/12220
4674         * layout.cc (Layout::choose_output_section): Transform names of
4675         compressed sections even when using a script with a SECTIONS clause.
4676         (Layout::output_section_name): Remove code to transform
4677         compressed debug section names.
4678         * output.cc (Output_section::add_input_section): Use uncompressed
4679         section size when tracking input sections.
4680
4681 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4682
4683         * symtab.h (Symbol::NON_PIC_REF): Remove.
4684         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4685         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4686         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4687         (Symbol::use_plt_offset): Take a flags argument and pass it
4688         directly to needs_dynamic_reloc.  Restrict check for undefined
4689         weak symbols to function calls.
4690         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4691         (Target_arm::Scan::global): Use it.
4692         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4693         (Target_arm::Relocate::relocate): Likewise.
4694         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4695         parameter with an r_type parameter.  Use get_reference_flags
4696         to get the flags.
4697         (Target_arm::Relocate::relocate): Update accordingly.
4698         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4699         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4700         (Target_i386::Scan::global): Likewise.
4701         (Target_i386::Relocate::relocate): Likewise.
4702         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4703         parameter with an r_type parameter.  Use get_reference_flags
4704         to get the flags.
4705         (Target_i386::Relocate::relocate): Update accordingly.
4706         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4707         (Target_powerpc::Scan::global): Use it.
4708         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4709         (Target_powerpc::Relocate::relocate): Likewise.
4710         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4711         (Target_sparc::Scan::global): Use it.
4712         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4713         (Target_sparc::Relocate::relocate): Likewise.
4714         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4715         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4716         (Target_x86_64::Scan::global): Likewise.
4717         (Target_x86_64::Relocate::relocate): Likewise.
4718
4719 2010-11-08  Doug Kwan  <dougkwan@google.com>
4720             Cary Coutant  <ccoutant@google.com>
4721
4722         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4723         (Arm_exidx_merge_section::section_contents_): New data member.
4724         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4725         (Arm_input_section::~Arm_input_section): De-allocate memory.
4726         (Arm_input_section::original_contents_): New data member.
4727         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4728         in parameters instead of calling Object::section_contents without
4729         locking.
4730         (Arm_output_section::group_section): New parameter TASK.  Pass it
4731         to callees that need locking objects.
4732         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4733         to lock EXIDX input sections.  Fix a formatting issue.  Call
4734         Arm_exidx_merged_section::build_contents to create merged section
4735         contents.
4736         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4737         to lock object of stub table owner.
4738         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4739         TEXT_SIZE to initialize data member TEXT_SIZE_.
4740         (Arm_exidx_input_section::addralign): Fix typo in comment.
4741         (Arm_exidx_input_section::text_size): New method.
4742         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4743         that require locking objects.  Lock objects before scanning for stubs
4744         and updating local symbols.
4745         (Arm_input_section<big_endian>::init): Copy contents of original
4746         input section.
4747         (Arm_input_section<big_endian>::do_write): Use saved contents of
4748         original input section instead of calling Object::section_contents
4749         without locking.
4750         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4751         size without calling Object::section_size().
4752         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4753         for size.  Allocate a buffer for merged EXIDX entries.
4754         (Arm_exidx_merged_section::build_contents): New method.
4755         (Arm_exidx_merged_section::do_write): Move merge section contents
4756         building code to Arm_exidx_merged_section::build_contetns.  Write
4757         out contetns in buffer instead of building it on the fly.
4758         (Arm_relobj::make_exidx_input_section): Also pass text section size
4759         to Arm_exidx_input_section constructor.
4760         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4761         (Arm_dynobj::do_read_symbols): Fix memory leak.
4762         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4763         * target.h: (class Task): Add forward declaration.
4764         (Target::relax): Add new parameter TASK and pass it to
4765         Target::do_relax().
4766         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4767
4768 2010-11-05  Cary Coutant  <ccoutant@google.com>
4769
4770         PR gold/10708
4771         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4772         object when reading from the file.
4773         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4774         second layout pass.
4775         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4776         when reading section contents.
4777         (get_section_contents): Likewise.
4778         (icf::find_identical_sections): Likewise.
4779         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4780         object when reading from the file.
4781         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4782         the object when doing deferred section layout.
4783
4784 2010-11-03  Nick Clifton  <nickc@redhat.com>
4785
4786         PR gold/12001
4787         * script.h (class Symbol_assignment: name): New member.  Returns
4788         the name of the symbol.
4789         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4790         Returns true if the given symbol name is on the list of
4791         assignments wating to be processed.
4792         * archive.cc (should_incldue_member): If the symbol is undefined,
4793         check to see if it is on the list of symbols pending assignment.
4794
4795 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4796
4797         * script-sections.cc (Script_sections::find_memory_region): Check
4798         for a NULL output section pointer.
4799
4800 2010-10-29  Doug Kwan  <dougkwan@google.com>
4801
4802         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4803         Output_section::add_relaxed_input_section.
4804         * output.cc (Output_section::add_relaxed_input_section): Add new
4805         arguments LAYOUT and NAME.  Set section order index.
4806         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4807         Copy section order index.
4808         * output.h (Output_section::add_relaxed_input_section): Add new
4809         arguments LAYOUT and NAME.
4810
4811 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4812
4813         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4814         NATIVE_OR_CROSS_LINKER.
4815         * testsuite/Makefile.in: Regenerate.
4816
4817 2010-10-20  Doug Kwan  <dougkwan@google.com>
4818
4819         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4820         without SHF_LINK_ORDER flags.
4821         * layout.cc (Layout::choose_output_section): Do not filter
4822         SHF_LINK_ORDER flag in a relocatable link.
4823
4824 2010-10-17  Cary Coutant  <ccoutant@google.com>
4825
4826         * output.h (Output_segment::set_section_addresses): Change function
4827         signature.  Update all callers.
4828         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4829         sections.
4830         (Output_segment::set_section_addresses): Align after last TLS
4831         section.  Add padding before last relro section instead of after.
4832
4833 2010-10-17  Doug Kwan  <dougkwan@google.com>
4834
4835         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4836         GOT output section to be writable.
4837
4838 2010-10-14  Cary Coutant  <ccoutant@google.com>
4839
4840         * debug.h (DEBUG_INCREMENTAL): New flag.
4841         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4842         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4843         mode.
4844         * incremental.cc (report_command_line): Ignore all forms of
4845         --incremental.
4846         * layout.cc (Layout::Layout): Check parameters for incremental link
4847         mode.
4848         * options.cc (General_options::parse_incremental): New function.
4849         (General_options::parse_no_incremental): New function.
4850         (General_options::parse_incremental_full): New function.
4851         (General_options::parse_incremental_update): New function.
4852         (General_options::incremental_mode_): New data member.
4853         (General_options::finalize): Check incremental_mode_.
4854         * options.h (General_options): Update help text for --incremental.
4855         Add --no-incremental, --incremental-full, --incremental-update.
4856         (General_options::Incremental_mode): New enum type.
4857         (General_options::incremental_mode): New function.
4858         (General_options::incremental_mode_): New data member.
4859         * parameters.cc (Parameters::incremental_mode_): New data member.
4860         (Parameters::set_options): Set incremental_mode_.
4861         (Parameters::set_incremental_full): New function.
4862         (Parameters::incremental): New function.
4863         (Parameters::incremental_update): New function.
4864         (set_parameters_incremental_full): New function.
4865         * parameters.h (Parameters::set_incremental_full): New function.
4866         (Parameters::incremental): New function.
4867         (Parameters::incremental_update): New function.
4868         (Parameters::incremental_mode_): New data member.
4869         (set_parameters_incremental_full): New function.
4870         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4871         incremental link mode.
4872         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4873         (Sized_relobj::do_relocate_sections): Likewise.
4874         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4875         option.
4876         * testsuite/Makefile.in: Regenerate.
4877         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4878
4879 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4880
4881         * script-sections.h (class Script_sections): Make
4882         Sections_elements typedef public.
4883         * script-sections.cc (class Sort_output_sections): Add elements_
4884         field.  Add constructor which sets it; change all callers.
4885         (Sort_output_sections::is_before): New function.
4886         (Sort_output_sections::operator()): Call is_before.
4887         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4888         conditional.
4889         * testsuite/script_test_10.sh: New test. Test script section
4890         order.
4891         * testsuite/script_test_10.t: Likewise.
4892         * testsuite/script_test_10.s: Likewise.
4893         * testsuite/Makefile.am: Wrap the cross linker tests and the
4894         common tests into NATIVE_OR_CROSS_LINKER.
4895         (check_SCRIPTS): Add script_test_10.sh.
4896         (check_DATA): Add script_test_10.stdout.
4897         (script_test_10.o, script_test_10): New targets.
4898         (script_test_10.stdout): New target.
4899         * configure, testsuite/Makefile.in: Regenerate.
4900
4901 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4902
4903         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4904         error for the deprecated relocations.
4905         (Target_arm::Scan::global): Likewise.
4906         (Target_arm::Relocate::relocate): Likewise.
4907
4908 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4909
4910         * fileread.cc (Input_file::find_file): Initialize *found_name
4911         and *namep when using the fallback search for case 4.
4912
4913 2010-10-11  Cary Coutant  <ccoutant@google.com>
4914
4915         * options.h (class General_options): Redefine -z lazy as an alias for
4916         the negation of -z now.
4917
4918 2010-10-11  Ian Lance Taylor  <iant@google.com>
4919
4920         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4921         binding.
4922
4923 2010-10-06  Nick Clifton  <nickc@redhat.com>
4924
4925         * script-sections.cc(class Memory_region): Remove
4926         current_lma_offset_ field.  Rename current_vma_offset_ to
4927         current_offset_.  Add last_section_ field.
4928         (Memory_region::get_current_vma_address): Rename to
4929         get_current_address.
4930         (Memory_region::get_current_lma_address): Delete.
4931         (Memory_region::increment_vma_offset): Rename to
4932         increment_offset.
4933         (Memory_region::increment_lma_offset): Delete.
4934         (Memory_region::attributes_compatible): New method.  Returns
4935         true if the provided section is compatible with the region.
4936         (Memory_region::get_last_section): New method.  Returns the last
4937         section to use the region.
4938         (Memory_region::set_last_section): New method.  Stores the last
4939         section to use the region.
4940         (Script_sections::block_in_region): New method.  Returns true if
4941         a block of memory is contained within a region.
4942         (Script_sections::find_memory_region): New method.  Locates a
4943         memory region to be used to set a VMA or LMA address.
4944         (Output_section_definition::set_section_addresses): Add code to
4945         check for addresses set by memory regions.
4946         (Output_segment::set_section_addresses): Remove memory region
4947         walking code.
4948         (Script_sections::create_segment): Add a warning if a header
4949         segment is created outside of any region.
4950         * script-sections.h (class Script_sections): Add prototypes for
4951         find_memory_region and block_in_region methods.
4952         * testsuite/memory_test.s: Use .long instead of .word.
4953         * testsuite/memory_test.t: Add some more output sections.
4954         * testsuite/memory_test.sh: Update expected output.
4955
4956 2010-10-02  Doug Kwan  <dougkwan@google.com>
4957
4958         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4959         defintion to symtab.h
4960         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4961         declaration to defintion.
4962
4963 2010-10-01  Nick Clifton  <nickc@redhat.com>
4964
4965         * expression.cc (eval): Replace dummy argument with NULL.
4966         (eval_maybe_dot): Check for a NULL result section pointer.
4967         (Symbol_expression::value): Likewise.
4968         (Dot_expression::value): Likewise.
4969         (BINARY_EXPRESSION): Likewise.
4970         (Max_expression::value): Likewise.
4971         (Min_expression::value): Likewise.
4972         (Absolute_expression::value): Likewise.
4973         (Addr_expression::value_from_output_section): Likewise.
4974         (Loaddddr_expression::value_from_output_section): Likewise.
4975         (Segment_start_expression::value): Likewise.
4976         * script-sections.cc
4977         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
4978         argument with NULL.
4979         (Sections_elememt_dot_assignment::set_section_addresses):
4980         Likewise.
4981         (Output_data_expression::do_write_to_buffer): Likewise.
4982         (Output_section_definition::finalize_symbols): Likewise.
4983         (Output_section_definition::set_section_addresses): Likewise.
4984
4985 2010-09-30  Doug Kwan  <dougkwan@google.com>
4986
4987         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
4988
4989 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
4990
4991         * target.h (Target::can_icf_inline_merge_sections): New virtual
4992         function.
4993         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
4994         virtual function.
4995         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
4996         virtual function.
4997         * icf.cc (get_section_contents): Inline merge sections only when
4998         target allows it.
4999
5000 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5001
5002         * configure: Regenerate.
5003
5004 2010-09-17  Ian Lance Taylor  <iant@google.com>
5005
5006         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5007         * testsuite/Makefile.am (memory_test.o): New target.
5008         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5009         memory_test.t.
5010         * testsuite/Makefile.in: Rebuild.
5011
5012 2010-09-17  Doug Kwan  <dougkwan@google.com>
5013
5014         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5015         defintion if relocation uses GOT entries of the symbol.
5016         * testsuite/icf_safe_test.sh: Fix test.
5017         * testsuite/icf_safe_so_test.sh: Fix test.
5018
5019 2010-09-16  Cary Coutant  <ccoutant@google.com>
5020
5021         * script_sections.cc (class Memory_region): Remove "NULL" from
5022         vector initializations.
5023
5024 2010-09-15  Cary Coutant  <ccoutant@google.com>
5025
5026         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5027         Resolve forwarding symbols.
5028
5029 2010-09-15  Doug Kwan  <dougkwan@google.com>
5030
5031         * gold/testsuite/script_test_3.t: Add ARM special sections.
5032         * gold/testsuite/script_test_4.t: Same.
5033         * gold/testsuite/script_test_5.t: Same.
5034         * gold/testsuite/script_test_6.t: Same.
5035         * gold/testsuite/script_test_7.t: Same.
5036         * gold/testsuite/script_test_7.t: Same.
5037         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5038
5039 2010-09-14  Cary Coutant  <ccoutant@google.com>
5040
5041         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5042         (Target_x86_64::Relocate::relocate_tls): Replace check for
5043         saw_tls_block_reloc_ with test for executable section.
5044
5045 2010-09-12  Cary Coutant  <ccoutant@google.com>
5046
5047         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5048         position-independent executables to shared libraries need dynamic
5049         relocations.
5050         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5051         position-independent executables.
5052         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5053         * testsuite/Makefile.in: Regenerate.
5054
5055 2010-09-10  Nick Clifton  <nickc@redhat.com>
5056
5057         PR gold/11997
5058         * testsuite/memory_test.t: Discard any sections that are not
5059         needed.
5060
5061 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5062
5063         PR gold/11996
5064         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5065         "This::" to work around a bug in gcc 4.2.
5066
5067         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5068
5069 2010-09-09  Rafael Espindola  <espindola@google.com>
5070
5071         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5072         sections with different PF_X flags in the same segment.
5073         (Layout::find_first_load_seg): Search all segments to find the first
5074         one.
5075         * options.h (rosegment): New.
5076
5077 2010-09-08  Rafael Espindola  <espindola@google.com>
5078
5079         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5080
5081 2010-09-08  Doug Kwan  <dougkwan@google.com>
5082
5083         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5084         (Arm_relobj::do_relocate_sections): Add new parameter for output
5085         file to match the parent.
5086         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5087         of local symbols instead of input values.  Update code to track
5088         changes in gold::relocate_section.
5089         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5090         (Sized_relobj::compute_final_local_value_internal): New methods.
5091         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5092         body into private version of Sized_relobj::compute_final_local_value.
5093         Call the inline method.
5094         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5095         merged symbol value if there is one.
5096         (Symbol_value::has_output_value): New method defintiion.
5097         (Sized_relobj::Compute_final_local_value_status): New enum type.
5098         (Sized_relobj::compute_final_local_value): New methods.
5099         (Sized_relobj::compute_final_local_value_internal): New methods.
5100         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5101         and arm_cortex_a8.sh.
5102         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5103         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5104         New tests.
5105         * Makefile.in: Regenerate.
5106         * testsuite/arm_bl_out_of_range.s: Update test.
5107         * testsuite/thumb_bl_out_of_range.s: Ditto.
5108         * testsuite/thumb_blx_out_of_range.s: Ditto.
5109         * testsuite/arm_branch_out_of_range.sh: New file.
5110         * testsuite/arm_cortex_a8.sh: Ditto.
5111         * testsuite/arm_cortex_a8_b.s: Ditto.
5112         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5113         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5114         * testsuite/arm_cortex_a8_bl.s: Ditto.
5115         * testsuite/arm_cortex_a8_blx.s: Ditto.
5116         * testsuite/arm_cortex_a8_local.s: Ditto.
5117         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5118         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5119
5120 2010-09-08  Rafael Espindola  <espindola@google.com>
5121
5122         * Makefile.am (memory_test.stdout): Run readelf with -W.
5123         * Makefile.in: Regenerate.
5124         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5125         64 bit output.
5126
5127 2010-09-08  Rafael Espindola  <espindola@google.com>
5128
5129         * script-sections.cc (Script_sections::add_memory_region): Convert
5130         field precision to int.
5131         * script.cc (script_set_section_region, script_set_section_region):
5132         Convert field precision to int.
5133
5134 2010-09-08  Rafael Espindola  <espindola@google.com>
5135
5136         * arm.cc (do_finalize_sections): Create the __exidx_start and
5137         __exdix_end symbols even when the section is missing.
5138
5139 2010-09-08  Nick Clifton  <nickc@redhat.com>
5140
5141         * README: Remove claim that MEMORY is not supported.
5142         * expression.cc (script_exp_function_origin)
5143         (script_exp_function_length): Move from here to ...
5144         * script.cc: ... here.
5145         (script_set_section_region, script_add_memory)
5146         (script_parse_memory_attr, script_include_directive): New
5147         functions.
5148         * script-sections.cc
5149         (class Memory_region): New class.
5150         (class Output_section_definition): Add set_memory_region,
5151         set_section_vma, set_section_lma and get_section_name methods.
5152         (class Script_Sections): Add add_memory_region,
5153         find_memory_region, find_memory_region_origin,
5154         find_memory_region_length and set_memory_region methods.
5155         Have set_section_addresses method walk the list of set memory
5156         regions.
5157         Extend the print methos to display memory regions.
5158         * script-sections.h: Add prototypes for new methods.
5159         Add enum for MEMORY region attributes.
5160         * yyscript.y: Add support for parsing MEMORY regions.
5161         * script-c.h: Add prototypes for new functions.
5162         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5163         * testsuite/Makefile.in: Regenerate.
5164         * testsuite/memory_test.sh: New script.
5165         * testsuite/memory_test.s: New assembler source file.
5166         * testsuite/memory_test.t: New linker script.
5167
5168 2010-08-27  Doug Kwan  <dougkwan@google.com>
5169
5170         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5171         reference override an existing dynamic weak reference.
5172         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5173         * testsuite/Makefile.in: Regenerate.
5174         * testsuite/dyn_weak_ref.sh: New file.
5175         * testsuite/dyn_weak_ref_1.c: Ditto.
5176         * testsuite/dyn_weak_ref_2.c: Ditto.
5177
5178 2010-08-27  Ian Lance Taylor  <iant@google.com>
5179
5180         * incremental.h (class Incremental_input_entry): Add virtual
5181         destructor.
5182
5183 2010-08-27  Ian Lance Taylor  <iant@google.com>
5184
5185         * testsuite/start_lib_test_3.c: Mark t3 as used.
5186
5187 2010-08-27  Nick Clifton  <nickc@redhat.com>
5188
5189         * options.cc (version_script): Fix small typo in previous
5190         whitespace tidyup.
5191
5192 2010-08-25  Nick Clifton  <nickc@redhat.com>
5193
5194         * archive.cc: Formatting fixes: Remove whitespace between
5195         typename and following asterisk.  Remove whitespace between
5196         function name and opening parenthesis.
5197         * archive.h: Likewise.
5198         * arm.cc: Likewise.
5199         * attributes.cc: Likewise.
5200         * attributes.h: Likewise.
5201         * common.cc: Likewise.
5202         * copy-relocs.cc: Likewise.
5203         * dirsearch.h: Likewise.
5204         * dynobj.cc: Likewise.
5205         * ehframe.cc: Likewise.
5206         * ehframe.h: Likewise.
5207         * expression.cc: Likewise.
5208         * fileread.cc: Likewise.
5209         * fileread.h: Likewise.
5210         * gc.h: Likewise.
5211         * gold-threads.cc: Likewise.
5212         * gold.cc: Likewise.
5213         * i386.cc: Likewise.
5214         * icf.h: Likewise.
5215         * incremental-dump.cc: Likewise.
5216         * incremental.cc: Likewise.
5217         * layout.cc: Likewise.
5218         * layout.h: Likewise.
5219         * main.cc: Likewise.
5220         * merge.cc: Likewise.
5221         * merge.h: Likewise.
5222         * object.cc: Likewise.
5223         * object.h: Likewise.
5224         * options.cc: Likewise.
5225         * options.h: Likewise.
5226         * output.cc: Likewise.
5227         * output.h: Likewise.
5228         * plugin.cc: Likewise.
5229         * plugin.h: Likewise.
5230         * powerpc.cc: Likewise.
5231         * reloc.cc: Likewise.
5232         * script-c.h: Likewise.
5233         * script-sections.cc: Likewise.
5234         * script.cc: Likewise.
5235         * stringpool.cc: Likewise.
5236         * symtab.cc: Likewise.
5237         * symtab.h: Likewise.
5238         * target.cc: Likewise.
5239         * timer.cc: Likewise.
5240         * timer.h: Likewise.
5241         * version.cc: Likewise.
5242         * x86_64.cc: Likewise.
5243
5244 2010-08-24  Nick Clifton  <nickc@redhat.com>
5245
5246         PR 11899
5247         * layout.cc (segment_precedes): Sort segments by their physical
5248         addresses, if they have been set.
5249
5250 2010-08-23  Cary Coutant  <ccoutant@google.com>
5251
5252         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5253         symbols data.
5254         (Lib_group::include_member): Unlock object after deleting its
5255         symbols data.
5256         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5257         the bug fixed here.
5258
5259 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5260             Cary Coutant  <ccoutant@google.com>
5261
5262         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5263         constructor, and set_blocker.
5264         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5265         readsyms_blocker_.
5266         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5267         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5268         * testsuite/Makefile.am (start_lib_test): New test case.
5269         * testsuite/Makefile.in: Regenerate.
5270         * testsuite/start_lib_test_main.c: New file.
5271         * testsuite/start_lib_test_1.c: New file.
5272         * testsuite/start_lib_test_2.c: New file.
5273         * testsuite/start_lib_test_3.c: New file.
5274
5275 2010-08-19  Ian Lance Taylor  <iant@google.com>
5276
5277         * Makefile.in: Rebuild with automake 1.11.1.
5278         * aclocal.m4: Likewise.
5279         * testsuite/Makefile.in: Likewise.
5280
5281 2010-08-19  Ian Lance Taylor  <iant@google.com>
5282
5283         PR 10893
5284         * i386.cc (class Output_data_plt_i386): Update declarations.
5285         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5286         local_ifuncs_ fields.
5287         (Target_i386::do_plt_section_for_global): New function.
5288         (Target_i386::do_plt_section_for_local): New function.
5289         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5290         parameter; change all callers.  Initialize global_ifuncs_ and
5291         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5292         __rel_iplt_end.
5293         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5294         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5295         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5296         symbols.
5297         (Target_i386::make_plt_section): New function, broken out of
5298         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5299         (Target_i386::make_plt_entry): Call make_plt_section.
5300         (Target_i386::make_local_ifunc_plt_entry): New function.
5301         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5302         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5303         R_386_IRELATIVE to switch.
5304         (Target_i386::Scan::global): Likewise.
5305         (Target_i386::Relocate::relocate): Likewise.
5306         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5307         switch.
5308         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5309         (Target_x86_64::do_plt_section_for_global): New function.
5310         (Target_x86_64::do_plt_section_for_local): New function.
5311         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5312         parameter; change all callers.  If doing a static link define
5313         __rela_iplt_start and __rela_iplt_end.
5314         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5315         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5316         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5317         to point to .plt.
5318         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5319         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5320         switch.
5321         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5322         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5323         R_X86_64_IRELATIVE to switch.
5324         (Target_x86_64::Scan::global): Likewise.
5325         (Target_x86_64::Relocate::relocate): Likewise.
5326         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5327         switch.
5328         * target.h (class Target): Add plt_section_for_global and
5329         plt_section_for_local functions.  Add do_plt_section_for_global
5330         and do_plt_section_for_local virtual functions.
5331         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5332         clarifying comments.
5333         (Symbol::use_plt_offset): Handle IFUNC symbol.
5334         * object.cc (Sized_relobj::Sized_relobj): Initialize
5335         local_plt_offsets_.
5336         (Sized_relobj::local_has_plt_offset): New function.
5337         (Sized_relobj::local_plt_offset): New function.
5338         (Sized_relobj::set_local_plt_offset): New function.
5339         (Sized_relobj::do_count): Handle IFUNC symbol.
5340         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5341         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5342         is_ifunc_symbol functions.
5343         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5344         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5345         local_plt_offsets_ field.
5346         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5347         * output.h (class Output_section_data): Add non-const
5348         output_section function.
5349         (class Output_data_got): Update declarations.
5350         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5351         Add use_plt_offset parameter to global and local constructors.
5352         Change all callers.  Change local_sym_index_ field to 31 bits.
5353         Change GSYM_CODE and CONSTANT_CODE accordingly.
5354         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5355         doing a static link don't set sh_link field.
5356         (Output_data_got::Got_entry::write): Use PLT offset if
5357         appropriate.
5358         (Output_data_got::add_global_plt): New function.
5359         (Output_data_got::add_local_plt): New function.
5360         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5361         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5362         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5363         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5364         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5365         IFUNC conditional.
5366         * testsuite/ifunc-sel.h: New file.
5367         * testsuite/ifuncmain1.c: New file.
5368         * testsuite/ifuncmain1vis.c: New file.
5369         * testsuite/ifuncmod1.c: New file.
5370         * testsuite/ifuncdep2.c: New file.
5371         * testsuite/ifuncmain2.c: New file.
5372         * testsuite/ifuncmain3.c: New file.
5373         * testsuite/ifuncmod3.c: New file.
5374         * testsuite/ifuncmain4.c: New file.
5375         * testsuite/ifuncmain5.c: New file.
5376         * testsuite/ifuncmod5.c: New file.
5377         * testsuite/ifuncmain6pie.c: New file.
5378         * testsuite/ifuncmod6.c: New file.
5379         * testsuite/ifuncmain7.c: New file.
5380         * configure, testsuite/Makefile.in: Rebuild.
5381
5382 2010-08-18  Ian Lance Taylor  <iant@google.com>
5383
5384         * incremental.cc
5385         (Output_section_incremental_inputs::write_input_files): Add cast
5386         to avoid signed/unsigned comparison warning.
5387         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5388
5389 2010-08-12  Cary Coutant  <ccoutant@google.com>
5390
5391         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5392
5393 2010-08-13  Ian Lance Taylor  <iant@google.com>
5394
5395         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5396
5397 2010-08-12  Cary Coutant  <ccoutant@google.com>
5398             Doug Kwan  <dougkwan@google.com>
5399
5400         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5401         defintion overrides non-weak undef, remember that the original undef
5402         is not weak.
5403         * symtab.cc (Symbol_table::sized_write_global): For undef without
5404         an original weak binding, set binding to global in output.
5405         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5406         * testsuite/Makefile.in: Regenerate.
5407         * testsuite/strong_ref_weak_def.sh: New file.
5408         * testsuite/strong_ref_weak_def_1.c: Ditto.
5409         * testsuite/strong_ref_weak_def_2.c: Ditto.
5410
5411 2010-08-12  Cary Coutant  <ccoutant@google.com>
5412
5413         * testsuite/incremental_test.sh: Rewrite.
5414         * testsuite/incremental_test_1.c: Rewrite.
5415         * testsuite/incremental_test_2.c: Rewrite.
5416
5417 2010-08-12  Cary Coutant  <ccoutant@google.com>
5418
5419         * arm.cc (Target_arm::got_size): Add const.
5420         (Target_arm::got_entry_count): New function.
5421         (Target_arm::plt_entry_count): New function.
5422         (Target_arm::first_plt_entry_offset): New function.
5423         (Target_arm::plt_entry_size): New function.
5424         (Output_data_plt_arm::entry_count): New function.
5425         (Output_data_plt_arm::first_plt_entry_offset): New function.
5426         (Output_data_plt_arm::get_plt_entry_size): New function.
5427         * i386.cc (Target_i386::got_size): Add const.
5428         (Target_i386::got_entry_count): New function.
5429         (Target_i386::plt_entry_count): New function.
5430         (Target_i386::first_plt_entry_offset): New function.
5431         (Target_i386::plt_entry_size): New function.
5432         (Output_data_plt_i386::entry_count): New function.
5433         (Output_data_plt_i386::first_plt_entry_offset): New function.
5434         (Output_data_plt_i386::get_plt_entry_size): New function.
5435         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5436         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5437         * incremental.cc: Include target.h.
5438         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5439         parameter.  Adjust all callers.  Find incremental_got_plt section.
5440         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5441         section.
5442         (Output_section_incremental_inputs::set_final_data_size): Calculate
5443         size of incremental_got_plt section.
5444         (Output_section_incremental_inputs::do_write): Write the
5445         incremental_got_plt section.
5446         (Got_plt_view_info): New struct.
5447         (Local_got_offset_visitor): New class.
5448         (Global_got_offset_visitor): New class.
5449         (Global_symbol_visitor_got_plt): New class.
5450         (Output_section_incremental_inputs::write_got_plt): New function.
5451         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5452         Add parameter.  Adjust all callers.
5453         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5454         (Incremental_inputs::got_plt_section): New function.
5455         (Incremental_inputs::got_plt_section_): New data member.
5456         (Incremental_got_plt_reader): New class.
5457         * layout.cc (Layout::create_incremental_info_sections): Add the
5458         incremental_got_plt section.
5459         * object.h (Got_offset_list::get_list): New function.
5460         (Got offset_list::for_all_got_offsets): New function.
5461         (Sized_relobj::local_got_offset_list): New function.
5462         * powerpc.cc (Target_powerpc::got_size): Add const.
5463         (Target_powerpc::got_entry_count): New function.
5464         (Target_powerpc::plt_entry_count): New function.
5465         (Target_powerpc::first_plt_entry_offset): New function.
5466         (Target_powerpc::plt_entry_size): New function.
5467         (Output_data_plt_powerpc::entry_count): New function.
5468         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5469         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5470         * sparc.cc (Target_sparc::got_size): Add const.
5471         (Target_sparc::got_entry_count): New function.
5472         (Target_sparc::plt_entry_count): New function.
5473         (Target_sparc::first_plt_entry_offset): New function.
5474         (Target_sparc::plt_entry_size): New function.
5475         (Output_data_plt_sparc::entry_count): New function.
5476         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5477         (Output_data_plt_sparc::get_plt_entry_size): New function.
5478         * symtab.h (Symbol::got_offset_list): New function.
5479         (Symbol_table::for_all_symbols): New function.
5480         * target.h (Sized_target::got_entry_count): New function.
5481         (Sized_target::plt_entry_count): New function.
5482         (Sized_target::plt_entry_size): New function.
5483         * x86_64.cc (Target_x86_64::got_size): Add const.
5484         (Target_x86_64::got_entry_count): New function.
5485         (Target_x86_64::plt_entry_count): New function.
5486         (Target_x86_64::first_plt_entry_offset): New function.
5487         (Target_x86_64::plt_entry_size): New function.
5488         (Output_data_plt_x86_64::entry_count): New function.
5489         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5490         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5491
5492 2010-08-12  Cary Coutant  <ccoutant@google.com>
5493
5494         * archive.cc: Include incremental.h.
5495         (Archive::Archive): Initialize incremental_info_.
5496         (Archive::include_member): Record archive members in incremental info.
5497         (Add_archive_symbols::run): Record begin and end of an archive in
5498         incremental info.
5499         (Lib_group::include_member): Record objects in incremental info.
5500         * archive.h (Incremental_archive_entry): Forward declaration.
5501         (Archive::set_incremental_info): New member function.
5502         (Archive::incremental_info): New member function.
5503         (Archive::Unused_symbol_iterator): New class.
5504         (Archive::unused_symbols_begin): New member function.
5505         (Archive::unused_symbols_end): New member function.
5506         (Archive::incremental_info_): New data member.
5507         * incremental-dump.cc (find_input_containing_global): New function.
5508         (dump_incremental_inputs): Dump new incremental info sections.
5509         * incremental.cc: Include symtab.h.
5510         (Output_section_incremental_inputs): New class.
5511         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5512         new incremental info sections.
5513         (Sized_incremental_binary::do_check_inputs): Likewise.
5514         (Incremental_inputs::report_archive): Remove.
5515         (Incremental_inputs::report_archive_begin): New function.
5516         (Incremental_inputs::report_archive_end): New function.
5517         (Incremental_inputs::report_object): New function.
5518         (Incremental_inputs::finalize_inputs): Remove.
5519         (Incremental_inputs::report_input_section): New function.
5520         (Incremental_inputs::report_script): Rewrite.
5521         (Incremental_inputs::finalize): Do nothing but finalize string table.
5522         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5523         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5524         (Incremental_inputs::create_data_sections): New function.
5525         (Incremental_inputs::relocs_entsize): New function.
5526         (Output_section_incremental_inputs::set_final_data_size): New function.
5527         (Output_section_incremental_inputs::do_write): New function.
5528         (Output_section_incremental_inputs::write_header): New function.
5529         (Output_section_incremental_inputs::write_input_files): New function.
5530         (Output_section_incremental_inputs::write_info_blocks): New function.
5531         (Output_section_incremental_inputs::write_symtab): New function.
5532         * incremental.h (Incremental_script_entry): Forward declaration.
5533         (Incremental_object_entry): Forward declaration.
5534         (Incremental_archive_entry): Forward declaration.
5535         (Incremental_inputs): Forward declaration.
5536         (Incremental_inputs_header_data): Remove.
5537         (Incremental_inputs_header): Remove.
5538         (Incremental_inputs_header_write): Remove.
5539         (Incremental_inputs_entry_data): Remove.
5540         (Incremental_inputs_entry): Remove.
5541         (Incremental_inputs_entry_write): Remove.
5542         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5543         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5544         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5545         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5546         Likewise.
5547         (Incremental_input_entry): New class.
5548         (Incremental_script_entry): New class.
5549         (Incremental_object_entry): New class.
5550         (Incremental_archive_entry): New class.
5551         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5552         (Incremental_inputs::report_inputs): Remove.
5553         (Incremental_inputs::report_archive): Remove.
5554         (Incremental_inputs::report_archive_begin): New function.
5555         (Incremental_inputs::report_archive_end): New function.
5556         (Incremental_inputs::report_object): Change prototype.
5557         (Incremental_inputs::report_input_section): New function.
5558         (Incremental_inputs::report_script): Change prototype.
5559         (Incremental_inputs::get_reloc_count): New function.
5560         (Incremental_inputs::set_reloc_count): New function.
5561         (Incremental_inputs::create_data_sections): New function.
5562         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5563         (Incremental_inputs::inputs_section): New function.
5564         (Incremental_inputs::symtab_section): New function.
5565         (Incremental_inputs::relocs_section): New function.
5566         (Incremental_inputs::get_stringpool): Add const.
5567         (Incremental_inputs::command_line): Add const.
5568         (Incremental_inputs::inputs): Remove.
5569         (Incremental_inputs::command_line_key): New function.
5570         (Incremental_inputs::input_file_count): New function.
5571         (Incremental_inputs::input_files): New function.
5572         (Incremental_inputs::relocs_entsize): New function.
5573         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5574         (Incremental_inputs::finalize_inputs): Remove.
5575         (Incremental_inputs::Input_info): Remove.
5576         (Incremental_inputs::lock_): Remove.
5577         (Incremental_inputs::inputs_): Change type.
5578         (Incremental_inputs::inputs_map_): Remove.
5579         (Incremental_inputs::current_object_entry_): New data member.
5580         (Incremental_inputs::inputs_section_): New data member.
5581         (Incremental_inputs::symtab_section_): New data member.
5582         (Incremental_inputs::relocs_section_): New data member.
5583         (Incremental_inputs::reloc_count_): New data member.
5584         (Incremental_inputs_reader): New class.
5585         (Incremental_symtab_reader): New class.
5586         (Incremental_relocs_reader): New class.
5587         * layout.cc (Layout::finalize): Move finalization of incremental info
5588         and creation of incremental info sections to follow finalization of
5589         symbol table.  Set offsets for postprocessing sections.
5590         (Layout::create_incremental_info_sections): Call
5591         Incremental_inputs::create_data_sections.  Add incremental symtab
5592         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5593         sections to layout after input sections.
5594         * layout.h (struct Timespec): Forward declaration.
5595         (Layout::incremental_inputs): Add const.
5596         (Layout::create_incremental_info_sections): Add parameter.
5597         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5598         * object.cc: Include incremental.h.
5599         (Relobj::finalize_incremental_relocs): New function.
5600         (Sized_relobj::do_layout): Record input sections in incremental info.
5601         * object.h (Object::output_section): New function.
5602         (Object::output_section_offset): Moved from Relobj.
5603         (Object::get_incremental_reloc_base): New function.
5604         (Object::get_incremental_reloc_count): New function.
5605         (Object::do_output_section): New function.
5606         (Object::do_output_section_offset): Moved from Relobj.
5607         (Object::do_get_incremental_reloc_base): New function.
5608         (Object::do_get_incremental_reloc_count): New function.
5609         (Object::Object): Initialize new data members.
5610         (Relobj::output_section): Renamed do_output_section and moved to
5611         protected.
5612         (Relobj::output_section_offset): Moved to Object.
5613         (Relobj::do_get_incremental_reloc_base): New function.
5614         (Relobj::do_get_incremental_reloc_count): New function.
5615         (Relobj::allocate_incremental_reloc_counts): New function.
5616         (Relobj::count_incremental_reloc): New function.
5617         (Relobj::finalize_incremental_relocs): New function.
5618         (Relobj::next_incremental_reloc_index): New function.
5619         (Relobj::reloc_counts_): New data member.
5620         (Relobj::reloc_bases_): New data member.
5621         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5622         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5623         (Sized_relobj::incremental_relocs_scan): New function.
5624         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5625         (Sized_relobj::incremental_relocs_write): New function.
5626         (Sized_relobj::incremental_relocs_write_reltype): New function.
5627         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5628         incremental link.
5629         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5630         archives and object files elsewhere.
5631         (Add_symbols::run): Report object files here.
5632         (Finish_group::run): Report end of archive at end of group.
5633         * reloc.cc: Include layout.h, incremental.h.
5634         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5635         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5636         (Sized_relobj::incremental_relocs_scan): New function.
5637         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5638         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5639         (Sized_relobj::incremental_relocs_write): New function.
5640         (Sized_relobj::incremental_relocs_write_reltype): New function.
5641         * script.cc (read_input_script): Rewrite test for incremental link.
5642         Change call to Incremental_inputs::report_script.
5643         * symtab.h (Symbol_table::first_global_index): New function.
5644         (Symbol_table::output_count): New function.
5645
5646 2010-08-12  Doug Kwan  <dougkwan@google.com>
5647
5648         * arm.cc (Target_arm::merge_object_attributes): Check command line
5649         options --no-wchar-size-warning and --no-enum-size-warning.
5650         * options.h (General_options): Add ld-compatible options
5651         --no-enum-size-warning and --no-wchar-size-warning.
5652
5653 2010-08-04  Ian Lance Taylor  <iant@google.com>
5654
5655         * x86_64.cc (Target_x86_64::Scan::local): Use
5656         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5657         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5658         (Target_x86_64::Scan::global): Likewise.
5659         (Target_x86_64::Relocate::relocate): Likewise.
5660         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5661         Likewise.
5662
5663 2010-08-03  Cary Coutant  <ccoutant@google.com>
5664
5665         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5666         to reserve space in merged_strings vector. Keep total input size
5667         for stats.
5668         (Output_merge_string::do_print_merge_stats): Print total input size.
5669         * merge.h (Output_merge_string): Add input_size_ field.
5670         * stringpool.cc (Stringpool_template::string_length): Move
5671         implementations out of Stringpool_template class and place in
5672         stringpool.h.
5673         * stringpool.h (string_length): Move out of Stringpool_template.
5674
5675 2010-08-03  Ian Lance Taylor  <iant@google.com>
5676
5677         PR 11712
5678         * layout.cc (relaxation_loop_body): If address of load segment is
5679         set, adjust address to include headers if possible.
5680
5681 2010-08-03  Ian Lance Taylor  <iant@google.com>
5682
5683         * version.cc (version_string): Bump to 1.10.
5684
5685 2010-08-03  Ian Lance Taylor  <iant@google.com>
5686
5687         PR 11805
5688         * layout.h (enum Output_section_order): Define.
5689         (class Layout): Update declarations.
5690         * layout.cc (Layout::get_output_section): Add order parameter.
5691         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5692         is_first_non_relro parameters.  Change all callers.
5693         (Layout::choose_output_section): Likewise.
5694         (Layout::add_output_section_data): Likewise.
5695         (Layout::make_output_section): Likewise.  Set order.
5696         (Layout::default_section_order): New function.
5697         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5698         * output.cc (Output_section::Output_section): Initialize order_.
5699         Don't initialize deleted fields.
5700         (Output_segment::Output_segment): Don't initialize deleted
5701         fields.
5702         (Output_segment::add_output_section_to_load): New function
5703         replacing add_output_section.  Change all callers to call this or
5704         add_output_section_to_nonload.
5705         (Output_segment::add_output_section_to_nonload): New function.
5706         (Output_segment::remove_output_section): Rewrite.
5707         (Output_segment::add_initial_output_data): Likewise.
5708         (Output_segment::has_any_data_sections): Likewise.
5709         (Output_segment::is_first_section_relro): Likewise.
5710         (Output_segment::maximum_alignment): Likewise.
5711         (Output_segment::has_dynamic_reloc): New function replacing
5712         dynamic_reloc_count.  Change all callers.
5713         (Output_segment::has_dynamic_reloc_list): New function replacing
5714         dynamic_reloc_count_list.  Change all callers.
5715         (Output_segment::set_section_addresses): Rewrite.
5716         (Output_segment::set_offset): Rewrite.
5717         (Output_segment::find_first_and_last_list): Remove.
5718         (Output_segment::set_tls_offsets): Rewrite.
5719         (Output_segment::first_section_load_address): Likewise.
5720         (Output_segment::output_section_count): Likewise.
5721         (Output_segment::section_with_lowest_load_address): Likewise.
5722         (Output_segment::write_section_headers): Likewise.
5723         (Output_segment::print_sections_to_map): Likewise.
5724         * output.h (class Output_data): Remove dynamic_reloc_count_
5725         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5726         (Output_data::add_dynamic_reloc): Rewrite.
5727         (Output_data::has_dynamic_reloc): New function.
5728         (Output_data::dynamic_reloc_count): Remove.
5729         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5730         is_last_relro_, is_first_non_relro_, is_interp_,
5731         is_dynamic_linker_section_ fields.  Add order and set_order
5732         functions.  Remove is_relro_local, set_is_relro_local,
5733         is_last_relro, set_is_last_relro, is_first_non_relro,
5734         set_is_first_non_relro functions, is_interp, set_is_interp,
5735         is_dynamic_linker_section, and set_is_dynamic_linker_section
5736         functions.
5737         (class Output_segment): Change Output_data_list from std::list to
5738         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5739         output_bss_ fields.  Update declarations.
5740
5741 2010-08-02  Ian Lance Taylor  <iant@google.com>
5742
5743         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5744         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5745         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5746
5747 2010-08-02  Ian Lance Taylor  <iant@google.com>
5748
5749         PR 11855
5750         * script.cc (Script_options::Script_options): Initialize
5751         symbol_definitions_ and symbol_references_.
5752         (Script_options::add_symbol_assignment): Update
5753         symbol_definitions_ and symbol_references_.
5754         (Script_options::add_symbol_reference): New function.
5755         (script_symbol): New function.
5756         * script.h (class Script_options): Add symbol_definitions_ and
5757         symbol_references_ fields.
5758         (Script_options::referenced_const_iterator): New type.
5759         (Script_options::referenced_begin): New function.
5760         (Script_options::referenced_end): New function.
5761         (Script_options::is_referenced): New function.
5762         (Script_options::any_unreferenced): New function.
5763         * script-c.h (script_symbol): Declare.
5764         * yyscript.y (exp): Call script_symbol.
5765         * symtab.cc: Include "script.h".
5766         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5767         Change all callers.  Check symbols referenced by scripts.
5768         (Symbol_table::add_undefined_symbols_from_command_line): Add
5769         layout parameter.  Change all callers.
5770         (Symbol_table::do_add_undefined_symbols_from_command_line):
5771         Likewise.  Break out loop body.  Check symbols referenced by
5772         scripts.
5773         (Symbol_table::add_undefined_symbol_from_command_line): New
5774         function broken out of
5775         do_add_undefined_symbols_from_command_line.
5776         * symtab.h (class Symbol_table): Update declarations.
5777         * archive.cc: Include "layout.h".
5778         (Archive::should_include_member): Add layout parameter.  Change
5779         all callers.  Check for symbol mentioned in expression.
5780         * archive.h (class Archive): Update declaration.
5781         * object.cc (Sized_relobj::do_should_include_member): Add layout
5782         parameter.
5783         * object.h (Object::should_include_member): Add layout parameter.
5784         Change all callers.
5785         (Object::do_should_include_member): Add layout parameter.
5786         (class Sized_relobj): Update declaration.
5787         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5788         parameter.
5789         * dynobj.h (class Sized_dynobj): Update declaration.
5790         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5791         layout parameter.
5792         * plugin.h (class Sized_pluginobj): Update declaration.
5793
5794 2010-08-02  Ian Lance Taylor  <iant@google.com>
5795
5796         PR 11866
5797         * output.cc (Output_segment::set_offset): Search for the first and
5798         last sections rather than assuming that the list is in order.
5799         (Output_segment::find_first_and_last_list): New function.
5800         * output.h (class Output_segment): Update declarations.
5801         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5802         (relro_strip_test_SOURCES): New variable.
5803         (relro_strip_test_DEPENDENCIES): New variable.
5804         (relro_strip_test_LDFLAGS): New variable.
5805         (relro_strip_test_LDADD): New variable.
5806         (relro_strip_test.so): New target.
5807
5808 2010-08-02  Ian Lance Taylor  <iant@google.com>
5809
5810         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5811         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5812         (Target_i386::got_tlsdesc_section): New function.
5813         (Target_i386::got_section): Create space for GOT entries for
5814         TLSDESC relocations.
5815         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5816         R_386_TLS_GOTDESC.
5817         (Target_i386::Scan::global): Likewise.
5818         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5819         using TLSDESC GOT.
5820         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5821         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5822         (Target_x86_64::got_tlsdesc_section): New function.
5823         (Target_x86_64::got_section): Create space for GOT entries for
5824         TLSDESC relocations.
5825         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5826         R_386_TLS_GOTDESC.
5827         (Target_x86_64::Scan::global): Likewise.
5828         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5829         using TLSDESC GOT.
5830
5831 2010-08-02  Ian Lance Taylor  <iant@google.com>
5832
5833         * testsuite/final_layout.sh: Use dc to convert from hex to
5834         decimal.
5835
5836 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5837
5838         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5839         paramter to the call to gold::gc_process_relocs.
5840         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5841         paramter to the call to gold::gc_process_relocs.
5842         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5843         parameter to the call to gold::gc_process_relocs.
5844         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5845         template parameter to the call to gold::gc_process_relocs.
5846         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5847         paramter to the call to gold::gc_process_relocs.
5848         * gc.h (get_embedded_addend_size): New function.
5849         (gc_process_relocs): Save the size of the reloc for use by ICF.
5850         * icf.cc (get_section_contents): Get the addend from the text section
5851         for SHT_REL relocation sections.
5852         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5853         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5854         * int_encoding.h (read_from_pointer): New overloaded function.
5855         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5856         * testsuite/icf_sht_rel_addend_test.sh: New file.
5857         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5858         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5859
5860 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5861
5862         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5863         * Makefile.in: Regenerate.
5864         * testsuite/Makefile.in: Regenerate.
5865
5866 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5867
5868         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5869         * gold/testsuite/debug_msg.cc: Likewise.
5870         * gold/testsuite/odr_violation1.cc
5871         * gold/testsuite/odr_violation2.cc
5872
5873 2010-07-21  Cary Coutant  <ccoutant@google.com>
5874
5875         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5876         string, and length fields.
5877         (Output_merge_string::Merged_strings_list): New type.
5878         (Output_merge_string::Merged_strings_lists): New typedef.
5879         (Output_merge_string): Replace merged_strings_ with
5880         merged_strings_lists_.
5881         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5882         Merged_strings_list per input object and section.  Don't store pointer
5883         to the string.  Don't store length with each merged string entry.
5884         (Output_merge_string::finalize_merged_data): Loop over list of merged
5885         strings lists.  Recompute length of each merged string.
5886
5887 2010-07-15  Cary Coutant  <ccoutant@google.com>
5888
5889         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5890         here.
5891
5892 2010-07-14  Ian Lance Taylor  <iant@google.com>
5893
5894         * descriptors.cc (Descriptors::open): Report correct name in error
5895         message.
5896
5897 2010-07-13  Doug Kwan  <dougkwan@google.com>
5898
5899         * arm.cc (Arm_input_section::Arm_input_section): For a
5900         SHT_ARM_EXIDX section, always keeps the input sections.
5901         (Arm_input_section::set_exidx_section_link): New method.
5902         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5903         has_errors_ to false.
5904         (Arm_exidx_input_section::has_errors,
5905         Arm_exidx_input_section::set_has_errors): New methods.
5906         (Arm_exidx_input_section::has_errors_): New data member.
5907         (Arm_relobj::get_exidx_shndx_list): New method.
5908         (Arm_output_section::append_text_sections_to_list): Do not skip
5909         section without SHF_EXECINSTR.
5910         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5911         errors.
5912         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5913         section header.  Make error messages more verbose.  Check for
5914         a non-executable section linked to an EXIDX section.
5915         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5916         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5917         check that there is no deferred EXIDX section if we exit early.
5918         Instead of not making an EXIDX section in case of an error, make one
5919         and set the has_errors flag of it.
5920         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5921         in a relocatable link.
5922         (Target_arm::do_relax): Look for the EXIDX output section instead of
5923         assuming that it is called .ARM.exidx.
5924         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5925         section list.  Do not check for SHF_EXECINSTR section flags but
5926         skip any input section with errors.
5927         * output.cc (Output_section::Output_section): Initialize
5928         always_keeps_input_sections_ to false.
5929         (Output_section::add_input_section): Check for
5930         always_keeps_input_sections_.
5931         *  output.h (Output_section::always_keeps_input_sections,
5932         Output_section::set_always_keeps_input_sections): New methods.
5933         (Output_section::always_keeps_input_sections): New data member.
5934
5935 2010-07-13  Rafael Espindola  <espindola@google.com>
5936
5937         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5938         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5939
5940 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5941             Ian Lance Taylor  <iant@google.com>
5942
5943         * output.h (Output_section_lookup_maps::add_merge_section):
5944         Correct check of whether value was inserted.
5945         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5946         (Output_section_lookup_maps::add_relaxed_input_section):
5947         Likewise.
5948         * arm.cc (Target_arm::got_section): Remove used local os.
5949         * i386.cc (Target_i386::got_section): Likewise.
5950         * x86_64.cc (Target_x86_64::got_section): Likewise.
5951         * sparc.cc (Target_sparc::got_section): Likewise.
5952         (Target_sparc::relocate): Remove unused local have_got_offset.
5953         * powerpc.cc (Target_powerpc::relocate): Likewise.
5954
5955 2010-07-13  Ian Lance Taylor  <iant@google.com>
5956
5957         * compressed_output.cc (zlib_decompress): Fix signature in
5958         !HAVE_ZLIB_H case.
5959
5960         * archive.cc (Archive::include_member): Unlock an external member
5961         of a thin archive.  Don't bother to delete an object we know is
5962         NULL.
5963
5964 2010-07-12  Cary Coutant  <ccoutant@google.com>
5965
5966         * compressed_output.cc (zlib_decompress): New function.
5967         (get_uncompressed_size): New function.
5968         (decompress_input_section): New function.
5969         * compressed_output.h (get_uncompressed_size): New function.
5970         (decompress_input_section): New function.
5971         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5972         Handle compressed debug sections.
5973         * layout.cc (is_compressed_debug_section): New function.
5974         (Layout::output_section_name): Map compressed section names to
5975         canonical names.
5976         * layout.h (is_compressed_debug_section): New function.
5977         (is_debug_info_section): Recognize compressed debug sections.
5978         * merge.cc: Include compressed_output.h.
5979         (Output_merge_data::do_add_input_section): Handle compressed
5980         debug sections.
5981         (Output_merge_string::do_add_input_section): Handle compressed
5982         debug sections.
5983         * object.cc: Include compressed_output.h.
5984         (Sized_relobj::Sized_relobj): Initialize new data members.
5985         (build_compressed_section_map): New function.
5986         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
5987         * object.h (Object::section_is_compressed): New method.
5988         (Object::do_section_is_compressed): New method.
5989         (Sized_relobj::Compressed_section_map): New type.
5990         (Sized_relobj::do_section_is_compressed): New method.
5991         (Sized_relobj::compressed_sections_): New data member.
5992         * output.cc (Output_section::add_input_section): Handle compressed
5993         debug sections.
5994         * reloc.cc: Include compressed_output.h.
5995         (Sized_relobj::write_sections): Handle compressed debug sections.
5996
5997 2010-07-08  Cary Coutant  <ccoutant@google.com>
5998
5999         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6000         weak when resolving to a dynamic def.
6001         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6002         for weak undef/dynamic def cases. Adjust callers.
6003         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6004         undef_binding_weak_.
6005         (Symbol_table::sized_write_globals): Adjust symbol binding.
6006         (Symbol_table::sized_write_symbol): Add binding parameter.
6007         * symtab.h (Symbol::set_undef_binding): New method.
6008         (Symbol::is_undef_binding_weak): New method.
6009         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6010         (Symbol_table::should_override): Add new parameter.
6011         (Symbol_table::sized_write_symbol): Add new parameter.
6012
6013         * testsuite/weak_undef_file1.cc: Add new test case.
6014         * testsuite/weak_undef_file2.cc: Fix header comment.
6015         * testsuite/weak_undef_test.cc: Add new test case.
6016
6017 2010-06-29  Doug Kwan  <dougkwan@google.com>
6018
6019         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6020         Initialize USE_SYMBOL_.
6021         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6022         definition.
6023         (Arm_reloc_property::uses_symbol_): New data member declaration.
6024         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6025         uses symbol value and symbol is undefined but not weakly undefined.
6026
6027 2010-06-28  Rafael Espindola  <espindola@google.com>
6028
6029         * plugin.cc (Plugin::load): Use dlerror.
6030
6031 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6032
6033         * symtab.cc (detect_odr_violations): When reporting an ODR
6034         violation, report an object where the symbol is defined.
6035
6036 2010-06-25  Doug Kwan  <dougkwan@google.com>
6037
6038         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6039         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6040         definition.
6041         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6042         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6043         target hook to detect function points.
6044         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6045         * icf.h (Icf::check_section_for_function_pointers): Change type of
6046         parameter SECTION_NAME to const reference to std::string.  Use
6047         target hook to determine if section may have unsafe pointers.
6048         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6049         method definition.
6050
6051 2010-06-21  Rafael Espindola  <espindola@google.com>
6052
6053         * fileread.cc (Input_file::find_fie): New
6054         (Input_file::open): Use Input_file::find_fie.
6055         * fileread.h (Input_file::find_fie): New
6056         * plugin.cc (set_extra_library_path): New.
6057         (Plugin::load): Add set_extra_library_path to the transfer vector.
6058         (Plugin_manager::set_extra_library_path): New.
6059         (Plugin_manager::add_input_file): Use the extra search path if set.
6060         (set_extra_library_path(): New.
6061         * plugin.h (Plugin_manager): Add set_extra_library_path and
6062         extra_search_path_.
6063
6064 2010-06-19  Cary Coutant  <ccoutant@google.com>
6065
6066         * layout.cc (gdb_sections): Add .debug_types.
6067         (lines_only_debug_sections): Likewise.
6068
6069 2010-06-18  Rafael Espindola  <espindola@google.com>
6070
6071         * plugin.cc (add_input_file,add_input_library)
6072         (Plugin_manager::add_input_file): Make filename arguments const.
6073         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6074         const.
6075
6076 2010-06-16  Doug Kwan  <dougkwan@google.com>
6077
6078         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6079         .ARM.attributes section if we have not merged any input
6080         attributes sections.
6081
6082 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6083
6084         * arm.cc: Allow combining objects with no EABI version
6085         information.
6086
6087 2010-06-15  Rafael Espindola  <espindola@google.com>
6088
6089         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6090
6091 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6092
6093         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6094         (struct iovec): Correct !HAVE_READV definition.
6095
6096 2010-06-10  Cary Coutant  <ccoutant@google.com>
6097
6098         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6099         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6100         reloc sections.
6101         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6102
6103         PR 11683
6104         * symtab.h (Symbol::is_placeholder): New member function.
6105         * target-reloc.h (relocate_section): Check for placeholder symbols.
6106
6107         * testsuite/Makefile.am (plugin_test_8): New test.
6108         (plugin_test_9): New test.
6109         * testsuite/Makefile.in: Regenerate.
6110
6111 2010-06-09  Nick Clifton  <nickc@redhat.com>
6112
6113         * yyscript.y (input_list_element): Allow strings prefixed with
6114         the '-' character.  Treat these as libraries.
6115         * script.cc (script_add_library): New function.  Adds a library
6116         specified by "-l<name>" found in an input script.
6117         * script-c.h: Add prototype for script_add_library.
6118
6119 2010-06-07  Doug Kwan  <dougkwan@google.com>
6120
6121         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6122         Restrict stub-group size to be within long conditional branch
6123         range when working around cortex-A8 erratum.
6124
6125 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6126
6127         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6128         #ifdef typo.
6129
6130 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6131
6132         PR gold/11658
6133         * output.cc
6134         (Output_section::Input_section_sort_entry::compare_section_ordering):
6135         Change to return non-zero correctly.
6136         (Output_section::Input_section_sort_section_order_index_compare
6137         ::operator()): Change to fix ambiguity in comparisons.
6138
6139 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6140
6141         * gold.h (is_wildcard_string): New function.
6142         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6143         (Layout::layout_eh_frame): Ditto.
6144         (Layout::find_section_order_index): New method.
6145         (Layout::read_layout_from_file): New method.
6146         * layout.h (Layout::find_section_order_index): New method.
6147         (Layout::read_layout_from_file): New method.
6148         (Layout::input_section_position_): New private member.
6149         (Layout::input_section_glob_): New private member.
6150         * main.cc (main): Call read_layout_from_file here.
6151         * options.h (--section-ordering-file): New option.
6152         * output.cc (Output_section::input_section_order_specified_): New
6153         member.
6154         (Output_section::Output_section): Initialize new member.
6155         (Output_section::add_input_section): Add new parameter.
6156         Keep input sections when --section-ordering-file is used.
6157         (Output_section::set_final_data_size): Sort input sections when
6158         section ordering file is specified.
6159         (Output_section::Input_section_sort_entry): Add new parameter.
6160         Check sorting type.
6161         (Output_section::Input_section_sort_entry::compare_section_ordering):
6162         New method.
6163         (Output_section::Input_section_sort_compare::operator()): Change to
6164         consider section_order_index.
6165         (Output_section::Input_section_sort_init_fini_compare::operator()):
6166         Change to consider section_order_index.
6167         (Output_section::Input_section_sort_section_order_index_compare
6168         ::operator()): New method.
6169         (Output_section::sort_attached_input_sections): Change to sort
6170         according to section order when specified.
6171         (Output_section::add_input_section<32, true>): Add new parameter.
6172         (Output_section::add_input_section<64, true>): Add new parameter.
6173         (Output_section::add_input_section<32, false>): Add new parameter.
6174         (Output_section::add_input_section<64, false>): Add new parameter.
6175         * output.h (Output_section::add_input_section): Add new parameter.
6176         (Output_section::input_section_order_specified): New
6177         method.
6178         (Output_section::set_input_section_order_specified): New method.
6179         (Input_section::Input_section): Initialize section_order_index_.
6180         (Input_section::section_order_index): New method.
6181         (Input_section::set_section_order_index): New method.
6182         (Input_section::section_order_index_): New member.
6183         (Input_section::Input_section_sort_section_order_index_compare): New
6184         struct.
6185         (Output_section::input_section_order_specified_): New member.
6186         * script-sections.cc (is_wildcard_string): Delete and move modified
6187         method to gold.h.
6188         (Output_section_element_input::Output_section_element_input): Modify
6189         call to is_wildcard_string.
6190         (Output_section_element_input::Input_section_pattern
6191         ::Input_section_pattern): Ditto.
6192         (Output_section_element_input::Output_section_element_input): Ditto.
6193         * testsuite/Makefile.am (final_layout): New test case.
6194         * testsuite/Makefile.in: Regenerate.
6195         * testsuite/final_layout.cc: New file.
6196         * testsuite/final_layout.sh: New file.
6197
6198 2010-06-01  Rafael Espindola  <espindola@google.com>
6199
6200         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6201
6202 2010-06-01  Rafael Espindola  <espindola@google.com>
6203
6204         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6205         visibility of symbols.
6206
6207 2010-05-27  Doug Kwan  <dougkwan@google.com>
6208
6209         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6210         from start of output section instead of address for a local symbol
6211         in a merged or relaxed section when doing a relocatable link.
6212
6213 2010-05-26  Rafael Espindola  <espindola@google.com>
6214
6215         PR 11604
6216         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6217         adding sections the garbage collector removed.
6218         * gold/testsuite/Makefile.am: Add test.
6219         * gold/testsuite/Makefile.in: Regenerate.
6220         * gold/testsuite/plugin_test_7.sh: New.
6221         * gold/testsuite/plugin_test_7_1.c: New.
6222         * gold/testsuite/plugin_test_7_2.c: New.
6223
6224 2010-05-26  Rafael Espindola  <espindola@google.com>
6225
6226         * script-sections.cc (Output_section_definition::set_section_addresses):
6227         Check for --section-start.
6228
6229 2010-05-26  Doug Kwan  <dougkwan@google.com>
6230
6231         * arm.cc (Arm_scan_relocatable_relocs): New class.
6232         (Target_arm::relocate_special_relocatable): New method.
6233         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6234         (Arm_relocate_functions::thumb_branch_common): Same.
6235         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6236         instead of Default_scan_relocatable_relocs.
6237         * target-reloc.h (relocate_for_relocatable): Let target handle
6238         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6239         * target.h (Sized_target::relocate_special_relocatable): New method.
6240
6241 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6242
6243         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6244
6245 2010-05-23  Doug Kwan  <dougkwan@google.com>
6246
6247         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6248         instead of a cast.
6249         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6250         with a direct branch, not a conditional branch, to a stub.
6251         * merge.cc (Output_merge_base::record_input_section): New method
6252         defintion.
6253         (Output_merge_data::do_add_input_section): Record input section if
6254         keeps-input-sections flag is set.
6255         (Output_merge_string::do_add_input_section): Ditto.
6256         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6257         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6258         INPUT_SECTIONS_.
6259         (Output_merge_base::keeps_input_sections,
6260         Output_merge_base::set_keeps_input_sections,
6261         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6262         method definitions.
6263         (Output_merge_base::Input_sections): New type declaration.
6264         (Output_merge_base::input_sections_begin,
6265         Output_merge_base::input_sections_end,
6266         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6267         (Output_merge_base::bool keeps_input_sections_,
6268         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6269         Output_merge_base::input_sections_): New data members.
6270         (Output_merge_data::do_set_keeps_input_sections): New method
6271         defintion.
6272         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6273         * output.cc (Output_section::Input_section::relobj): Move method
6274         defintion from class declaration to here and handle merge sections.
6275         (Output_section::Input_section::shndx): Ditto.
6276         (Output_section::Output_section): Remove initializations of removed
6277         data members and initialize new data member LOOKUP_MAPS_.
6278         (Output_section::add_input_section): Set keeps-input-sections flag
6279         for a newly created merge output section as appropriate.  Adjust code
6280         to use Output_section_lookup_maps class.
6281         (Output_section::add_relaxed_input_section): Adjst code for lookup
6282         maps code refactoring.
6283         (Output_section::add_merge_input_section): Add a new parameter
6284         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6285         class.  If adding input section to a newly created merge output
6286         section fails, remove the new merge section.
6287         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6288         Adjust code for use of the Output_section_lookup_maps class.
6289         (Output_section::find_merge_section): Ditto.
6290         (Output_section::build_lookup_maps): New method defintion.
6291         (Output_section::find_relaxed_input_section): Adjust code to use
6292         Output_section_lookup_maps class.
6293         (Output_section::get_input_sections): Export merge sections.  Adjust
6294         code to use Output_section_lookup_maps class.
6295         (Output_section:::add_script_input_section): Adjust code to use
6296         Output_section_lookup_maps class.  Update lookup maps for merge
6297         sections also.
6298         (Output_section::discard_states): Use Output_section_lookup_maps.
6299         (Output_section::restore_states): Same.
6300         * output.h (Merge_section_properties): Move class defintion out of
6301         Output_section.
6302         (Output_section_lookup_maps): New class.
6303         (Output_section::Input_section::is_merge_section): New method
6304         defintion.
6305         (Output_section::Input_section::relobj): Move defintion out of class
6306         defintion.  Declare method only.
6307         (Output_section::Input_section::shndx): Ditto.
6308         (Output_section::Input_section::output_merge_base): New method defintion.
6309         (Output_section::Input_section::u2_.pomb): New union field.
6310         (Output_section::Merge_section_by_properties_map,
6311         Output_section::Output_section_data_by_input_section_map,
6312         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6313         Remove types.
6314         (Output_section::add_merge_input_section): Add new parameter
6315         KEEPS_INPUT_SECTIONS.
6316         (Output_section::build_lookup_maps): New method declaration.
6317         (Output_section::merge_section_map_,
6318         Output_section::merge_section_by_properties_map_,
6319         Output_section::relaxed_input_section_map_,
6320         Output_section::is_relaxed_input_section_map_valid_): Remove data
6321         members.
6322         (Output_section::lookup_maps_): New data member.
6323
6324 2010-05-21  Doug Kwan  <dougkwan@google.com>
6325
6326         PR gold/11619
6327         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6328         avoid a compilation error.
6329
6330 2010-05-19  Rafael Espindola  <espindola@google.com>
6331
6332         * script-sections.cc (Output_section_definition::allocate_to_segment):
6333         Update the phdrs_list even when the output section is NULL.
6334         * testsuite/Makefile.am: Add test.
6335         * testsuite/Makefile.in: Regenerate.
6336         * testsuite/script_test_9.cc: New.
6337         * testsuite/script_test_9.sh: New.
6338         * testsuite/script_test_9.t: New.
6339
6340 2010-05-19  Doug Kwan  <dougkwan@google.com>
6341
6342         * arm.cc (Arm_input_section::original_size): New method.
6343         (Arm_input_section::do_addralign): Add a cast.
6344         (Arm_input_section::do_output_offset): Remove static cast.
6345         (Arm_input_section::original_addralign,
6346          Arm_input_section::original_size_): Change type to uint32_t.
6347         (Arm_input_section::init): Add safe casts for section alignment
6348         and size.
6349         (Arm_input_section::set_final_data_size): Do not set address and
6350         offset of stub table.
6351         (Arm_output_section::fix_exidx_coverage): Change use of of
6352         Output_section::Simple_input_section to that of
6353         Output_section::Input_section.
6354         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6355         except for the first pass.
6356         * output.cc (Output_section::get_input_sections): Change type of
6357         input_sections to std::list<Input_section>.
6358         (Output_section::add_script_input_section): Rename from
6359         Output_section::add_simple_input_section.  Change type of SIS
6360         parameter from Simple_input_section to Input_section.
6361         * output.h (Output_section::Simple_input_section): Remove class.
6362         (Output_section::Input_section): Change class visibility to public.
6363         (Output_section::Input_section::addralign): Use stored alignments
6364         for special input sections if set.
6365         (Output_section::Input_section::set_addralign): New method.
6366         (Output_section::get_input_sections): Change parameter type from
6367         list of Simple_input_section to list of Input_section.
6368         (Output_section::add_script_input_section): Rename from
6369         Output_section::add_simple_input_section. Change first parameter's
6370         type from Simple_input_section to Input_section and remove the
6371         second and third parameters.
6372         * script-sections.cc (Input_section::Input_section_list): Change
6373         type to list of Output_section::Input_section/
6374         (Input_section_info::Input_section_info): Change parameter type of
6375         INPUT_SECTION to Output_section::Input_section.
6376         (Input_section_info::input_section): Change return type.
6377         (Input_section_info::input_section_): Change type to
6378         Output_section::Input_section.
6379         (Output_section_element_input::set_section_addresses): Adjust code
6380         to use Output_section::Input_section instead of
6381         Output_section::Simple_input_section.  Adjust code for renaming
6382         of Output_section::add_simple_input_section.
6383         (Orphan_output_section::set_section_addresses): Ditto.
6384
6385 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6386
6387         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6388         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6389
6390 2010-05-18  Rafael Espindola  <espindola@google.com>
6391
6392         * options.cc (General_options::finalize): Handle -nostdlib.
6393         * options.h (nostdlib): New option.
6394         * script.cc (script_add_search_dir): Handle -nostdlib.
6395
6396 2010-05-12  Doug Kwan  <dougkwan@google.com>
6397
6398         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6399         attributes section only if there no attributes section after merging.
6400         (Target_arm::merge_object_attributes): Move value of
6401         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6402         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6403         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6404         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6405         and arm_attr_merge_7.stdout.
6406         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6407         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6408         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6409         arm_attr_merge_7b.o): New rules.
6410         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6411         arm_attr_merge_7
6412         * testsuite/Makefile.in: Regenerate.
6413         * testsuite/arm_attr_merge.sh: New file.
6414         * testsuite/arm_attr_merge_[67][ab].s: Same.
6415
6416 2010-05-05  Nick Clifton  <nickc@redhat.com>
6417
6418         * po/es.po: Updated Spanish translation.
6419
6420 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6421
6422         * Makefile.am (install-exec-local): Properly install gold as
6423         default cross linker.
6424         * Makefile.in: Regenerated.
6425
6426 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6427             Nick Clifton  <nickc@redhat.com>
6428
6429         * configure.ac (install_as_default): Define and set to false
6430         unless --enable-gold or --enable-gold=both/gold has been
6431         specified.
6432         * configure: Regenerate.
6433
6434         * Makefile.am (install-exec-local): Install the executable as
6435         'ld.gold'.  If install_as_default is true then also install it as
6436         'ld'.
6437         * Makefile.in: Regenerated.
6438
6439 2010-04-24  Ian Lance Taylor  <iant@google.com>
6440
6441         * layout.cc (Layout::layout_reloc): In relocatable link don't
6442         combine reloc sections for grouped sections.
6443
6444 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6445
6446         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6447         sections that are not ordinary to icf.
6448         * icf.cc (get_section_contents): Handle relocation pointing to section
6449         with no object or shndx information.
6450         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6451         * testsuite/Makefile.in: Regenerate.
6452         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6453         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6454
6455 2010-04-22  Ian Lance Taylor  <iant@google.com>
6456
6457         * expression.cc (Expression::Expression_eval_info): Add
6458         result_alignment_pointer field.
6459         (Expression::eval_with_dot): Add result_alignment_pointer
6460         parameter.  Change all callers.
6461         (Expression::eval_maybe_dot): Likewise.
6462         (class Binary_expression): Add alignment_pointer parameter to
6463         left_value and right_value.  Change all callers.
6464         (BINARY_EXPRESSION): Set result alignment.
6465         (class Trinary_expression): Add alignment_pointer parameter to
6466         arg2_value and arg3_value.  Change all callers.
6467         (Trinary_cond::value): Set result alignment.
6468         (Max_expression::value, Min_expression::value): Likewise.
6469         (Align_expression::value): Likewise.
6470         * script-sections.cc (class Sections_element): Add dot_alignment
6471         parameter to set_section_addresses virtual function.  Update
6472         instantiations.
6473         (class Output_section_element): Likewise.
6474         (Script_sections::create_segments): Add dot_alignment parameter.
6475         Change all callers.
6476         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6477         (Script_sections::set_phdrs_clause_addresses): Likewise.
6478         * script-sections.h: Update declarations.
6479         * script.h: Update declarations.
6480         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6481         min_p_align.
6482         * testsuite/script_test_3.t: Set large alignment.
6483         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6484         segment has expected alignment.
6485
6486 2010-04-22  Nick Clifton  <nickc@redhat.com>
6487
6488         * po/gold.pot: Updated by the Translation project.
6489         * po/vi.po: Updated Vietnamese translation.
6490
6491 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6492
6493         * testsuite/Makefile.am (check_PROGRAMS): Add
6494         icf_virtual_function_folding_test.
6495         * testsuite/Makefile.in: Regenerated.
6496
6497 2010-04-15  Andrew Haley  <aph@redhat.com>
6498
6499         * options.h (merge_exidx_entries): New option.
6500         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6501         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6502         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6503         (Target_arm::merge_exidx_entries): New function.
6504         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6505         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6506         to Arm_exidx_fixup constructor.
6507         Add new arg, merge_exidx_entries.
6508         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6509         Arm_output_section::fix_exidx_coverage.
6510
6511 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6512
6513         * icf.cc (get_section_contents): Check for preemptible functions.
6514         Ignore addend when appropriate.
6515         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6516         section folded.
6517         (add_from_relobj): Check for section folded.
6518         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6519         * symtab.h (should_add_dynsym_entry): Add new parameter.
6520         * target-reloc.h (scan_relocs): Check for section folded.
6521         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6522         Check reloc types for function pointers in shared objects.
6523         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6524         case.
6525         (icf_preemptible_functions_test): New test case.
6526         (icf_string_merge_test): New test case.
6527         * testsuite.Makefile.in: Regenerate.
6528         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6529         bar_glob.  Refactor code.
6530         * testsuite/icf_preemptible_functions_test.cc: New file.
6531         * testsuite/icf_preemptible_functions_test.sh: New file.
6532         * testsuite/icf_string_merge_test.cc: New file.
6533         * testsuite/icf_string_merge_test.sh: New file.
6534         * testsuite/icf_virtual_function_folding_test.cc: New file.
6535         * testsuite/icf_virtual_function_folding_test.sh: New file.
6536
6537 2010-04-14  Doug Kwan  <dougkwan@google.com>
6538
6539         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6540         for local symbol recounting if we remove a section due to ICF.
6541         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6542         there are no regular objects in input.
6543
6544 2010-04-13  Doug Kwan  <dougkwan@google.com>
6545
6546         * arm.cc (Arm_input_section::set_final_data_size): Compute
6547         accurate final data size instead of using current data size.
6548
6549 2010-04-09  Doug Kwan  <dougkwan@google.com>
6550
6551         * layout.cc (Layout::choose_output_section): Handle script section
6552         types.
6553         (Layout::make_output_section_for_script): Add section type parameter.
6554         Handle script section types.
6555         * layout.h (Layout::make_output_section_for_script): Add section
6556         type parameter.
6557         * output.cc (Output_section::Output_section): Initialize data member
6558         is_noload_.
6559         (Output_section::do_reset_address_and_file_offset): Do not set address
6560         to 0 if section is a NOLOAD section.
6561         * output.h (Output_section::is_noload): New method.
6562         (Output_section::set_is_noload): Ditto.
6563         (Output_section::is_noload_): New data member.
6564         * script-c.h (Script_section_type): New enum type.
6565         (struct Parser_output_section_header): Add new file section_type.
6566         * script-sections.cc (Sections_element::output_section_name): Add
6567         parameter for returning script section type.
6568         (Output_section_definition::output_section_name): Ditto.
6569         (Output_section_definition::section_type)P; New method.
6570         (Output_section_definiton::script_section_type_name): Ditto.
6571         (Output_section_definition::script_section_type_): New data member.
6572         (Output_section_definition::Output_section_definition): Initialize
6573         data member Output_section_definition::script_section_type_.
6574         (Output_section_definition::create_sections): Pass script section type
6575         to Layout::make_output_section_for_script.
6576         (Output_section_definition::output_section_name): Return script
6577         section type to caller.
6578         (Output_section_definition::set_section_address): Do not advance
6579         dot value and load address if section type is NOLOAD.  Set address
6580         of NOLOAD sections regardless of section flags.
6581         (Output_section_definition::print): Print section type if it is
6582         not SCRIPT_SECTION_TYPE_NONE.
6583         (Output_section_definition::section_type): New method.
6584         (Output_section_definition::script_section_type_name): Ditto.
6585         (Script_sections::output_section_name): Add new parameter
6586         PSECTION_TYPE for returning script section type.  Pass it to
6587         section elements.  Handle discard sections.
6588         (Sort_output_sections::operator()): Handle NOLOAD sections.
6589         * script-sections.h (Script_sections::Section_type): New enum type.
6590         (Script_sections::output_section_name): Add a new parameter for
6591         returning script section type.
6592         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6593         INFO and NOLOAD.
6594         * yyscript.y (union): Add new field SECTION_TYPE.
6595         (COPY, DSECT, INFO, NOLOAD): New tokens.
6596         (opt_address_and_section_type): Change type to output_section_header.
6597         (section_type): New non-terminal
6598         (section_header): Handle section type.
6599         (opt_address_and_section_type): Return section type value.
6600
6601 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6602
6603         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6604         * testsuite/plugin_common_test_2.c (foo): Likewise.
6605
6606 2010-04-08  Doug Kwan  <dougkwan@google.com>
6607
6608         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6609         Output_merge_data.
6610         * output.cc (Output_section::add_merge_input_section): Simplify
6611         code and return status of Output_merge_base::add_input_section.
6612         Update merge section map only if Output_merge_base::add_input_section
6613         returns true.
6614
6615 2010-04-07  Doug Kwan  <dougkwan@google.com>
6616
6617         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6618         if section is marked as containing instructions but has no mapping
6619         symbols.
6620         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6621         correct section index.
6622         (Arm_relobj::find_linked_text_section): Ditto.
6623
6624 2010-04-07  Cary Coutant  <ccoutant@google.com>
6625
6626         * archive.cc (include_member): Destroy Read_symbols_data object before
6627         releasing file.
6628         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6629         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6630         (Read_symbols_data::~Read_symbols_data) New destructor.
6631         (Section_relocs::Section_relocs) New constructor.
6632         (Section_relocs::~Section_relocs) New destructor.
6633         (Read_relocs_data::Read_relocs_data) New constructor.
6634         (Read_relocs_data::~Read_relocs_data) New destructor.
6635         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6636         pointers to NULL after deleting.
6637
6638 2010-04-07  Doug Kwan  <dougkwan@google.com>
6639
6640         * arm.cc: Replace "endianity" with "endianness" in comments.
6641         (Arm_exidx_cantunwind): Ditto.
6642         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6643         (Arm_relobj::merge_flags_and_attributes): New method.
6644         (Arm_relobj::merge_flags_and_attributes_): New data member.
6645         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6646         (Arm_relobj::scan_sections_for_stubs): Ditto.
6647         (Arm_relobj::do_read_symbols): Check to see if we really want to
6648         merge processor-specific flags and attributes.  Exit early if
6649         an object is empty except for section names and the undefined symbol.
6650         (Target_arm::do_finalize_sections): Move check for ELF format to
6651         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6652         attributes from a regular object only when we have determined that
6653         it is aapropriate.  Do not create an .ARM.attributes section in
6654         output if there is no regular input object.
6655         (Target_arm::merge_processor_specific_flags): Check
6656         --warn-mismatch before printing any error.
6657         (Target_arm::merge_object_attributes): Ditto.
6658         * gold.cc (queue_middle_tasks): Handle the case in which there is
6659         no regular object in input.
6660         * options.cc (General_options::parse_EB): New method.
6661         (General_options::parse_EL): Same.
6662         (General_options::General_options): Initialize endianness_.
6663         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6664         New options.
6665         (General_options::Endianness): New enum.
6666         (General_options::endianness): New method.
6667         (General_options::endianness_): New data member.
6668         * parameters.cc (Parameters::set_options): Check target endianness.
6669         (Parameters::set_target_once): Ditto.
6670         (Parameters::check_target_endianness): New method.
6671         (parameters_force_valid_target): If either -EL or -EB is specified,
6672         use it to define endianness of default target.
6673         * parameters.h (Parameters::check_target_endianness): New method
6674         declaration.
6675         * target.h (class Target): Change "endianity" to "endianness"
6676         in comments.
6677
6678 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6679
6680         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6681         * configure: Regenerate.
6682         * Makefile.in: Regenerate.
6683         * testsuite/Makefile.in: Regenerate.
6684
6685 2010-04-06  Cary Coutant  <ccoutant@google.com>
6686
6687         gcc PR lto/42757
6688         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6689         prevailing definitions of common symbols.
6690         * testsuite/plugin_test_6.sh: New test case.
6691         * testsuite/plugin_common_test_1.c: New test case.
6692         * testsuite/plugin_common_test_2.c: New test case.
6693         * testsuite/Makefile.am (plugin_test_6): New test case.
6694         * testsuite/Makefile.in: Regenerate.
6695
6696 2010-04-06  Nick Clifton  <nickc@redhat.com>
6697
6698         * po/vi.po: New Vietnamese translation.
6699
6700 2010-03-30  Doug Kwan  <dougkwan@google.com>
6701
6702         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6703
6704 2010-03-25  Doug Kwan  <dougkwan@google.com>
6705
6706         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6707         to avoid a conversion warning on a 32-bit host.
6708
6709 2010-03-24  Ian Lance Taylor  <iant@google.com>
6710
6711         * testsuite/script_test_3.t: Add a TLS segment.
6712         * testsuite/Makefile.am (check_PROGRAMS): Add
6713         tls_phdrs_script_test.
6714         (tls_phdrs_script_test_SOURCES): Define.
6715         (tls_phdrs_script_test_DEPENDENCIES): Define.
6716         (tls_phdrs_script_test_LDFLAGS): Define.
6717         (tls_phdrs_script_test_LDADD): Define.
6718         * testsuite/Makefile.in: Rebuild.
6719
6720 2010-03-23  Cary Coutant  <ccoutant@google.com>
6721
6722         * fileread.cc (find_or_make_view): Fix comment.
6723
6724 2010-03-23  Ian Lance Taylor  <iant@google.com>
6725
6726         * script-sections.cc (class Orphan_section_placement): Define
6727         PLACE_TLS and PLACE_TLS_BSS.
6728         (Orphan_section_placement::Orphan_section_placement): Initialize
6729         new places.
6730         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6731         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6732         (tls_script_test_SOURCES): Define.
6733         (tls_script_test_DEPENDENCIES): Define.
6734         (tls_script_test_LDFLAGS): Define.
6735         (tls_script_test_LDADD): Define.
6736         * testsuite/Makefile.in: Rebuild.
6737
6738 2010-03-22  Doug Kwan  <dougkwan@google.com>
6739
6740         * arm.cc (Arm_relocate_functions::abs8,
6741         Arm_relocate_functions::abs16): Use correct check for overflow
6742         specified in the ARM ELF specs.
6743         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6744         target of a BLX instruction specially.
6745         (Reloc_stub::stub_type_for_reloc): Ditto.
6746         (Relocate::relocate): Use symbolic names instead of numeric relocation
6747         codes to report error.
6748         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6749         workaround.
6750         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6751         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6752         thumb2_blx_out_of_range.stdout
6753         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6754         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6755         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6756         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6757         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6758         thumb2_blx_in_range, thumb2_blx_in_range.o,
6759         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6760         thumb2_blx_out_of_range.o): New rules.
6761         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6762         thumb2_blx_in_range and thumb2_blx_out_of_range.
6763         * testsuite/Makefile.in: Regenerate.
6764         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6765         * testsuite/thumb_blx_in_range.s: New file.
6766         * testsuite/thumb_blx_out_of_range.s: New file.
6767
6768 2010-03-22  Rafael Espindola  <espindola@google.com>
6769
6770         * archive.cc (Should_include): Move to archive.h.
6771         (should_include_member): Make it a member of Archive.
6772         (Lib_group): New.
6773         (Add_lib_group_symbols): New.
6774         * archive.h: Include options.h.
6775         (Archive_member): Moved from Archive.
6776         (Should_include): Moved from archive.cc.
6777         (Lib_group): New.
6778         (Add_lib_group_symbols): New.
6779         * dynobj.cc (do_should_include_member): New.
6780         * dynobj.h (do_should_include_member): New.
6781         * gold.cc (queue_initial_tasks): Update call to queue.
6782         * main.cc (main): Print lib group stats.
6783         * object.cc (do_should_include_member): New.
6784         * object.h: Include archive.h.
6785         (Object::should_include_member): New.
6786         (Object::do_should_include_member): New.
6787         (Sized_relobj::do_should_include_member): New.
6788         * options.cc (General_options::parse_start_lib): New.
6789         (General_options::parse_end_lib): New.
6790         (Input_arguments::add_file): Handle lib groups.
6791         (Input_arguments::start_group): Check we are not in a lib.
6792         (Input_arguments::start_lib): New.
6793         (Input_arguments::end_lib): New.
6794         * options.h (General_options): Add start_lib and end_lib.
6795         (Input_argument::lib_): New.
6796         (Input_argument::lib): New.
6797         (Input_argument::is_lib): New.
6798         (Input_file_lib): New.
6799         (Input_arguments::in_lib_): New.
6800         (Input_arguments::in_lib): New.
6801         (Input_arguments::start_lib): New.
6802         (Input_arguments::end_lib_): New.
6803         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6804         in unused members as preempted.
6805         (Sized_pluginobj::do_should_include_member): New.
6806         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6807         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6808         return the blocker.
6809         (Read_symbols::do_whole_lib_group): New.
6810         (Read_symbols::do_lib_group): New.
6811         (Read_symbols::do_read_symbols): Handle lib groups.
6812         (Read_symbols::get_name): Handle lib groups.
6813         * readsyms.h (Read_symbols): Add an archive member pointer.
6814         (Read_symbols::do_whole_lib_group): New.
6815         (Read_symbols::do_lib_group): New.
6816         (Read_symbols::member_): New.
6817         * script.cc (read_input_script): Update call to queue_soon.
6818
6819 2010-03-19  Doug Kwan  <dougkwan@google.com>
6820
6821         * arm.cc (Stub_table::Stub_table): Initialize new data members
6822         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6823         (Stub_table::add_reloc_stub): Assign stub offset and update
6824         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6825         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6826         New data members.
6827         (Stub_table::update_data_size_and_addralign): Use
6828         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6829         instead of going over all reloc stubs.
6830         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6831         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6832         Stringpool_template::offset_ to size of Stringpool_char.
6833         (Stringpool_template::new_key_offset): Remove code to initialize
6834         Stringpool_template::offset_.
6835         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6836         Stringpool_template::offset_ to zero.
6837
6838 2010-03-15  Doug Kwan  <dougkwan@google.com>
6839
6840         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6841         offset_.
6842         (Stringpool_template::new_key_offset): New method.
6843         (Stringpool_template::add_string): Assign offsets when adding new
6844         strings.
6845         (Stringpool_template::set_string_offsets): Do not set string offsets
6846         when not optimizing.
6847         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6848         member size_.
6849         (Chunked_vector::clear): Clear size_.
6850         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6851         (Chunked_vector::size): Return size_.
6852         (Chunked_vector::push_back): Use size_ to find insert position.
6853         (Chunked_vector::size_): New data member.
6854         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6855         (Stringpool_template::new_key_offset): New method declaration.
6856         (Stringpool_template::offset_): New data member.
6857
6858 2010-03-15   Rafael Espindola  <espindola@google.com>
6859
6860         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6861         Add_symbols' constructor.
6862         * readsyms.h (Add_symbols): Remove the input_group member.
6863
6864 2010-03-10  Ian Lance Taylor  <iant@google.com>
6865
6866         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6867         target to ask whether a reference to a symbol requires a stack
6868         split.
6869         * target.h (Target::is_call_to_non_split): New function.
6870         (Target::do_is_call_to_non_split): Declare virtual function.
6871         * target.cc: Include "symtab.h".
6872         (Target::do_is_call_to_non_split): New function.
6873         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6874
6875 2010-03-10  Cary Coutant  <ccoutant@google.com>
6876
6877         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6878         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6879         (File_read::open[2]): Add whole_file_view_ to list of views.
6880         (File_read::make_view): Remove test of whole_file_view_.
6881         (File_read::find_or_make_view): Create whole_file_view_ if
6882         necessary.
6883         (File_read::clear_views): Replace bool parameter with enum;
6884         adjust all callers.  Don't delete views with permanent data;
6885         do delete cached views and views from archives if
6886         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6887         if clearing the corresponding view.
6888         * fileread.h (File_read::Clear_views_mode): New enum.
6889         (File_read::View::is_permanent_view): New method.
6890         (File_read::clear_views): Replace bool parameter
6891         with enum; adjust all callers.
6892         * options.h (General_options): Change keep_files_mapped option;
6893         add map_whole_files.
6894         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6895         releasing the file.
6896         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6897         the file.
6898
6899 2010-03-10  David S. Miller  <davem@davemloft.net>
6900
6901         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6902
6903 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6904
6905         * icf.cc (get_section_contents): Add '@' marker after processing the
6906         merge reloc.
6907
6908 2010-03-08  Doug Kwan  <dougkwan@google.com>
6909
6910         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6911         due to a conversion warning.
6912         (Arm_relobj::update_output_local_symbol_count): Check for local
6913         symbol with unset output index.
6914
6915 2010-03-05  Ian Lance Taylor  <iant@google.com>
6916
6917         * options.h (class General_options): Add --spare-dynamic-tags.
6918         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6919         --spare-dynamic-tags.
6920
6921 2010-03-05  Ian Lance Taylor  <iant@google.com>
6922
6923         * incremental.cc: Include "libiberty.h".
6924
6925 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6926
6927         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6928         function, is_info_ member.
6929         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6930         (Versions::Versions): Update caller.
6931         (Versions::define_base_version): Likewise.
6932         (Versions::add_def): Likewise.
6933
6934 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6935
6936         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6937         (Scan::possible_function_pointer_reloc): New function.
6938         (Scan::local_reloc_may_be_function_pointer): Change to call
6939         possible_function_pointer_reloc.
6940         (Scan::global_reloc_may_be_function_pointer): Ditto.
6941         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6942         relocations in ".data.rel.ro._ZTV" section.
6943         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6944         * testsuite/icf_safe_so_test.cc: Ditto.
6945         * testsuite/icf_safe_test.cc: Ditto.
6946         * testsuite/icf_safe_test.sh: Ditto.
6947
6948 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6949             Ian Lance Taylor  <iant@google.com>
6950
6951         * target-reloc.h (relocate_section): Check the symbol table index
6952         for -1U before setting the local symbol index.
6953         (scan_relocatable_relocs): If copying the relocation, record that
6954         the local symbol is required.
6955         * object.h (Symbol_value::is_output_symtab_index_set): New
6956         function.
6957         (Symbol_value::may_be_discarded_from_output_symtab): New
6958         function.
6959         (Symbol_value::has_output_symtab_entry): New function.
6960         (Symbol_value::needs_output_symtab_entry): Remove.
6961         (Symbol_value::output_symtab_index): Make sure the symbol index is
6962         set.
6963         (Symbol_value::set_output_symtab_index): Make sure the symbol
6964         index is not set.  Make sure the new index is valid.
6965         (Symbol_value::set_must_have_output_symtab_entry): New function.
6966         (Symbol_value::has_output_dynsym_entry): New function.
6967         (Symbol_value::set_output_dynsym_index): Make sure the new index
6968         is valid.
6969         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6970         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6971         local symbol if permitted.
6972         (Sized_relobj::do_finalize_local_symbols): Call
6973         is_output_symtab_index_set rather than needs_output_symtab_entry.
6974         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
6975         rather than needs_output_symtab_entry.  Call
6976         has_output_dynsym_entry rather than needs_output_dynsym_entry.
6977         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
6978         is_output_symtab_index_set rather than needs_output_symtab_entry.
6979         * testsuite/discard_locals_relocatable_test.c: New file.
6980         * testsuite/discard_locals_test.sh: Test -r.
6981         * testsuite/Makefile.am (check_DATA): Add
6982         discard_locals_relocatable_test1.syms,
6983         discard_local_relocatable_test2.syms.
6984         (MOSTLYCLEANFILES): Likewise.  Also add
6985         discard_locals_relocatable_test1.lout and
6986         discard_locals_relocatable_test2.out.
6987         (discard_locals_relocatable_test1.syms): New target.
6988         (discard_locals_relocatable_test.o): New target.
6989         (discard_locals_relocatable_test1.out): New target.
6990         (discard_locals_relocatable_test2.syms): New target.
6991         (discard_locals_relocatable_test2.out): New target.
6992         (various): Add missing ../ld-new dependencies.
6993         * testsuite/Makefile.in: Rebuild.
6994
6995 2010-03-03  Nick Clifton  <nickc@redhat.com>
6996
6997         * po/fi.po: New Finnish translation.
6998
6999 2010-03-01  Doug Kwan  <dougkwan@google.com>
7000
7001         * layout.cc (Layout::Layout): Force section types of .init_array*,
7002         .preinit_array* and .fini_array* sections.
7003         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7004         Fix check of return value of std::string::find.().
7005         (Output_section::Input_section_sort_compare::operator()): Remove
7006         comment about .init_array.
7007         (Output_section::Input_section_sort_init_fini_compare::operator()):
7008         New method.
7009         (Output_section::sort_attached_input_sections): Handle .init_array
7010         and .fini_array specially.
7011         * output.h (Output_section::Inut_section_sort_compare): Update
7012         comment.
7013         (Output_section::Input_section_sort_init_fini_compare): New struct.
7014
7015 2010-02-26  Doug Kwan  <dougkwan@google.com>
7016
7017         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7018         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7019         * testsuite/debug_msg.sh: Avoid matching source line number for
7020         use of global variable undef_int.
7021
7022 2010-02-26  Doug Kwan  <dougkwan@google.com>
7023
7024         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7025         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7026         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7027         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7028         * options.cc (General_options::General_options): Initialize member
7029         fix_v4bx_.
7030         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7031         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7032         and rm_no_fix_v4bx.stdout
7033         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7034         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7035         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7036         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7037         and arm_no_fix_v4bx.
7038         * Makefile.in: Regenerate.
7039         * testsuite/arm_fix_v4bx.s: New file.
7040         * testsuite/arm_fix_v4bx.sh: Ditto.
7041
7042 2010-02-24  Doug Kwan  <dougkwan@google.com>
7043
7044         * arm.cc (Target_arm::got_section): Make the .got section the first
7045         non RELRO section in the data segment.
7046         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7047         suffixes of section names.
7048
7049 2010-02-24  Doug Kwan  <dougkwan@google.com>
7050
7051         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7052         flags and attributes merging if an input file is a binary file.
7053         * fileread.cc (Input_file::open): Record format of original file.
7054         * fileread.h (Input_file::Format): New enum type.
7055         (Input_file::Input_file): Initialize data member format_.
7056         (Input_file::format): New method definition.
7057         (Input_file::format_):: New data member.
7058
7059 2010-02-24  Doug Kwan  <dougkwan@google.com>
7060
7061         * arm.cc (Arm_output_data_got): New class.
7062         (ARM_TCB_SIZE): New constant
7063         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7064         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7065         If user uses a script with a SECTIONS clause, issue only a warning
7066         for a misplaced EXIDX input section.  Otherwise, issue an error.
7067         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7068         garbage collection.
7069         (Target_arm::got_mode_index_entry): Handle static linking.
7070         (Target_arm::Scan::local): Ditto.
7071         (Target_arm::Scan::global): Ditto.
7072         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7073         all incorrectly implemented relocations.
7074         (Target_arm::fix_exidx_coverage): Pass layout to
7075         Arm_output_section::fix_exidx_coverage.
7076         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7077         from ".ARM.exidx." and ".ARM.extab.".
7078
7079 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7080
7081         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7082         section if it does not already exist.
7083         * attributes.cc (Attributes_section_data::Attributes_section_data):
7084         Don't crash if size is zero.
7085
7086 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7087             Ian Lance Taylor  <iant@google.com>
7088
7089         * gold.cc (queue_middle_tasks): If no input files were opened,
7090         exit.
7091         * workqueue.h (Task_function::Task_function): Assert that there is
7092         a blocker.
7093
7094 2010-02-22  Doug Kwan  <dougkwan@google.com>
7095
7096         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7097         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7098         types to avoid warnings due to different uint64_t implementations
7099         on different hosts.
7100
7101 2010-02-21  Doug Kwan  <dougkwan@google.com>
7102
7103         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7104         handling of the maximum backward branch offset.
7105         (Arm_relocate_functions::thumb_branch_common): Ditto.
7106         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7107         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7108         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7109         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7110         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7111         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7112         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7113         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7114         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7115         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7116         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7117         thumb2_bl_out_of_range.o): New rules.
7118         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7119         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7120         thumb2_bl_out_of_range
7121         * testsuite/Makefile.in: Regenerate.
7122         * testsuite/arm_bl_in_range.s: New file.
7123         * testsuite/arm_bl_out_of_range.s: Ditto.
7124         * testsuite/arm_branch_in_range.sh: Ditto.
7125         * testsuite/arm_branch_range.t: Ditto.
7126         * testsuite/thumb2_branch_range.t: Ditto.
7127         * testsuite/thumb_bl_in_range.s: Ditto.
7128         * testsuite/thumb_bl_out_of_range.s: Ditto.
7129         * testsuite/thumb_branch_range.t: Ditto.
7130
7131 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7132
7133         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7134         Add reloc offset information.
7135         * icf.cc (get_section_contents): Change iterators to point to the new
7136         vectors. Add reloc offset information to the contents.
7137         * icf.h (Icf::Sections_reachable_info): New typedef.
7138         (Icf::Sections_reachable_list): New typedef.
7139         (Icf::Offset_info): New typedef.
7140         (Icf::Reloc_info): New struct typedef.
7141         (Icf::Reloc_info_list): New typedef.
7142         (Icf::symbol_reloc_list): Delete method.
7143         (Icf::addend_reloc_list): Delete method.
7144         (Icf::section_reloc_list): Delete method.
7145         (Icf::reloc_info_list): New method.
7146         (Icf::reloc_info_list_): New member.
7147
7148 2010-02-19  Doug Kwan  <dougkwan@google.com>
7149
7150         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7151         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7152         * arm.cc (Arm_relocation_functions): New forward declaration.
7153         (Target_arm::Target_arm): Initialize new data members
7154         got_mod_index_offset_ and tls_base_symbol_defined_.
7155         (Target_arm::Relocate::relocate_tls): New method.
7156         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7157          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7158         New methods.
7159         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7160         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7161         (Target_arm::got_mod_index_offset_,
7162         Target_arm::tls_base_symbol_defined_): New data members.
7163         (Target_arm::Scan::local, Target::Scan::global,
7164         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7165         relocations.
7166
7167 2010-02-18  Doug Kwan  <dougkwan@google.com>
7168
7169         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7170         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7171         text section as a parameter becuase some broken tools may not set
7172         the link in section header.
7173         (Target_arm::has_got_section): New method.
7174         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7175         without any mapping symbol as data only.  Remove warning.
7176         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7177         link in its section header, try to discover the link by inspecting the
7178         REL31 relocation at the beginning of the section.
7179         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7180         in error message.
7181         (Target_arm::Scan::global): Treat any reference to the symbol
7182         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7183
7184 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7185
7186         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7187         (Scan::global_reloc_may_be_function_pointer): New function.
7188         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7189         (Scan::global_reloc_may_be_function_pointer): New function.
7190         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7191         (Scan::global_reloc_may_be_function_pointer): New function.
7192         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7193         (Scan::global_reloc_may_be_function_pointer): New function.
7194         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7195         (Scan::global_reloc_may_be_function_pointer): New function.
7196         (Scan::possible_function_pointer_reloc): New function.
7197         (Target_x86_64::can_check_for_function_pointers): New function.
7198         * gc.h (gc_process_relocs): Scan relocation types to determine if
7199         function pointers were taken for targets that support it.
7200         * icf.cc (Icf::find_identical_sections): Include functions for
7201         folding in safe ICF whose pointer is not taken.
7202         * icf.h (Secn_fptr_taken_set): New typedef.
7203         (fptr_section_id_): New member.
7204         (section_has_function_pointers): New function.
7205         (set_section_has_function_pointers): New function.
7206         (check_section_for_function_pointers): New function.
7207         * options.h: Fix comment for safe ICF option.
7208         * target.h (can_check_for_function_pointers): New function.
7209         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7210         Modify icf_safe_test for X86-64.
7211         * testsuite/Makefile.in: Regenerate.
7212         * testsuite/icf_safe_so_test.cc: New file.
7213         * testsuite/icf_safe_so_test.sh: New file.
7214         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7215         (main): Change to take pointer to function kept_func_3.
7216         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7217         folding is done correctly for X86-64.
7218
7219 2010-02-12  David S. Miller  <davem@davemloft.net>
7220
7221         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7222         is_symbolless parameter.
7223         (Output_reloc<SHT_REL>::is_symbolless): New.
7224         (Output_reloc<SHT_REL>::is_symbolless_): New.
7225         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7226         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7227         (Output_reloc<SHT_RELA>::is_symbolless): New.
7228         (Output_data_reloc::add_global): Handle is_symbolless.
7229         (Output_data_reloc::add_global_relative): Likewise.
7230         (Output_data_reloc::add_local): Likewise.
7231         (Output_data_reloc::add_local_relative): Likewise.
7232         (Output_data_reloc::add_symbolless_global_addend): New.
7233         (Output_data_reloc::add_symbolless_local_addend): New.
7234         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7235         is_symbolless.
7236         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7237         instead of ->is_relative_
7238         (Output_reloc::write): Likewise.
7239         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7240         (Output_reloc::write_rel): Simplify.
7241
7242         * sparc.cc (Target_sparc::Scan::local): Use
7243         ->add_symbolless_local_addend as needed.
7244         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7245         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7246         based upon relocation offset.
7247
7248 2010-02-11  Doug Kwan  <dougkwan@google.com>
7249
7250         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7251         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7252         beginning of function.
7253         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7254         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7255         parameter is_32bit in calls to should_apply_static_reloc.
7256         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7257         (check_DATA): Add arm_abs_global.stdout.
7258         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7259         arm_abs_global.stdout): New rules.
7260         (MOSTLLYCLEANFILES): Add arm_abs_global
7261         * Makefile.in: Regenerate.
7262         * testsuite/arm_abs_global.s: New file.
7263         * testsuite/arm_abs_global.sh: Ditto.
7264         * testsuite/arm_abs_lib.s: Ditto.
7265
7266 2010-02-11  Ian Lance Taylor  <iant@google.com>
7267
7268         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7269         Read_relocs task.
7270         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7271         Allocate_commons_task first.
7272         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7273         task, rather than symtab_lock_.
7274         (Gc_process_relocs::~Gc_process_relocs): New function.
7275         (Gc_process_relocs::is_runnable): Check this_blocker_.
7276         (Gc_process_relocs::locks): Use next_blocker_ rather than
7277         blocker_.
7278         (Scan_relocs::~Scan_relocs): New function.
7279         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7280         symtab_lock_.
7281         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7282         next_blocker_.
7283         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7284         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7285         constructor accordingly.
7286         (class Gc_process_relocs): Likewise.
7287         (class Scan_relocs): Likewise.
7288         * common.h (class Allocate_commons_task): Remove symtab_lock_
7289         field, and corresponding constructor parameter.
7290         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7291         symtab_lock_.
7292         (Allocate_commons_task::locks): Likewise.
7293
7294 2010-02-11  Ian Lance Taylor  <iant@google.com>
7295
7296         * gold-threads.h (class Once): Define.
7297         (class Initialize_lock): Rewrite as child of Once.
7298         * gold-threads.cc (class Once_initialize): Define.
7299         (once_pointer_control): New static variable.
7300         (once_pointer, once_arg): New static variables.
7301         (c_run_once): New static function.
7302         (Once::Once, Once::run_once, Once::internal_run): New functions.
7303         (class Initialize_lock_once): Remove.
7304         (initialize_lock_control): Remove.
7305         (initialize_lock_pointer): Remove.
7306         (initialize_lock_once): Remove.
7307         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7308         (Initialize_lock::initialize): Rewrite.
7309         (Initialize_lock::do_run_once): New function.
7310         * archive.cc (Archive::interpret_header): Only clear name if it is
7311         not already empty.
7312         * fileread.cc: Include "gold-threads.h"
7313         (file_counts_lock): New static variable.
7314         (file_counts_initialize_lock): Likewise.
7315         (File_read::release): Only increment counts when using --stats.
7316         Use a lock around the increment.
7317         * parameters.cc (class Set_parameters_target_once): Define.
7318         (set_parameters_target_once): New static variable.
7319         (Parameters::Parameters): Move here from parameters.h.
7320         (Parameters::set_target): Rewrite.
7321         (Parameters::set_target_once): New function.
7322         (Parameters::clear_target): Move here and rewrite.
7323         * parameters.h (class Parameters): Update declarations.  Add
7324         set_parameters_target_once_ field.
7325         (Parameters::Parameters): Move to parameters.cc.
7326         (Parameters::clear_target): Likewise.
7327         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7328         task.
7329         (Start_group::~Start_group): New function.
7330         (Start_group::is_runnable): New function.
7331         (Start_group::locks, Start_group::run): New functions.
7332         (Finish_group::run): Change saw_undefined to size_t.
7333         * readsyms.h (class Start_group): Define.
7334         (class Finish_group): Change saw_undefined_ field to size_t.
7335         (Finish_group::Finish_group): Remove saw_undefined and
7336         this_blocker parameters.  Change all callers.
7337         (Finish_group::set_saw_undefined): New function.
7338         (Finish_group::set_blocker): New function.
7339         * symtab.h (class Symbol_table): Change saw_undefined to return
7340         size_t.  Change saw_undefined_ field to size_t.
7341         * target-select.cc (Set_target_once::do_run_once): New function.
7342         (Target_selector::Target_selector): Initialize set_target_once_
7343         field.  Don't initialize lock_ and initialize_lock_ fields.
7344         (Target_selector::instantiate_target): Rewrite.
7345         (Target_selector::set_target): New function.
7346         * target-select.h (class Set_target_once): Define.
7347         (class Target_selector): Update declarations.  Make
7348         Set_target_once a friend.  Remove lock_ and initialize_lock_
7349         fields.  Add set_target_once_ field.
7350
7351 2010-02-10  Ian Lance Taylor  <iant@google.com>
7352
7353         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7354         queueing any tasks.
7355         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7356         (queue_middle_tasks): Add all blockers before queueing any tasks.
7357         (queue_final_tasks): Likewise.
7358         * token.h (Task_token::add_blockers): New function.
7359         * object.h (Input_objects::number_of_relobjs): New function.
7360
7361 2010-02-10  Ian Lance Taylor  <iant@google.com>
7362
7363         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7364         shared, not if not position independent.
7365         * x86_64.cc (Relocate::relocate_tls): Likewise.
7366         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7367         (tls_pie_pic_test): New target.
7368         * testsuite/Makefile.in: Rebuild.
7369
7370         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7371         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7372         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7373         * testsuite/Makefile.in: Rebuild.
7374
7375 2010-02-09  David S. Miller  <davem@davemloft.net>
7376
7377         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7378         R_SPARC_RELATIVE using ->add_local_relative().
7379         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7380
7381         * output.h (Output_data_dynamic::add_section_size): New method
7382         that takes two Output_data objects.
7383         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7384         entry param.  Handle it in initializers.
7385         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7386         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7387         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7388         arg.
7389         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7390         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7391         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7392         for dynrel_includes_plt.
7393         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7394         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7395         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7396         before .rela.plt
7397         (Target_sparc::do_finalize_sections): Update to pass true for
7398         dynrel_includes_plt.
7399         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7400         output before .rela.plt
7401         (Target_powerpc::do_finalize_sections): Update to pass true for
7402         dynrel_includes_plt when 32-bit.
7403
7404 2010-02-08  Doug Kwan  <dougkwan@google.com>
7405
7406         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7407         method.
7408         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7409         Arm_relobj::scan_section_for_cortex_a8_stubs,
7410         Arm_relobj::do_relocation_section): Instead of calling
7411         Output_section::output_address, use faster
7412         Arm_relobj::simple_input_section_output_address.
7413
7414 2010-02-08  David S. Miller  <davem@davemloft.net>
7415
7416         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7417         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7418         relocation helper function.
7419
7420         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7421         just like R_SPARC_GOT{10,13,22}.
7422         (Target_sparc::Scan::local): Likewise.
7423         (Target_sparc::Relocate:relocate): Likewise.
7424
7425 2010-02-06  Ian Lance Taylor  <iant@google.com>
7426
7427         * configure.ac: Rewrite targetobjs duplicate removal code to use
7428         only shell constructs.
7429         * configure: Rebuild.
7430
7431 2010-02-05  Doug Kwan  <dougkwan@google.com>
7432
7433         PR 11247
7434         * arm.cc (Arm_relobj::section_is_scannable): New method.
7435         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7436         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7437
7438 2010-02-04  Doug Kwan  <dougkwan@google.com>
7439
7440         PR 11247
7441         * arm-reloc-property.cc (cstdio): Include.
7442         * configure.ac (targetobjs): Remove duplicates.
7443         * configure: Regenerate.
7444         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7445         big and little endian version for a given address size.
7446
7447 2010-02-03  Doug Kwan  <dougkwan@google.com>
7448
7449         * arm-reloc-property.cc
7450         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7451         definition.
7452         * arm-reloc-property.h
7453         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7454         New method definition.
7455         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7456         declaration.
7457         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7458         overflow to N.
7459         (GOT_PREL): Change implemented to Y.
7460         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7461         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7462         (Arm_relocate_functions::movw_abs_nc): Remove method.
7463         (Arm_relocate_functions::movt_abs): Ditto.
7464         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7465         (Arm_relocate_functions::thm_movt_abs): Ditto.
7466         (Arm_relocate_functions::movw_rel_nc): Ditto.
7467         (Arm_relocate_functions::movw_rel): Ditto.
7468         (Arm_relocate_functions::movt_rel): Ditto.
7469         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7470         (Arm_relocate_functions:thm_movw_rel): Ditto.
7471         (Arm_relocate_functions:thm_movt_rel): Ditto.
7472         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7473         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7474         New method definitions.
7475         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7476         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7477         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7478         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7479         (Target_arm::Relocate::relocate): Check for non-static or
7480         unimplemented relocation code and exit early.  Change calls to
7481         Target_arm::reloc_uses_thumb_bit and
7482         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7483         instead.  Refactor code to handle similar relocations to increase
7484         code sharing.  Remove check for unsupported relocation code in switch
7485         statement.
7486         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7487         relocation property table to find out size.  Change error message to
7488         print out the name of a relocation code instead of the numeric value.
7489         (Target_arm::scan_reloc_for_stub): Use relocation property table
7490         instead of calling Target_arm::reloc_uses_thumb_bit().
7491
7492 2010-02-02  Doug Kwan  <dougkwan@google.com>
7493
7494         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7495         types of relaxed input section.
7496
7497 2010-02-02  Doug Kwan  <dougkwan@google.com>
7498
7499         * Makefile.am (HFILES): Add arm-reloc-property.h.
7500         (DEFFILES): New.
7501         (TARGETSOURCES): Add arm-reloc-property.cc
7502         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7503         (libgold_a_SOURCES): $(DEFFILES)
7504         * Makefile.in: Regenerate.
7505         * arm-reloc-property.cc: New file.
7506         * arm-reloc-property.h: New file.
7507         * arm-reloc.def: New file.
7508         * arm.cc: Update comments.
7509         (arm-reloc-property.h): New included header.
7510         (arm_reloc_property_table): New global variable.
7511         (Target_arm::do_select_as_default_target): New method definition.
7512         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7513         arm-reloc-property to targ_extra_obj.
7514         * parameters.cc (set_parameters_target): Call
7515         Target::select_as_default_target().
7516         * target.h (Target::select_as_default_target): New method definition.
7517         (Target::do_select_as_default_target): Same.
7518
7519 2010-02-01  Doug Kwan  <dougkwan@google.com>
7520
7521         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7522         first_output_text_section_.
7523         (Arm_exidx_fixup::first_output_text_section): New method definition.
7524         (Arm_exidx_fixup::first_output_text_section_): New data member.
7525         (Arm_exidx_fixup::process_exidx_section): Record the first text
7526         output section seen.
7527         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7528         and entsize in output section header.
7529
7530 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7531
7532         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7533         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7534         (Arm_relocate_functions::thm_alu11): New Method.
7535         (Arm_relocate_functions::thm_pc8): New Method.
7536         (Arm_relocate_functions::thm_pc12): New Method.
7537         (Target_arm::Scan::local): Handle the relocations.
7538         (Target_arm::Scan::global): Likewise.
7539         (Target_arm::Relocate::relocate): Likewise.
7540         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7541
7542 2010-01-29  Doug Kwan  <dougkwan@google.com>
7543
7544         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7545         of relocation types as ld.
7546
7547 2010-01-29  Doug Kwan  <dougkwan@google.com>
7548
7549         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7550         to public.
7551         (Arm_relocate_functions::thumb_branch_common): Ditto.
7552         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7553         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7554         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7555         Arm_relocate_functions::jump24): Remove.
7556         (Target_arm::Relocate::relocate): Adjust code to call
7557         Arm_relocation_functions::arm_branch_common and
7558         Arm_relocation_functions::thumb_branch_common instead of their removed
7559         wrappers.  Merge switch-cases together to reduce source code size.
7560
7561 2010-01-29  Doug Kwan  <dougkwan@google.com>
7562
7563         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7564         output_local_symbol_count_needs_update_.
7565         (Arm_relobj::output_local_symbol_count_needs_update,
7566          Arm_relobj::set_output_local_symbol_count_needs_update,
7567          Arm_relobj::update_output_local_symbol_count): New methods.
7568         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7569         member.
7570         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7571         of pointed function as in a R_ARM_PREL31 relocation.
7572         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7573         for output local symbol count updating.
7574         (Target_arm::do_relax): Update output local symbol counts in objects
7575         if necessary.
7576         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7577
7578 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7579
7580         * arm.cc: Added support for the ARM relocations:
7581         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7582         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7583         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7584         movw_prel_nc).
7585         (Arm_relocate_functions::movw_rel): New method.
7586         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7587         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7588         thm_movw_prel_nc).
7589         (Arm_relocate_functions::thm_movw_rel): New method.
7590         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7591         thm_movt_prel).
7592         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7593         relocations.
7594         (Target_arm::Scan::global): Likewise.
7595         (Target_arm::Relocate::relocate): Likewise.
7596         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7597         Likewise.
7598
7599 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7600
7601         * arm.cc: Added support for ARM group relocations.
7602         (Target_arm::reloc_needs_sym_origin): New method.
7603         (Arm_relocate_functions::calc_grp_kn): New method.
7604         (Arm_relocate_functions::calc_grp_residual): New method.
7605         (Arm_relocate_functions::calc_grp_gn): New method.
7606         (Arm_relocate_functions::arm_grp_alu): New Method.
7607         (Arm_relocate_functions::arm_grp_ldr): New Method.
7608         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7609         (Arm_relocate_functions::arm_grp_ldc): New Method.
7610         (Target_arm::Scan::local): Handle the ARM group relocations.
7611         (Target_arm::Scan::global): Likewise.
7612         (Target_arm::Relocate::relocate): Likewise.
7613         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7614         Likewise.
7615
7616 2010-01-26  Doug Kwan  <dougkwan@google.com>
7617
7618         * arm.cc (set): Include.
7619         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7620         pointer type.
7621         (Arm_output_section::Text_section_list): New type.
7622         (Arm_output_section::append_text_sections_to_list): New method.
7623         (Arm_output_section::fix_exidx_coverage): Ditto.
7624         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7625         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7626         Relobj::set_section_offset() instead of
7627         Sized_relobj::invalidate_section_offset().
7628         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7629         parameter for section headers. Ignore relocation sections for
7630         unallocated sections and EXIDX sections.
7631         (Target_arm::fix_exidx_coverage): New method.
7632         (Target_arm::output_section_address_less_than): New type.
7633         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7634         linked text section instead of the EXIDX section.
7635         (Arm_output_section::create_stub_group): Add an assertion to check
7636         that this is not an EXIDX output section.
7637         (Arm_output_section::append_text_sections_to_list): New method.
7638         (Arm_output_section::fix_exidx_coverage): Ditto.
7639         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7640         Arm_relobj::section_needs_reloc_stub_scanning.
7641         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7642         first pass.
7643         (Target_arm::fix_exidx_coverage): New method.
7644         * object.h (Relobj::set_output_section): New method.
7645         (Sized_relobj::invalidate_section_offset): Remove method.
7646         (Sized_relobj::do_invalidate_section_offset): Remove method.
7647         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7648
7649 2010-01-25  Doug Kwan  <dougkwan@google.com>
7650
7651         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7652         Fix warning due to signed and unsigned comparison on a 32-bit host.
7653
7654 2010-01-22  Doug Kwan  <dougkwan@google.com>
7655
7656         * arm.cc (Target_arm::do_relax): Record an output section for section
7657         offset adjustment it contains any stub table that has changed.
7658         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7659         offsets in an output section if necessary.
7660         * output.cc (Output_section::Output_section): Initialize
7661         section_offsets_need_adjustments_.
7662         (Output_section::add_input_section_for_script): Renamed to
7663         Output_section::add_simple_input_section.
7664         (Output_section::save_states): Add a comment.
7665         (Output_section::discard_states): New method defintion.
7666         (Output_section::adjust_section_offsets): Same.
7667         * output.h (Output_section::add_input_section_for_script): Renamed to
7668         Output_section::add_simple_input_section.
7669         (Output_section::discard_states): New method declaration.
7670         (Output_section::adjust_section_offsets): Same.
7671         (Output_section::section_offsets_need_adjustment,
7672         Output_section::set_section_offsets_need_adjustment): New method
7673         definitions.
7674         (Output_section::section_offsets_need_adjustment_): New data member.
7675         * script-sections.cc
7676         (Output_section_element_input::set_section_address): Adjust code for
7677         renaming of Output_section::add_input_section_for_script.
7678         (Orphan_output_section::set_section_address): Same.
7679
7680 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7681
7682         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7683         Fix_v4bx enum values .
7684         * gold/options.h (General_options): New option definitions.
7685         (General_options::fix_v4bx): New method.
7686         (General_options::Fix_v4bx): New enum.
7687         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7688         (General_options::parse_fix_v4bx_interworking): New method.
7689
7690 2010-01-22  Doug Kwan  <dougkwan@google.com>
7691
7692         * arm.cc (Arm_exidx_fixup): New class.
7693
7694 2010-01-21  Doug Kwan  <dougkwan@google.com>
7695
7696         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7697         classes.
7698         (Arm_exidx_section_offset_map): New type.
7699
7700 2010-01-21  Doug Kwan  <dougkwan@google.com>
7701
7702         * arm.cc (Arm_exidx_input_section): New class.
7703         (Arm_relobj::exidx_input_section_by_link,
7704         Arm_relobj::exidx_input_section_by_shndx,
7705         Arm_relobj::make_exidx_input_section): New methods.
7706         (read_arm_attributes_section): Remove.
7707         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7708         information about them.
7709         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7710         to here.
7711
7712 2010-01-20  Doug Kwan  <dougkwan@google.com>
7713
7714         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7715         Input_section_specifier to Section_id.
7716         (Target_arm::new_arm_input_section: Adjust code for change of key
7717         type.
7718         (Target_arm::find_arm_input_section): Ditto.
7719         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7720         (Section_id): Remove.
7721         (Garbage_collection::Section_id_hash): Remove.
7722         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7723         (Section_id): Remove.
7724         (Icf::Section_id_hash): Remove.
7725         * object.h (Section_id, Const_section_id, Section_id_hash,
7726         Const_section_id_hash): New type definitions.
7727         * output.cc (Output_section::add_relaxed_input_section): Change to
7728         use Const_section_id instead of Input_section_specifier as key type.
7729         (Output_section::add_merge_input_section): Ditto.
7730         (Output_section::build_relaxation_map): Change to use Section_id
7731         instead of Input_section_specifier as key type.
7732         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7733         Ditto.
7734         (Output_section::convert_input_sections_to_relaxed_sections): Change
7735         to use Const_section_id instead of Input_section_specifier as key type.
7736         (Output_section::find_merge_section): Ditto.
7737         (Output_section::find_relaxed_input_section): Ditto.
7738         * output.h (Input_section_specifier): Remove class.
7739         (Output_section::Output_section_data_by_input_section_map): Change
7740         key type to Const_section_id.
7741         (Output_section::Output_relaxed_input_section_by_input_section_map):
7742         Ditto.
7743         (Output_section::Relaxation_map): Change key type to Section_id.
7744
7745 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7746
7747         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7748         (class Arm_v4bx_stub): New class.
7749         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7750         (Stub_factory::make_arm_v4bx_stub): New method.
7751         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7752         (Stub_table::empty): Handle v4bx stubs.
7753         (Stub_table::add_arm_v4bx_stub): New method.
7754         (Stub_table::find_arm_v4bx_stub): New method.
7755         (Arm_relocate_functions::v4bx): New method.
7756         (Target_arm::fix_v4bx): New method.
7757         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7758         (Stub_table::relocate_stubs): Likewise.
7759         (Stub_table::do_write): Likewise.
7760         (Stub_table::update_data_size_and_addralign): Likewise.
7761         (Stub_table::finalize_stubs):  Likewise.
7762         (Target_arm::Scan::local): Likewise.
7763         (Target_arm::Scan::global): Likewise.
7764         (Target_arm::do_finalize_sections): Likewise.
7765         (Target_arm::Relocate::relocate): Likewise.
7766         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7767         Likewise.
7768         (Target_arm::scan_reloc_for_stub): Likewise.
7769         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7770
7771 2010-01-19  Ian Lance Taylor  <iant@google.com>
7772
7773         * output.cc (Output_section_headers::do_sized_write): Write large
7774         segment count to sh_info field.
7775         (Output_file_header::do_sized_write): For large segment count,
7776         write PN_XNUM to e_phnum field.
7777
7778 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7779
7780         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7781         (Arm_relocate_functions::thm_jump8): New function.
7782         (Arm_relocate_functions::thm_jump11): New function.
7783         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7784         R_ARM_THM_JUMP11.
7785         (Target_arm::Scan::global): Likewise.
7786         (Target_arm::Relocate::relocate): Likewise.
7787         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7788         Likewise.
7789
7790 2010-01-14  Doug Kwan  <dougkwan@google.com>
7791
7792         * arm.cc (map, utility): Include headers.
7793         (Target_arm::apply_cortex_a8_workaround): New method.
7794         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7795         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7796         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7797         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7798         the --[no-]fix-cortex-a8 command line options.
7799         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7800         (Target_arm::relocate_stub): Use addend in instruction template.
7801         * options.h (DEFINE_bool): Set the user-set flag.
7802         (General_options): Add --[no-]-fix-cortex options.
7803         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7804         : Update fast look-up map after conversion.
7805
7806 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7807
7808         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7809         in the first pass of do_layout.
7810
7811 2010-01-13  Doug Kwan  <dougkwan@google.com>
7812
7813         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7814         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7815         apparent compiler problem of not folding static constant integral
7816         data members of elfcpp::Elf_sizes<32>.
7817
7818 2010-01-13  Doug Kwan  <dougkwan@google.com>
7819
7820         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7821         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7822         Arm_relobj::scan_section_for_cortex_a8_erratum,
7823         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7824         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7825         sections to scan for relocation stubs into a new method
7826         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7827         relocation and Cortex-A8 stub scanning.
7828         (Target_arm::do_relax): Force stubs to be after stubbed sections
7829         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7830         the beginning of a new relaxation pass.  Update a comment.
7831         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7832
7833 2010-01-12  Ian Lance Taylor  <iant@google.com>
7834
7835         * target-reloc.h (visibility_error): New inline function.
7836         (relocate_section): Call visibility_error.
7837         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7838         (MOSTLYCLEANFILES): Likewise.
7839         (protected_4_pic.o, protected_3.err): New targets.
7840         * testsuite/protected_4.cc: New file.
7841
7842 2010-01-12  Doug Kwan  <dougkwan@google.com>
7843
7844         * arm.cc (Cortex_a8_reloc): New class.
7845         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7846         and cortex_a8_relocs_info_.
7847         (Target_arm::fix_cortex_a8): New method definition.
7848         (Target_arm::Cortex_a8_relocs_info): New type.
7849         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7850         New data member declarations.
7851         (Target_arm::scan_reloc_for_stub): Record information about
7852         relocations for THUMB branches that might be exempted from the
7853         Cortex-A8 workaround.
7854         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7855         at the beginning of a relaxation pass.
7856
7857 2010-01-12  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7860         (Arm_relobj::Mapping_symbol_position,
7861          Arm_reloj::Mapping_symbol_position_less,
7862          Arm_relobj::Mapping_symbols_info): New types.
7863         (Target_arm::is_mapping_symbol_name): New method definition.
7864         (Arm_relobj::do_count_local_symbols): Save information about mapping
7865         symbols.
7866
7867 2010-01-11  Doug Kwan  <dougkwan@google.com>
7868
7869         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7870         Arm_relocate_functions::thumb32_branch_upper,
7871         Arm_relocate_functions::thumb32_branch_lower,
7872         Arm_relocate_functions::thumb32_cond_branch_offset,
7873         Arm_relocate_functions::thumb32_cond_branch_upper,
7874         Arm_relocate_functions::thumb32_cond_branch_lower,
7875         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7876         branch offset encoding.
7877         (Arm_relocate_functions::thumb_branch_common): Use new branch
7878         offset encoding methods to avoid code duplication.
7879         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7880         (Stub_addend_reader::operator()): Use new branch encoding method
7881         to avoid code duplication.
7882
7883 2010-01-11  Doug Kwan  <dougkwan@google.com>
7884
7885         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7886         (Target_arm::do_finalize_sections): Define special EXIDX section
7887         symbols only if referenced.
7888         * gc.h (Garbage_collection::add_reference): New method.
7889         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7890         code duplication.
7891
7892 2010-01-11  Ian Lance Taylor  <iant@google.com>
7893
7894         * script.cc (Version_script_info::build_expression_list_lookup):
7895         Change complaing about duplicate wildcard match from error to
7896         warning.
7897
7898         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7899         of 2009-12-30.
7900         (Version_script_info::Version_script_info): Initialize globs_,
7901         default_version_, default_is_global_, and exact_.  Don't
7902         initialize globals_ or locals_.
7903         (Version_script_info::build_lookup_tables): Build local symbols
7904         first.
7905         (Version_script_info::unquote): New function.
7906         (Version_script_info::add_exact_match): New function.
7907         (Version_script_info::build_expression_list_lookup): Remove lookup
7908         parameter.  Add is_global parameter.  Change all callers.  Handle
7909         wildcard pattern specially.  Unquote pattern.  Call
7910         add_exact_match.
7911         (Version_script_info::get_name_to_match): New function.
7912         (Version_script_info::get_symbol_version): New function.
7913         (Version_script_info::get_symbol_version_helper): Remove.
7914         (Version_script_info::check_unmatched_names): Call unquote.
7915         * script.h (class Version_script_info): Change get_symbol_version
7916         to be non-inline and add is_global parameter; change all callers.
7917         Rewrite symbol_is_local.  Update declarations.  Define struct
7918         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7919         Remove globals_ and locals_ members.  Add exact_, globs_,
7920         default_version_, is_global_.
7921         (Version_script_info::Glob): Remove pattern, add expression and
7922         is_global.  Update constructor.  Change all callers.
7923         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7924         default version.
7925         (Versions::symbol_section_contents): If a symbol is undefined, or
7926         defined in a dynamic object, set the version index to
7927         VER_NDX_LOCAL.
7928         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7929         symbol_is_local.
7930         (Symbol_table::add_from_pluginobj): Likewise.
7931         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7932
7933 2010-01-11  Doug Kwan  <dougkwan@google.com>
7934
7935         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7936         (incremental_dump_LDADD): Add linking option for libintl.
7937         * Makefile.in: Regenerate.
7938
7939 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7940
7941         PR gold/11144
7942         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7943         instead of -Ds.
7944         * testsuite/Makefile.in: Regenerated.
7945
7946 2010-01-10  Doug Kwan  <dougkwan@google.com>
7947
7948         * options.h (DEFINE_var): Use parentheses around argument varname__
7949         in macro body to avoid any unintended subsequent substitutions.
7950
7951 2010-01-10  Ian Lance Taylor  <iant@google.com>
7952
7953         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7954         candidates before doing symbol resolution.
7955
7956         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7957         ODR candidates if only one is weak.
7958
7959 2010-01-08  Ian Lance Taylor  <iant@google.com>
7960
7961         * script.cc (Version_script_info::build_expression_list_lookup):
7962         Don't warn about ambiguous version, just record the ambiguity.
7963         (Version_script_info::get_symbol_version_helper): Give error if
7964         version is ambiguous.
7965
7966 2010-01-08  Doug Kwan  <dougkwan@google.com>
7967
7968         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7969         prev_data_size_ and prev_addralign_.  Remove initializer for
7970         deleted data member has_been_changed_.
7971         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7972         to determine if the table is empty.
7973         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
7974         Remove.
7975         (Stub_table::add_reloc_stub): Define method in class definition
7976         instead of just declaring it there.
7977         (Stub_table::add_cortex_a8_stub): New method definition.
7978         (Stub_table::update_data_size_and_addralign): Ditto.
7979         (Stub_table::finalize_stubs): Ditto.
7980         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
7981         (Stub_table::do_addralign_): Return address alignment in the
7982         (Stub_table::do_reset_address_and_file_offset): Define method in
7983         class definition instead of declaring it there.  Set current data
7984         size to be the data size of the previous pass.
7985         (Stub_table::set_final_data_size): Use current data size as the
7986         final data size.
7987         (Stub_table::relocate_stub): Change parameter type of stub from
7988         Reloc_stub pointer to Stub pointer.
7989         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
7990         (Stub_table::Cortex_a8_stub_list): New typedef.
7991         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
7992          Stub_table::prev_addralign_): New data member.
7993         (Arm_relobj::Arm_relobj): Initialize data member
7994         section_has_cortex_a8_workaround_.
7995         (Arm_relobj::section_has_cortex_a8_workaround,
7996          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
7997          definitions.
7998         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
7999         declarations.
8000         (Target_arm::relocate_stub): Change parameter type of stub from
8001         Reloc_stub pointer to Stub pointer.
8002         (Insn_template::size, Insn_template::alignment): Handle
8003         THUMB16_SPECIAL_TYPE.
8004         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8005          Stub_table::update_data_size_and_addralign,
8006          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8007         definitions.
8008         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8009         (Stub_table::do_write): Ditto.
8010         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8011
8012 2010-01-08  Ian Lance Taylor  <iant@google.com>
8013
8014         PR 11108
8015         * symtab.h (class Symbol): Remove fields is_target_special_ and
8016         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8017         (Symbol::is_defined_in_discarded_section): New function.
8018         (Symbol::set_is_defined_in_discarded_section): New function.
8019         (Symbol::has_plt_offset): Rewrite.
8020         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8021         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8022         Don't initialize is_target_special_ or has_plt_offset_.
8023         Initialize is_defined_in_discarded_section_.
8024         (Symbol_table::add_from_relobj): If appropriate, set
8025         is_defined_in_discarded_section.
8026         * resolve.cc (Symbol::override_base_with_special): Don't test
8027         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8028         * target-reloc.h (relocate_section): Do special handling for
8029         symbols defined in discarded sections for global symbols as well
8030         as local symbols.
8031
8032 2010-01-08  Ian Lance Taylor  <iant@google.com>
8033
8034         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8035         the SHT_SYMTAB case.
8036
8037 2010-01-08  Ian Lance Taylor  <iant@google.com>
8038
8039         * object.cc (Sized_relobj::do_layout): Don't get confused if
8040         layout_eh_frame returns NULL.
8041
8042 2010-01-08  Ian Lance Taylor  <iant@google.com>
8043
8044         PR 11084
8045         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8046         dynamic symbol table, use the normal symbol table.
8047         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8048         symbol table.
8049
8050 2010-01-08  Ian Lance Taylor  <iant@google.com>
8051
8052         PR 11072
8053         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8054         sections.
8055
8056 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8057
8058         * version.cc (print_version): Change to "Copyright 2010".
8059
8060 2010-01-08  Ian Lance Taylor  <iant@google.com>
8061
8062         PR 10287
8063         PR 11063
8064         * i386.cc (class Target_i386): Change return type of plt_section
8065         to be non-const.
8066         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8067         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8068         tls_desc_rel_ field.
8069         (Output_data_plt_i386::rel_tls_desc): New function.
8070         (Target_i386::rel_tls_desc_section): New function.
8071         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8072         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8073         R_386_TLS_DESC reloc in rel_tls_desc_section.
8074         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8075         Define struct Tlsdesc_info.
8076         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8077         (Target_x86_64::do_reloc_symbol_index): New function.
8078         (Target_x86_64::add_tlsdesc_info): New function.
8079         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8080         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8081         tlsdesc_rel_ field.
8082         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8083         all callers.
8084         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8085         (Target_x86_64::rela_tlsdesc_section): New function.
8086         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8087         handling.
8088         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8089         (Target_x86_64::do_reloc_addend): New function.
8090         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8091         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8092         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8093         (Output_reloc::type): New function.
8094         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8095         (Output_reloc::is_target_specific): New function.
8096         (Output_reloc::target_arg): New function.
8097         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8098         absolute relocs and target specific relocs.
8099         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8100         add_target_specific.
8101         (class Output_data_reloc) [SHT_RELA]: Likewise.
8102         * output.cc (Output_reloc::Output_reloc): Add four new versions
8103         for absolute relocs and target specific relocs.
8104         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8105         (Output_reloc::get_symbol_index): Likewise.
8106         (Output_reloc::local_section_offset): Check that local_sym_index_
8107         is not TARGET_CODE or 0.
8108         (Output_reloc::symbol_value): Likewise.
8109         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8110         reloc.
8111         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8112         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8113         functions.
8114         * layout.cc (add_target_dynamic_tags): Use output section for
8115         DT_PLTRELSZ and DT_JMPREL.
8116
8117 2010-01-07  Ian Lance Taylor  <iant@google.com>
8118
8119         PR 11061
8120         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8121         function.
8122         (class Output_data_reloc_generic): Define.
8123         (class Output_data_reloc_base): Change base class to
8124         Output_data_reloc_generic.  Change add() method to call
8125         bump_relative_reloc_count for a relative reloc.  Remove
8126         sort_relocs_ field.
8127         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8128         to sort_relocs().
8129         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8130         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8131         appropriate.
8132         * layout.h (class Layout): Update declaration.
8133
8134 2010-01-07  Ian Lance Taylor  <iant@google.com>
8135
8136         * output.h (class Output_data): Add const version of
8137         output_section and do_output_section.
8138         (class Output_section_data): Add const version of
8139         do_output_section.
8140         (class Output_section): Likewise.
8141         * layout.cc (Layout::add_target_dynamic_tags): New function.
8142         * layout.h (class Layout): Update declarations.
8143         * arm.cc (Target_arm::do_finalize_sections): Use
8144         add_target_dynamic_tags.
8145         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8146         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8147         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8148         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8149
8150 2010-01-07  Ian Lance Taylor  <iant@google.com>
8151
8152         PR 11042
8153         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8154         object as needed.
8155
8156 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8157             Ian Lance Taylor  <iant@google.com>
8158
8159         PR 11019
8160         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8161         Xindex::read_symtab_xindex.
8162
8163 2010-01-07  Doug Kwan  <dougkwan@google.com>
8164
8165         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8166         (Insn_template::thumb16_bcond_insn): New method declaration.
8167         (Insn_template): Fix spelling.
8168         (Stub::thumb16_special): New method declaration.
8169         (Stub::do_write): Define virtual method which was previously pure
8170         virtual.
8171         (Stub::do_thumb16_special): New method declaration.
8172         (Stub::do_fixed_endian_write): New template member.
8173         (Reloc_stub::do_write): Remove.
8174         (Reloc_stub::do_fixed_endian_write): Remove.
8175         (Cortex_a8_stub): New class definition.
8176         (Stub_factory::make_cortex_a8_stub): New method definition.
8177         (Stub_factory::Stub_factory): Add missing static storage class
8178         qualifier for elf32_arm_stub_a8_veneer_blx.
8179
8180 2010-01-07  Ian Lance Taylor  <iant@google.com>
8181
8182         PR 10980
8183         * options.h (class General_options): Add --warn-unresolved-symbols
8184         and --error-unresolved-symbols.
8185         * errors.cc (Errors::undefined_symbol): Implement
8186         --warn-unresolved-symbols.
8187
8188         * options.h (class General_options): Add -z text and -z textoff.
8189         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8190
8191 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8192
8193         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8194         (Garbage_collection::cident_sections): New function.
8195         (Garbage_collection::add_cident_section): New function.
8196         (Garbage_collection::cident_sections_): New member.
8197         (gc_process_relocs): Add references to sections whose names are C
8198         identifiers.
8199         * gold.h (cident_section_start_prefix): New constant.
8200         (cident_section_stop_prefix): New constant.
8201         (is_cident): New function.
8202         * layout.cc (Layout::define_section_symbols): Replace string constants
8203         with the newly defined constants.
8204         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8205         C identifiers.
8206         * testsuite/Makefile.am: Add gc_orphan_section_test.
8207         * testsuite/Makefile.in: Regenerate.
8208         * testsuite/gc_orphan_section_test.cc: New file.
8209         * testsuite/gc_orphan_section_test.sh: New file.
8210
8211 2010-01-06  Ian Lance Taylor  <iant@google.com>
8212
8213         PR 10980
8214         * options.h (class General_options): Add --warn-shared-textrel.
8215         * layout.cc (Layout::finish_dynamic_section): Implement
8216         --warn-shared-textrel.
8217
8218         PR 10980
8219         * options.h (class General_options): Add --warn-multiple-gp.
8220
8221 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8222
8223         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8224         $(THREADSLIB) and $(LIBDL).
8225         * Makefile.in: Rebuild.
8226
8227 2010-01-06  Ian Lance Taylor  <iant@google.com>
8228
8229         PR 10980
8230         * options.cc (General_options::parse_section_start): New function.
8231         (General_options::section_start): New function.
8232         (General_options::General_options): Initialize all members.
8233         * options.h: Include <map>
8234         (class General_options): Add --section-start.  Add section_starts_
8235         member.
8236         * layout.cc (Layout::attach_allocated_section_to_segment): If
8237         --section-start was used, set the address of the segment.  Remove
8238         local sort_sections.
8239         (Layout::relaxation_loop_body): If the address of the load segment
8240         has been set by --section-start, don't use it.
8241         * output.h (Output_segment::update_flags_for_output_section): New
8242         function.
8243         * output.cc (Output_segment::add_output_section): Call
8244         update_flags_for_output_section.
8245
8246 2010-01-05  Ian Lance Taylor  <iant@google.com>
8247
8248         PR 10980
8249         * options.h (class General_options): Add --undefined-version.
8250         * script.cc (struct Version_expression): Add was_matched_by_symbol
8251         field.
8252         (Version_script_info::matched_symbol): New function.
8253         (Version_script_info::get_symbol_version_helper): Call
8254         matched_symbol.
8255         (Version_script_info::check_unmatched_names): New function.
8256         * script.h (class Version_script_info): Update declarations.
8257         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8258
8259         * options.h (class General_options): Use DEFINE_bool_alias for
8260         allow_multiple_definition.
8261         * resolve.cc (Symbol_table::should_override): Don't test
8262         allow_multiple_definition.
8263
8264         PR 10980
8265         * options.h (class General_options): Add --cref.
8266         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8267         until after printing cref table.
8268         * cref.cc: Include "symtab.h".
8269         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8270         (Cref_table_compare::operator()): New function.
8271         (Cref_inputs::gather_cref): New function.
8272         (filecol): New static const.
8273         (Cref_inputs::print_cref): New function.
8274         (Cref::print_cref): New function.
8275         * cref.h: Include <cstdio>.
8276         (class Cref): Update declarations.
8277         * mapfile.h (Mapfile::file): New function.
8278         * object.h (class Object): Define Symbols.  Declare virtual
8279         do_get_global_symbols.
8280         (Object::get_global_symbols): New function.
8281         * object.cc (Input_objects::add_object): Pass object to cref_ if
8282         --cref.
8283         (Input_objects::archive_start): Likewise.
8284         (Input_objects::archive_stop): Likewise.
8285         (Input_objects::print_cref): New function.
8286         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8287         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8288         --cref.
8289         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8290         function.
8291         * plugin.h (class Sized_pluginobj): Update declarations.
8292
8293 2010-01-05  Ian Lance Taylor  <iant@google.com>
8294
8295         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8296         to is_default_version.  Rename insdef to insdefault.
8297         (Symbol_table::add_from_relobj): Rename def to is_default_version
8298         and local to is_forced_local.
8299         (Symbol_table::add_from_pluginobj): Likewise.
8300         (Symbol_table::add_from_dynobj): Likewise.
8301         (Symbol_table::define_special_symbol): Rename insdef to
8302         insdefault.
8303
8304 2010-01-04  Ian Lance Taylor  <iant@google.com>
8305
8306         PR 10980
8307         * options.h (class General_options): Add
8308         --allow-multiple-definition and -z muldefs.
8309         * resolve.cc (Symbol_table::should_override): Don't warn about a
8310         multiple symbol definition if --allow-multiple-definition or -z
8311         muldefs.
8312
8313         PR 10980
8314         * options.h (class General_options): Add --add-needed and
8315         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8316         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8317         error if --copy-dt-needed-entries aka --add-needed is used and
8318         would cause a change in behaviour.
8319
8320         PR 10980
8321         * options.h (class General_options): Add -G as a short version of
8322         --shared.  Add no-op options -assert, -g, and -i.
8323
8324 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8325
8326         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8327         check for .text or .gnu.linkonce.t sections.
8328         * icf.cc (Icf::find_identical_sections): Ditto.
8329         Change the detection for mangled function name within the section
8330         name.
8331         * icf.h (is_section_foldable_candidate): New function.
8332
8333 2009-12-30  Ian Lance Taylor  <iant@google.com>
8334
8335         PR 10980
8336         * options.h (class General_options): Permit two dashes with
8337         --retain-symbols-file.
8338
8339 2009-12-30  Ian Lance Taylor  <iant@google.com>
8340
8341         PR 10979
8342         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8343         don't put the file header and segment headers in the text
8344         segment.
8345
8346         PR 10979
8347         * common.cc (Sort_commons::operator()): Stabilize sort when both
8348         entries are NULL.
8349         (Symbol_table::do_allocate_commons_list): When allocating common
8350         symbols, skip a symbol which is no longer common.
8351         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8352         an object before checking its type.
8353         * testsuite/common_test_2.c: New file.
8354         * testsuite/common_test_3.c: New file.
8355         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8356         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8357         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8358         (common_test_2_pic.o, common_test_2.so): New targets.
8359         (common_test_3_pic.o, common_test_3.so): New targets.
8360         * testsuite/Makefile.in: Rebuild.
8361
8362         PR 10979
8363         * script.cc (read_input_script): If we see a new SECTIONS clause,
8364         and we have added an input section, give an error.
8365         * layout.h (class Layout): Add have_added_input_section function.
8366         Add have_added_input_section_ field.
8367         * layout.cc (Layout::Layout): Initialize
8368         have_added_input_section_.
8369         (Layout::layout): Set have_added_input_section_.
8370         (Layout::layout_eh_frame): Likewise.
8371
8372 2009-12-30  Ian Lance Taylor  <iant@google.com>
8373
8374         PR 10931
8375         * options.h (class General_options): Add --sort-common option.
8376         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8377         * common.cc (Sort_common): Add sort_order parameter to
8378         constructor.  Add sort_order_ field.
8379         (Sort_commons::operator): Check sort_order_.
8380         (Symbol_table::allocate_commons): Determine the sort order.
8381         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8382         Change all callers.
8383         (Symbol_table::do_allocate_commons_list): Likewise.
8384
8385 2009-12-30  Ian Lance Taylor  <iant@google.com>
8386
8387         PR 10916
8388         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8389         symbols from this object, don't change the visibility of an
8390         undefined symbol.
8391         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8392
8393 2009-12-30  Ian Lance Taylor  <iant@google.com>
8394
8395         PR 10861
8396         * script.h (class Version_script_info): Define Language enum.
8397         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8398         new fields globals_, locals_, and is_finalized_.
8399         * script.cc: Various formatting fixes.
8400         (class Parser_closure): Change language_stack_ from a vector of
8401         std::string to one of Version_script_info::Language.  Adjust all
8402         uses accordingly.
8403         (class Lazy_demangler): Remove.
8404         (struct Version_expression): Change language from std::string to
8405         Version_script_info::Language.
8406         (Version_script_info::Version_script_info): New function.
8407         (Version_script_info::~Version_script_info): Don't call clear.
8408         (Version_script_info::finalize): New function.
8409         (Version_script_info::build_lookup_tables): New function.
8410         (Version_script_info::build_expression_list_lookup): New
8411         function.
8412         (Version_script_info::get_symbol_version_helper): Rewrite to use
8413         lookup tables.
8414         (Version_script_info::print_expression_list): Adjust to use
8415         Version_script_info::Language.
8416         (script_push_lex_into_version_mode): Check that the version script
8417         has not been finalized.
8418         (version_script_push_lang): Change language string to
8419         Version_script_info::Language.
8420         * options.cc (Command_line::version_script): New function.
8421         * options.h (class General_options): Add finalize_dynamic_list
8422         function.  Change version_script from declaration to definition.
8423         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8424         * testsuite/version_script.map: Remove duplicate def of foo.
8425         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8426         version_script.map.
8427         * testsuite/Makefile.in: Rebuild.
8428
8429 2009-12-30  Ian Lance Taylor  <iant@google.com>
8430
8431         PR 10843
8432         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8433         if the input symbol index is 0, make the output symbol index 0.
8434
8435 2009-12-30  Ian Lance Taylor  <iant@google.com>
8436
8437         PR 10670
8438         * options.h (class General_options): Add -x/--discard-all.
8439         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8440         --discard-all.  If the local symbol needs a dynamic entry, check
8441         that before handling --discard-locals.
8442
8443 2009-12-30  Ian Lance Taylor  <iant@google.com>
8444
8445         PR 10450
8446         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8447         flags to PF_R.
8448         (Output_segment::add_output_section): Don't change the flags if
8449         the type is PT_TLS.
8450
8451         PR 10450
8452         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8453         GNU hash table if they need a dynamic value.  Otherwise, don't add
8454         them if they are defined in a dynamic object or are forced local.
8455
8456 2009-12-29  Ian Lance Taylor  <iant@google.com>
8457
8458         PR 10450
8459         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8460         .gnu.hash table for a 32-bit target.
8461
8462         PR 10450
8463         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8464         regular and a dynamic object only needs a dynamic symbol table
8465         entry if it is externally visible.
8466
8467         PR 10450
8468         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8469         constructor.  Add global_offset_table_ field.
8470         (Target_i386::got_section): Set global_offset_table_.
8471         (Target_i386::do_finalize_sections): Set global_offset_table_
8472         size.
8473         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8474         in constructor.  Add global_offset_table_ field.
8475         (Target_x86_64::got_section): Set global_offset_table_.
8476         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8477         size.
8478
8479         * layout.cc (Layout::Layout): Initialize increase_relro_.
8480         (Layout::get_output_section): Add is_relro, is_last_relro, and
8481         is_first_non_relro parameters.  Change all callers.
8482         (Layout::choose_output_section): Likewise.
8483         (Layout::add_output_section_data): Likewise.
8484         (Layout::make_output_section): Likewise.
8485         (Layout::set_segment_offsets): Clear increase_relro when using a
8486         linker script.
8487         * layout.h (class Layout): Add increase_relro method.  Add
8488         increase_relro_ field.  Update declarations.
8489         * output.cc (Output_section::Output_section): Initialize
8490         is_last_relro_ and is_first_non_relro_.
8491         (Output_segment::add_output_section): Group relro sections is
8492         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8493         (Output_segment::maximum_alignment): Remove relro handling.
8494         (Output_segment::set_section_addresses): Add increase_relro
8495         parameter.  Change all callers.  Add initial alignment to align
8496         relro sections on separate page.  Remove old relro handling.
8497         (Output_segment::set_section_list_addresses): Remove in_relro
8498         parameter.  Change all callers.
8499         (Output_segment::set_offset): Add increase parameter.  Change all
8500         callers.  Remove old relro handling.
8501         * output.h (class Output_section): Add new methods: is_last_relro,
8502         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8503         Add is_last_relro_ and is_first_non_relro_ fields.
8504         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8505         Create separate .got.plt section.  Call increase_relro.
8506         * x86_64.cc (Target_x86_64::got_section): Likewise.
8507         * testsuite/relro_script_test.t: Add .got.plt.
8508
8509         PR 10450
8510         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8511         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8512         (Layout::finalize): Call set_dynamic_symbol_size.
8513         (Layout::set_dynamic_symbol_size): New function.
8514         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8515         set_dynamic_symbol_size.
8516
8517         PR 10450
8518         * output.h (class Output_section): Add is_entsize_zero_ field.
8519         * output.cc (Output_section::Output_section): Initialize
8520         is_entsize_zero_.
8521         (Output_section::set_entsize): If two different entsizes are
8522         requested, force it to zero.
8523         (Output_section::add_input_section): Set flags for .debug_str
8524         before updating section flags.  Set entsize.
8525         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8526         and SHF_STRING if all input sections have those flags.
8527
8528 2009-12-29   Rafael Espindola  <espindola@google.com>
8529
8530         * main.cc (main): Fix the sys time reporting.
8531         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8532         reporting.
8533
8534 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8535
8536         * options.cc (General_options::parse_version): Allow -v to exit
8537         without an error if there is nothing to link.
8538
8539 2009-12-29  Ian Lance Taylor  <iant@google.com>
8540
8541         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8542         using a version of gcc before 4.1.
8543         * configure: Rebuild.
8544
8545 2009-12-28  Chris Demetriou  <cgd@google.com>
8546
8547         * attributes.cc (Output_attributes_section_data::do_write): Use
8548         std::vector::front rather than std::vector::data.
8549
8550 2009-12-28  Ian Lance Taylor  <iant@google.com>
8551
8552         * symtab.h (class Symbol_table): Add enum Defined.
8553         * resolve.cc (Symbol_table::should_override): Add defined
8554         parameter.  Change all callers.  Test whether object is NULL
8555         before calling a method on it.
8556         (Symbol_table::report_resolve_problem): Add defined parameter.
8557         Change all callers.
8558         (Symbol_table::should_override_with_special): Likewise.
8559         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8560         parameter.  Change all callers.
8561         (Symbol_table::do_define_in_output_data): Likewise.
8562         (Symbol_table::define_in_output_segment): Likewise.
8563         (Symbol_table::do_define_in_output_segment): Likewise.
8564         (Symbol_table::define_as_constant): Likewise.
8565         (Symbol_table::do_define_as_constant): Likewise.
8566         * script.h (class Symbol_assignment): Add is_defsym parameter to
8567         constructor; change all callers.
8568         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8569         parameter.  Change all callers.  Add is_defsym_ field.
8570         (class Parser_closure): Add parsing_defsym parameter to
8571         constructor; change all callers.  Add parsing_defsym accessor
8572         function.  Add parsing_defsym_ field.
8573
8574 2009-12-28  Ian Lance Taylor  <iant@google.com>
8575
8576         * gold.cc (queue_middle_tasks): Fix formatting.
8577         * object.cc (Relobj::is_section_name_included): Likewise.
8578
8579 2009-12-23  Ian Lance Taylor  <iant@google.com>
8580
8581         * i386.cc (Target_i386::do_calls_non_split): Recognize
8582         -fsplit-stack prologue for a function with a static chain.
8583         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8584         -fsplit-stack prologue when using %r11.
8585
8586 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8587
8588         * options.cc (General_options::parse_version): Make -v continue and do
8589         the link like GNU ld does.
8590
8591 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8592
8593         * Makefile.am (CCFILES): Add timer.cc.
8594         (HFILES): Add timer.h.
8595         * configure.ac: Check for sysconf and times.
8596         * main.cc: include timer.h.
8597         (main): Use Timer instead of get_run_time.
8598         * timer.cc: New.
8599         * timer.h: New.
8600         * workqueue.cc: include timer.h.
8601         (Workqueue::find_and_run_task):
8602         Report user, sys and wall time.
8603         * Makefile.in: Regenerate.
8604         * config.in: Regenerate.
8605         * configure: Regenerate.
8606
8607 2009-12-16  Doug Kwan  <dougkwan@google.com>
8608
8609         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8610         sections.
8611         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8612         relaxed input sections.
8613         * output.cc (Output_section::find_relaxed_input_section): Change
8614         return type to Output_relaxed_input_section pointer.  Adjust code
8615         for new type of relaxed_input_section_map_.
8616         * output.h (Output_section::find_relaxed_input_section): Change
8617         return type to Output_relaxed_input_section pointer.
8618         (Output_section::Output_relaxed_input_section_by_input_section_map):
8619         New type.
8620         (Output_section::relaxed_input_section_map_): Change type to
8621         Output_section::Output_relaxed_input_section_by_input_section_map.
8622         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8623         input section.
8624
8625 2009-12-15  Ian Lance Taylor  <iant@google.com>
8626
8627         * layout.cc (Layout::create_shstrtab): Only write out after input
8628         sections if we are compressing debug sections.
8629
8630 2009-12-15  Ian Lance Taylor  <iant@google.com>
8631
8632         * archive.cc (Archive::add_symbols): Only look up a symbol without
8633         a version if there is, in fact, a version.
8634
8635 2009-12-14  Ian Lance Taylor  <iant@google.com>
8636
8637         Revert -Wshadow changes, all changes from:
8638         2009-12-11  Doug Kwan  <dougkwan@google.com>
8639         2009-12-11  Nick Clifton  <nickc@redhat.com>
8640         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8641
8642 2009-12-11  Doug Kwan  <dougkwan@google.com>
8643
8644         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8645         due to -Wshadow.
8646         * attributes.cc (Object_attribute::size): Ditto.
8647         (Attributes_section_data::size): Ditto.
8648         (Attributes_section_data::Attributes_section_data): Ditto.
8649         (Output_attributes_section_data::do_write): Ditto.
8650         * attributes.h (Object_attribute::set_type): Ditto.
8651         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8652
8653 2009-12-11  Nick Clifton  <nickc@redhat.com>
8654
8655         * archive.cc: Fix shadowed variable warnings.
8656         * arm.cc: Likewise.
8657         * compressed_output.cc: Likewise.
8658         * compressed_output.h: Likewise.
8659         * configure: Likewise.
8660         * dwarf_reader.cc: Likewise.
8661         * dynobj.cc: Likewise.
8662         * dynobj.h: Likewise.
8663         * ehframe.cc: Likewise.
8664         * ehframe.h: Likewise.
8665         * errors.cc: Likewise.
8666         * expression.cc: Likewise.
8667         * fileread.cc: Likewise.
8668         * fileread.h: Likewise.
8669         * freebsd.h: Likewise.
8670         * i386.cc: Likewise.
8671         * icf.cc: Likewise.
8672         * incremental.h: Likewise.
8673         * layout.cc: Likewise.
8674         * layout.h: Likewise.
8675         * mapfile.cc: Likewise.
8676         * merge.cc: Likewise.
8677         * merge.h: Likewise.
8678         * object.cc: Likewise.
8679         * object.h: Likewise.
8680         * options.h: Likewise.
8681         * output.cc: Likewise.
8682         * output.h: Likewise.
8683         * parameters.cc: Likewise.
8684         * plugin.cc: Likewise.
8685         * powerpc.cc: Likewise.
8686         * reduced_debug_output.cc: Likewise.
8687         * reduced_debug_output.h: Likewise.
8688         * reloc.cc: Likewise.
8689         * reloc.h: Likewise.
8690         * resolve.cc: Likewise.
8691         * script-sections.cc: Likewise.
8692         * script.cc: Likewise.
8693         * script.h: Likewise.
8694         * sparc.cc: Likewise.
8695         * symtab.cc: Likewise.
8696         * symtab.h: Likewise.
8697         * target-select.cc: Likewise.
8698         * target-select.h: Likewise.
8699         * token.h: Likewise.
8700         * workqueue.cc: Likewise.
8701         * workqueue.h: Likewise.
8702         * x86_64.cc: Likewise.
8703
8704 2009-12-10  Doug Kwan  <dougkwan@google.com>
8705
8706         * arm.cc (attributes.h): New include.
8707         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8708         (Arm_relobj::~Arm_relobj): Delete object pointed by
8709         attributes_section_data_.
8710         (Arm_relobj::attributes_section_data): New method definition.
8711         (Arm_relobj::attributes_section_data_): New data member declaration.
8712         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8713         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8714         attributes_section_data_.
8715         (Arm_dynobj::attributes_section_data): New method definition.
8716         (Arm_dynobj::attributes_section_data_): New data member declaration.
8717         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8718         initialization value of may_use_blx_ to false.
8719         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8720         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8721         object attributes to compute results instead of hard-coding.
8722         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8723         Target_arm::get_secondary_compatible_arch,
8724         Target_arm::set_secondary_compatible_arch
8725         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8726         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8727         New method declarations.
8728         (Target_arm::get_aeabi_object_attribute): New method definition.
8729         (Target_arm::attributes_section_data_): New data member declaration.
8730         (read_arm_attributes_section): New template definition.
8731         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8732         (Arm_dynobj::do_read_symbols): Ditto.
8733         (Target_arm::do_finalize_sections): Merge attributes sections from
8734         input.  Check for BLX use after attributes section merging.
8735         Fix __exidx_start and __exidx_end visibility.  Create an
8736         .ARM.attributes section if necessary.
8737         (Target_arm::get_secondary_compatible_arch,
8738         Target_arm::set_secondary_compatible_arch,
8739         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8740         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8741         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8742         New method definitions.
8743
8744 2009-12-09  Ian Lance Taylor  <iant@google.com>
8745
8746         * plugin.cc (Plugin::load): Don't cast from void* to a function
8747         pointer.
8748
8749 2009-12-09  Ian Lance Taylor  <iant@google.com>
8750
8751         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8752         information fields.
8753
8754 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8755
8756         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8757         Replace two_file_shared_1.so with two_file_shared_2.so.
8758         * testsuite/Makefile.in: Regenerated.
8759
8760 2009-12-08  Doug Kwan  <dougkwan@google.com>
8761
8762         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8763         (HFILES): Add attributes.h and int_encoding.h.
8764         * Makefile.in: Regenerate.
8765         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8766         function definitions to int_encoding.cc
8767         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8768         prototypes to int_encoding.h
8769         * reduced_debug_output.cc (int_encoding.h): New include.
8770         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8771         function definitions to int_encoding.cc
8772         (insert_into_vector, read_from_pointer): Move template definitions to
8773         int_encoding.h
8774         * attributes.cc: New file.
8775         * attributes.h: New file.
8776         * int_encoding.cc: New file.
8777         * int_encoding.h: New file.
8778
8779 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8780
8781         PR gold/11055
8782         * incremental-dump.cc (dump_incremental_inputs): New.
8783         (main): Use dump_incremental_inputs.
8784
8785 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8786
8787         PR gold/10893
8788         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8789         checking elfcpp::STT_FUNC.
8790         (Target_i386::Relocate::relocate): Likewise.
8791         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8792
8793         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8794         symbols from shared libraries into normal FUNC symbols.
8795
8796         * symtab.h (Symbol): Add is_func and use it.
8797
8798 2009-12-05  Doug Kwan  <dougkwan@google.com>
8799
8800         * arm.cc (Target_arm::arm_info): Initialize new fields
8801         attributes_section and attributes_vendor.
8802         * i386.cc (Target_i386::i386_info): Same.
8803         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8804         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8805         fields attributes_section and attributes_vendor.
8806         * sparc.cc (Target_sparc::sparc_info): Same.
8807         * target.h (Target::attributes_section, Target::attributes_vendor,
8808         Target::is_attributes_section, Target::attribute_arg_type,
8809         Target::attributes_order): New method definitions.
8810         (Target::Target_info::attributes_section,
8811         Target::Target_info::attributes_vendor): New fields.
8812         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8813         virtual method definitions.
8814         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8815         attributes_section and attributes_vendor.
8816         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8817
8818 2009-12-05  Doug Kwan  <dougkwan@google.com>
8819
8820         * arm.cc: Update comments about interworking and stub generation.
8821         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8822         considered as non-PIC.
8823         (Arm_relocate_functions::base_abs): Fix formatting.
8824         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8825         of function to use GOT entry address instead of offset.
8826         (Target_arm::Scan::global): Issue an error if a symbol would need a
8827         PLT does not get one because it is untyped.  Remove code to create
8828         dynamic symbols for relative branches.
8829         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8830         takes unsigned integer instead of boolean.
8831
8832 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8833
8834         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8835         (two_file_test_LDADD): Likewise.
8836         (common_test_1_LDADD): Likewise.
8837         (exception_test_LDADD) Likewise.
8838         (weak_test_LDADD): Likewise.
8839         (many_sections_test_LDADD): Likewise.
8840         (initpri1_LDADD): Likewise.
8841         (script_test_1_LDADD): Likewise.
8842         (script_test_2_LDADD): Likewise.
8843         (justsyms_LDADD): Likewise.
8844         (binary_test_LDADD): Likewise.
8845         (large_LDADD): Likewise.
8846         * testsuite/Makefile.in: Regenerated.
8847
8848 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8849
8850         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8851         (Symbol_table::override_with_special): Likewise.
8852         (Symbol_table::add_from_object): Likewise.
8853
8854 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8855
8856         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8857         Don't set the data_offset twice.
8858
8859 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8860
8861         * testsuite/Makefile.in: Regenerate.
8862
8863 2009-12-03  Doug Kwan  <dougkwan@google.com>
8864
8865         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8866         (Target_arm::do_finalize_sections): Add parameter for symbol table
8867         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8868         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8869         parameter for symbol table pointer.
8870         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8871         an additional parameter for a pointer to symbol table.
8872         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8873         parameter for a symbol table pointer.
8874         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8875         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8876         Ditto.
8877         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8878         parameter for a symbol table pointer.
8879
8880 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8881
8882         * incremental.cc (Incremental_inputs_header)
8883         (Incremental_inputs_header_write, Incremental_inputs_entry)
8884         (Incremental_inputs_entry_write): Move ...
8885         * incremental.h (Incremental_inputs_header)
8886         (Incremental_inputs_header_write, Incremental_inputs_entry)
8887         (Incremental_inputs_entry_write): here.
8888
8889 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8890
8891         * incremental.cc (make_sized_incremental_binary): Set the target.
8892         Error if it is incompatible.
8893         * output.h (Output_file): Add filename method.
8894
8895 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8896
8897         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8898         from the get_* methods.
8899
8900 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8901
8902         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8903         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8904         Write 0 for the data_offset of scripts.
8905
8906 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8907
8908         * testsuite/Makefile.am: Add the incremental_test.sh test.
8909         * testsuite/incremental_test.sh: New.
8910         * testsuite/incremental_test_1.c: New.
8911         * testsuite/incremental_test_2.c: New.
8912
8913 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8914
8915         * incremental-dump.cc (main): Fix typos.
8916
8917 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8918
8919         PR gold/11025
8920         * incremental-dump.cc (main): Use llu to print 64 bit values.
8921
8922 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8923             H.J. Lu  <hongjiu.lu@intel.com>
8924
8925         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8926         $(LIBDL).
8927         (incremental_dump_LDADD): Likewise.
8928         * Makefile.in: Regenerated.
8929
8930 2009-11-25  Doug Kwan  <dougkwan@google.com>
8931
8932         Revert:
8933
8934         2009-11-25  Doug Kwan  <dougkwan@google.com>
8935
8936                 * arm.cc (Target_arm::Target_arm): Move method definition
8937                 outside of class definition.  Add code to handle
8938                 --target1-rel, --target1-abs and --target2= options.
8939                 (Target_arm::get_reloc_reloc_type): Change method to be
8940                 non-static and const.
8941                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8942                 New data member declaration.
8943                 (Target_arm::Scan::local, Target_arm::Scan::global,
8944                 Target_arm::Relocate::relocate,
8945                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8946                 Adjust call to Target_arm::get_real_reloc_type.
8947                 (Target_arm::get_real_reloc_type): Use command line options
8948                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8949                 * options.h (--target1-rel, --target1-abs, --target2): New
8950                 ARM-only options.
8951
8952 2009-11-25  Doug Kwan  <dougkwan@google.com>
8953
8954         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8955         class definition.  Add code to handle --target1-rel, --target1-abs
8956         and --target2= options.
8957         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8958         and const.
8959         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8960         member declaration.
8961         (Target_arm::Scan::local, Target_arm::Scan::global,
8962         Target_arm::Relocate::relocate,
8963         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8964         call to Target_arm::get_real_reloc_type.
8965         (Target_arm::get_real_reloc_type): Use command line options to
8966         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8967         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8968         options.
8969
8970 2009-11-25  Doug Kwan  <dougkwan@google.com>
8971
8972         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
8973         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
8974         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
8975         formatting.
8976         (Arm_relocate_functions::thm_call): Replace body with a call to
8977         Arm_relocate_functions::thumb_branch_common.
8978         (Arm_relocate_functions::thm_jump24,
8979         Arm_relocate_functions::thm_xpc22): New method definitions.
8980         (Arm_relocate_functions::thumb_branch_common): New method definition.
8981         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
8982         operator.
8983         (Target_arm::Relocate::relocate): Adjust call to thm_call.
8984         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
8985
8986 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8987
8988         * Makefile.am: Build incremental-dump
8989         * Makefile.in: Regenerate.
8990         * incremental-dump.cc: New.
8991         * incremental.cc (Incremental_inputs_header_data,
8992         Incremental_inputs_entry_data): Move to incremental.h
8993         * incremental.h: (Incremental_inputs_header_data,
8994         Incremental_inputs_entry_data): Move from incremental.cc
8995
8996 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
8997
8998         * incremental.cc (Incremental_inputs_header,
8999         Incremental_inputs_header_write, Incremental_inputs_entry,
9000         Incremental_inputs_entry_write): Add a typedef with the data type.
9001
9002 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9003
9004         * incremental.cc (Incremental_inputs_header,
9005         Incremental_inputs_header_write, Incremental_inputs_entry,
9006         Incremental_inputs_entry_write): Update comment about which
9007         type has the filed descriptions.
9008
9009 2009-11-15  Doug Kwan  <dougkwan@google.com>
9010
9011         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9012         (Arm_relocate_functions::arm_branch_common): Change method defintion
9013         in class definition to a method declaration and update list of formal
9014         parameters.
9015         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9016         Arm_relocation_functions::jump24): Adjust call to
9017         Arm_relocate_functions::arm_branch_common.  Update list of formal
9018         parameters.
9019         (Arm_relocate_functions::xpc25): New method definition.
9020         (Arm_relocate_functions::arm_branch_common): Move method defintion
9021         out from class definition.  Use stubs for mode-switching and extending
9022         branch ranges.
9023         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9024         specially.  Change code to enable use of stubs in ARM branches.
9025
9026 2009-11-10  Doug Kwan  <dougkwan@google.com>
9027
9028         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9029         in method declaration.
9030         (Target_arm::relocate_stub): New method declaration.
9031         (Target_arm::default_target): Change to return a pointer instead of
9032         a const reference.
9033         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9034         Target_arm::default_target.
9035         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9036         method definition.
9037         (Target_arm::relocate_section): Adjust view.
9038         (Target_arm::relocate_stub): New method definition.
9039
9040 2009-11-10  Doug Kwan  <dougkwan@google.com>
9041
9042         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9043         a format warning.
9044         * incremental.cc (open_incremental_binary): Initialized local
9045         variables to avoid warnings.
9046         * object.cc (make_elf_object): Ditto.
9047         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9048         a format warning.
9049
9050 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9051
9052         PR gold/10930
9053         * testsuite/plugin_test.c: Include "config.h".
9054
9055 2009-11-09  Doug Kwan  <dougkwan@google.com>
9056
9057         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9058         (arm_symbol_value): Remove.
9059         (Arm_relocate_functions::arm_branch_common,
9060         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9061         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9062         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9063         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9064         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9065         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9066         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9067         Arm_relocate_functions::thm_mobw_abs_nc,
9068         Arm_relocate_functions::thm_mov_abs,
9069         Arm_relocate_functions::movw_prel_nc,
9070         Arm_relocate_functions::thm_movt_abs,
9071         Arm_relocate_functions::movt_prel,
9072         Arm_relocate_functions::thm_movw_prel_nc,
9073         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9074         (Target_arm::Relocate::relocate): Only decompose address into two
9075         parts if relocation type uses the thumb-bit and pass the actual
9076         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9077         calls to methods in Arm_relocate_functions for this change.
9078
9079 2009-11-08  Ian Lance Taylor  <iant@google.com>
9080
9081         PR 10925
9082         * reloc.cc: Instantiate
9083         Sized_relobj::initialize_input_to_output_maps and
9084         Sized_relobj:free_input_to_output_maps.
9085
9086 2009-11-06  Ian Lance Taylor  <iant@google.com>
9087
9088         PR 10876
9089         * defstd.cc (in_segment): Set only_if_ref true for "end".
9090
9091 2009-11-06  Doug Kwan  <dougkwan@google.com>
9092
9093         * arm.cc (class Reloc_stub): Correct a comment.
9094         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9095         (Target_arm::scan_section_for_stubs): New method declaration.
9096         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9097         Change methods from private to protected.
9098         (Target_arm::do_may_relax): New method definition.
9099         (Target_arm::do_relax, Target_arm::group_sections,
9100         Target_arm::scan_reloc_for_stub,
9101         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9102         (Target_arm::arm_input_section_map_): New data member declaration.
9103         (Target_arm::scan_reloc_for_stub,
9104         Target_arm::scan_reloc_section_for_stubs,
9105         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9106         Target_arm::do_relax): New method definitions.
9107
9108 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9109
9110         * configure.ac: Check for (struct stat)::st_mtim
9111         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9112         * config.in: Regenerate.
9113         * configure: Regenerate.
9114
9115 2009-11-05  Ian Lance Taylor  <iant@google.com>
9116
9117         PR 10910
9118         * output.cc (Output_segment::add_output_section): Add missing
9119         return statement.
9120
9121 2009-11-04  Ian Lance Taylor  <iant@google.com>
9122
9123         PR 10880
9124         * object.h (class Object): Add is_needed and set_is_needed
9125         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9126         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9127         defined in a dynamic object and referenced by a regular object,
9128         set is_needed for the dynamic object.
9129         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9130         if the file is marked with as_needed and it is not needed.
9131
9132 2009-11-04  Ian Lance Taylor  <iant@google.com>
9133
9134         PR 10887
9135         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9136         tags if data is discarded by linker script.
9137         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9138         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9139         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9140         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9141
9142 2009-11-04  Ian Lance Taylor  <iant@google.com>
9143
9144         * layout.cc (Layout::get_output_section): Add is_interp and
9145         is_dynamic_linker_section parameters.  Change all callers.
9146         (Layout::choose_output_section): Likewise.
9147         (Layout::make_output_section): Likewise.
9148         (Layout::add_output_section_data): Add is_dynamic_linker_section
9149         parameter.  Change all callers.
9150         * layout.h (class Layout): Update declarations.
9151         * output.h (class Output_section): Add is_interp, set_is_interp,
9152         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9153         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9154         generate_code_fills_at_write_ to a bitfield.
9155         * output.cc (Output_section::Output_sections): Initialize new
9156         fields.
9157         (Output_segment::add_output_section): Add do_sort parameter.
9158         Change all callers.
9159
9160 2009-11-03  Ian Lance Taylor  <iant@google.com>
9161
9162         PR 10860
9163         * options.h (class General_options): Add --warn-common.
9164         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9165         merging two common symbols.
9166         (Symbol_table::should_override): Handle --warn-common when merging
9167         a common symbol with a defined symbol.  Use report_resolve_problem
9168         for multiple definitions.
9169         (Symbol_table::report_resolve_problem): New function.
9170         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9171
9172 2009-11-03  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9175         stub_factory_.
9176         (Target_arm::stub_factory): New method definition.
9177         (Target_arm::new_arm_input_section,
9178         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9179         Target_arm::reloc_uses_thumb_bit): New method declarations.
9180         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9181         New type definitions.
9182         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9183         member declarations.
9184         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9185         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9186         New method definitions.
9187
9188 2009-11-03  Ian Lance Taylor  <iant@google.com>
9189
9190         * options.h (class General_options): Add --warn_constructors.
9191
9192 2009-11-03  Ian Lance Taylor  <iant@google.com>
9193
9194         PR 10893
9195         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9196         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9197
9198 2009-11-03  Ian Lance Taylor  <iant@google.com>
9199
9200         PR 10895
9201         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9202         --msgid-bugs-address.
9203         (install-pdf): New target.
9204         (install-data_yes): Look up one directory to find mkinstalldirs.
9205
9206 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9207
9208         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9209         tree.
9210
9211 2009-10-30  Doug Kwan  <dougkwan@google.com>
9212
9213         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9214
9215 2009-10-30  Doug Kwan  <dougkwan@google.com>
9216
9217         * arm.cc (Stub_addend_reader): New struct template definition
9218         and partial specializations.
9219         (Stub_addend_reader::operator()): New method definition for a
9220         partially specialized template.
9221
9222 2009-10-30  Doug Kwan  <dougkwan@google.com>
9223
9224         * arm.cc (Arm_relobj::processor_specific_flags): New method
9225         definition.
9226         (Arm_relobj::do_read_symbols): New method declaration.
9227         (Arm_relobj::processor_specific_flags_): New data member declaration.
9228         (Arm_dynobj): New class definition.
9229         (Target_arm::do_finalize_sections): Add input_objects parameter.
9230         (Target_arm::do_adjust_elf_header): New method declaration.
9231         (Target_arm::are_eabi_versions_compatible,
9232         (Target_arm::merge_processor_specific_flags): New method declaration.
9233         (Target_arm::do_make_elf_object): New overloaded method definitions
9234         and declaration.
9235         (Arm_relobj::do_read_symbols): New method definition.
9236         (Arm_dynobj::do_read_symbols): Ditto.
9237         (Target_arm::do_finalize_sections): Add input_objects parameters.
9238         Merge processor-specific flags from all input objects.
9239         (Target_arm::are_eabi_versions_compatible,
9240         Target_arm::merge_processor_specific_flags,
9241         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9242         New method definitions.
9243         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9244         Input_objects pointer type parameter.
9245         * layout.cc (Layout::finalize): Pass input objects to target's.
9246         finalize_sections function.
9247         * output.cc (Output_file_header::do_sized_write): Set ELF file
9248         header's processor-specific flags.
9249         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9250         Input_objects pointer type parameter.
9251         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9252         * target.h (Input_objects): New forward class declaration.
9253         (Target::processor_specific_flags,
9254         Target::are_processor_specific_flags_sect): New method definitions.
9255         (Target::finalize_sections): Add input_objects parameter.
9256         (Target::Target): Initialize processor_specific_flags_ and
9257         are_processor_specific_flags_set_.
9258         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9259         parameter.
9260         (Target::set_processor_specific_flags): New method definition.
9261         (Target::processor_specific_flags_,
9262         Target::are_processor_specific_flags_set_): New data member
9263         declarations.
9264         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9265         Input_objects pointer type parameter.
9266
9267 2009-10-30  Doug Kwan  <dougkwan@google.com>
9268
9269         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9270
9271 2009-10-28  Ian Lance Taylor  <iant@google.com>
9272
9273         * object.h (class Relobj): Drop options parameter from
9274         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9275         do_scan_relocs, do_relocate.  Change all callers.
9276         (class Sized_relobj): Drop options parameters from
9277         do_gc_process_relocs, do_scan_relocs, do_relocate,
9278         do_relocate_sections, relocate_sections, emit_relocs_scan,
9279         emit_relocs_scan_reltype.  Change all callers.
9280         (struct Relocate_info): Remove options field and all references to
9281         it.
9282         * reloc.h (class Read_relocs): Remove options constructor
9283         parameter and options_ field.  Change all callers.
9284         (class Gc_process_relocs, class Scan_relocs): Likewise.
9285         (class Relocate_task): Likewise.
9286         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9287         all callers.
9288         (scan_relocatable_relocs): Likewise.
9289         * target.h (class Sized_target): Remove options parameter from
9290         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9291         all callers.
9292         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9293         callers.
9294         * arm.cc: Update functions to remove options parameters.
9295         * i386.cc: Likewise.
9296         * powerpc.cc: Likewise.
9297         * sparc.cc: Likewise.
9298         * x86_64.cc: Likewise.
9299         * testsuite/testfile.cc: Likewise.
9300
9301 2009-10-28  Doug Kwan  <dougkwan@google.com>
9302
9303         * arm.cc (Arm_relobj): New class definition.
9304         (Arm_relobj::scan_sections_for_stubs,
9305         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9306         New method definitions.
9307
9308 2009-10-28  Cary Coutant  <ccoutant@google.com>
9309
9310         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9311         (Plugin::cleanup_done_): New member.
9312         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9313         (Plugin_manager::cleanup_done_): Remove.
9314         (Plugin_manager::add_input_file): Edit error message.
9315         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9316         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9317
9318 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9319
9320         * fileread.cc: (File_read::View::~View): Use the new
9321         data_ownership_ filed.
9322         (File_read::~File_read): Dispose the new whole_file_view_.
9323         (File_read::open): Mmap the whole file if needed.
9324         (File_read::open): Use whole_file_view_ instead of contents_.
9325         (File_read::find_view): Use whole_file_view_ if applicable.
9326         (File_read::do_read): Use whole_file_view_ instead of contents_.
9327         (File_read::make_view): Use whole_file_view_ instead of contents_,
9328         update File_read::View::View call.
9329         (File_read::find_or_make_view): Update File_read::View::View
9330         call.
9331         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9332         remove contents_
9333         (File_read::View::Data_ownership): New enum.
9334         (File_read::View::View): Replace bool mapped_ with Data_ownership
9335         argument.
9336         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9337         (File_read::View::data_ownership_): New field.
9338         (File_read::contents_): Remove (replaced by whole_file_view_).
9339         (File_read::whole_file_view_): New field.
9340         * options.h (class General_options): Add --keep-files-mapped.
9341
9342 2009-10-27  Cary Coutant  <ccoutant@google.com>
9343
9344         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9345         * testsuite/Makefile.am (plugin_test_5): New test case.
9346         * testsuite/Makefile.in: Regenerate.
9347
9348 2009-10-25  Doug Kwan  <dougkwan@google.com>
9349
9350         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9351         from private to protected to allow access by child class.
9352         (Sized_relobj::do_relocate_sections): New method declaration.
9353         (Sized_relobj::relocate_sections): Virtualize.
9354         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9355         Sized_relobj::relocate_sections.  Instantiate template explicitly
9356         for different target sizes and endianity.
9357
9358 2009-10-24  Doug Kwan  <dougkwan@google.com>
9359
9360         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9361         (Arm_input_section::as_arm_input_section): New method.
9362         (Arm_output_section): New class definition.
9363         (Arm_output_section::create_stub_group,
9364         Arm_output_section::group_sections): New method definitions.
9365
9366 2009-10-22  Doug Kwan  <dougkwan@google.com>
9367
9368         * arm.cc (Arm_input_section): New class definition.
9369         (Arm_input_section::init, Arm_input_section:do_write,
9370         Arm_input_section::set_final_data_size,
9371         Arm_input_section::do_reset_address_and_file_offset): New method
9372         definitions.
9373
9374 2009-10-21  Doug Kwan  <dougkwan@google.com>
9375
9376         * arm.cc (Stub_table, Arm_input_section): New forward class
9377         declarations.
9378         (Stub_table): New class defintion.
9379         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9380         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9381         New method definition.
9382
9383 2009-10-21  Doug Kwan  <dougkwan@google.com>
9384
9385         * arm.cc: Update copyright comments.
9386         (Target_arm): New forward class template declaration.
9387         (Arm_address): New type.
9388         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9389         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9390         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9391         constants.
9392         (Insn_template): Same.
9393         (DEF_STUBS): New macro.
9394         (Stub_type): New enum type.
9395         (Stub_template): New class definition.
9396         (Stub): Same.
9397         (Reloc_stub): Same.
9398         (Stub_factory): Same.
9399         (Target_arm::Target_arm): Initialize may_use_blx_ and
9400         should_force_pic_veneer_.
9401         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9402         Target_arm::should_force_pic_veneer,
9403         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9404         Target_arm::using_thumb_only, Target_arm:;default_target): New
9405         method defintions.
9406         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9407         New data member declarations.
9408         (Insn_template::size, Insn_template::alignment): New method defintions.
9409         (Stub_template::Stub_template): New method definition.
9410         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9411         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9412         (Stub_factory::Stub_factory): New method definition.
9413         * gold.h (string_hash): New template.
9414         * output.h (Input_section_specifier::hash_value): Use
9415         gold::string_hash.
9416         (Input_section_specifier::string_hash): Remove.
9417         * stringpool.cc (Stringpool_template::string_hash): Use
9418         gold::string_hash.
9419
9420 2009-10-20  Doug Kwan  <dougkwan@google.com>
9421
9422         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9423         symbols of relaxed input sections.
9424         * output.h (Output_section::find_relaxed_input_section): Make
9425         method public.
9426
9427 2009-10-16  Doug Kwan  <dougkwan@google.com>
9428
9429         * dynobj.cc (Versions::Versions): Initialize version_script_.
9430         Only insert base version symbol definition for a shared object
9431         if version script defines any version versions.
9432         (Versions::define_base_version): New method definition.
9433         (Versions::add_def): Check that base version is not needed.
9434         (Versions::add_need): Define base version lazily.
9435         * dynobj.h (Versions::define_base_version): New method declaration.
9436         (Versions::needs_base_version_): New data member declaration.
9437         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9438         (check_DATA): Add no_version_test.stdout.
9439         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9440         New make rules.
9441         * testsuite/Makefile.in: Regenerate.
9442         * testsuite/no_version_test.c: New file.
9443         * testsuite/no_version_test.sh: Ditto.
9444
9445 2009-10-16  Doug Kwan  <dougkwan@google.com>
9446
9447         * expression.cc (class Segment_start_expression): New class definition.
9448         (Segment_start_expression::value): New method definition.
9449         (script_exp_function_segment_start): Return a new
9450         Segment_start_expression.
9451         * gold/script-c.h (script_saw_segment_start_expression): New function
9452         prototype.
9453         * script-sections.cc (Script_sections::Script_sections): Initialize
9454         SAW_SEGMENT_START_EXPRESSION_ to false.
9455         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9456         and -Tbbs options to specify section addresses if given in
9457         command line and no SEGMENT_START expression is seen in a script.
9458         * script-sections.h (Script_sections::saw_segment_start_expression,
9459         Script_sections::set_saw_segment_start_expression): New method
9460         definition.
9461         (Script_sections::saw_segment_start_expression_): New data member
9462         declaration.
9463         * script.cc (script_saw_segment_start_expression): New function.
9464         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9465         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9466         script_test_7.sh and script_test_8.sh.
9467         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9468         script_test_8.stdout.
9469         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9470         (script_test_6, script_test_6.stdout, script_test_7,
9471         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9472         * Makefile.in: Regenerate.
9473         * testsuite/script_test_6.sh: New file.
9474         * testsuite/script_test_6.t: Same.
9475         * testsuite/script_test_7.sh: Same.
9476         * testsuite/script_test_7.t: Same.
9477         * testsuite/script_test_8.sh: Same.
9478
9479 2009-10-16  Doug Kwan  <dougkwan@google.com>
9480
9481         * output.cc (Output_segment::set_section_list_address): Cast
9482         expressions to unsigned long long type to avoid format warnings.
9483
9484 2009-10-15  Ian Lance Taylor  <iant@google.com>
9485
9486         * script.cc (Script_options::add_symbol_assignment): Always add a
9487         dot assignment to script_sections_.
9488         * script-sections.cc (Script_sections::add_dot_assignment):
9489         Initialize if necessary.
9490
9491         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9492         program headers with no load segment if there is a linker script.
9493
9494         * layout.cc (Layout::set_segment_offsets): Align the file offset
9495         to the segment aligment for -N or -n with no load segment.
9496         * output.cc (Output_segment::add_output_section): Don't crash if
9497         the first section is a TLS section.
9498         (Output_segment::set_section_list_addresses): Print an error
9499         message if the address moves backward in a linker script.
9500         * script-sections.cc
9501         (Output_section_element_input::set_section_addresses): Don't
9502         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9503         (Orphan_output_section::set_section_addresses): Likewise.
9504
9505 2009-10-15  Doug Kwan  <dougkwan@google.com>
9506
9507         * layout.cc (Layout::finish_dynamic_section): Generate tags
9508         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9509         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9510         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9511
9512 2009-10-14  Ian Lance Taylor  <iant@google.com>
9513
9514         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9515         fields.
9516         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9517         data_shdr fields of relinfo.
9518         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9519         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9520         R_386_TLS_LDO_32, adjust based on section flags.
9521         (Target_i386::Relocate::fix_up_ldo): Remove.
9522
9523 2009-10-13  Ian Lance Taylor  <iant@google.com>
9524
9525         Add support for -pie.
9526         * options.h (class General_options): Add -pie and
9527         --pic-executable.
9528         (General_options::output_is_position_independent): Test -pie.
9529         (General_options::output_is_executable): Return true if not shared
9530         and not relocatable.
9531         (General_options::output_is_pie): Remove.
9532         * options.cc (General_options::finalize): Reject incompatible uses
9533         of -pie.
9534         * gold.cc (queue_middle_tasks): A -pie link is not static.
9535         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9536         * symtab.cc (Symbol::final_value_is_known): Return false if
9537         output_is_position_independent.
9538         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9539         output_is_position_independent.
9540         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9541         output_is_position_independent.
9542         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9543         output_is_position_independent.
9544         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9545         two_file_pie_test.
9546         (basic_pie_test.o, basic_pie_test): New targets.
9547         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9548         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9549         (two_file_pie_test): New target.
9550         * testsuite/Makefile.in: Rebuild.
9551         * README: Remove note saying that -pie is not supported.
9552
9553 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9554
9555         * options.h (class General_options): Add -init and -fini.
9556         * layout.cc (Layout::finish_dynamic_section): Emit
9557         given init and fini functions.
9558
9559 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9560
9561         * gc.h (gc_process_relocs): Check if icf is enabled using new
9562         function.
9563         * gold.cc (queue_initial_tasks): Likewise.
9564         (queue_middle_tasks): Likewise.
9565         * object.cc (do_layout): Likewise.
9566         * symtab.cc (is_section_folded): Likewise.
9567         * main.cc (main): Likewise.
9568         * reloc.cc (Read_relocs::run): Likewise.
9569         (Sized_relobj::do_scan_relocs): Likewise.
9570         * icf.cc (is_function_ctor_or_dtor): New function.
9571         (Icf::find_identical_sections): Check if function is ctor or dtor when
9572         safe icf is chosen.
9573         * options.h (General_options::icf): Change option to be an enum.
9574         (Icf_status): New enum.
9575         (icf_enabled): New method.
9576         (icf_safe_folding): New method.
9577         (set_icf_status): New method.
9578         (icf_status_): New variable.
9579         * (options.cc) (General_options::finalize): Set icf_status_.
9580         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9581         icf_test and icf_keep_unique_test to use the --icf enum flag.
9582         * testsuite/icf_safe_test.sh: New file.
9583         * testsuite/icf_safe_test.cc: New file.
9584
9585 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9586
9587         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9588         includes to gc.h and icf.h.
9589         * arm.cc: Include gc.h.
9590         * gold.cc: Likewise.
9591         * i386.cc: Likewise.
9592         * powerpc.cc: Likewise.
9593         * sparc.cc: Likewise.
9594         * x86_64.cc: Likewise.
9595         * gc.h: Include icf.h.
9596
9597 2009-10-11  Ian Lance Taylor  <iant@google.com>
9598
9599         * plugin.cc: Include "gold.h" before other header files.
9600
9601 2009-10-10  Chris Demetriou  <cgd@google.com>
9602
9603         * options.h (Input_file_argument::Input_file_type): New enum.
9604         (Input_file_argument::is_lib_): Replace with...
9605         (Input_file_argument::type_): New member.
9606         (Input_file_argument::Input_file_argument): Take Input_file_type
9607         'type' rather than boolean 'is_lib' as second argument.
9608         (Input_file_argument::is_lib): Use type_.
9609         (Input_file_argument::is_searched_file): New function.
9610         (Input_file_argument::may_need_search): Handle is_searched_file.
9611         * options.cc (General_options::parse_library): Support -l:filename.
9612         (General_options::parse_just_symbols): Update for Input_file_argument
9613         changes.
9614         (Command_line::process): Likewise.
9615         * archive.cc (Archive::get_file_and_offset): Likewise.
9616         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9617         * script.cc (read_script_file, script_add_file): Likewise.
9618         * fileread.cc (Input_file::Input_file): Likewise.
9619         (Input_file::will_search_for): Handle is_searched_file.
9620         (Input_file::open): Likewise.
9621         * readsyms.cc (Read_symbols::get_name): Likewise.
9622         * testsuite/Makefile.am (searched_file_test): New test.
9623         * testsuite/Makefile.in: Regenerate.
9624         * testsuite/searched_file_test.cc: New file.
9625         * testsuite/searched_file_test_lib.cc: New file.
9626
9627 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9628             Ian Lance Taylor  <iant@google.com>
9629
9630         * descriptor.cc: Include <cstdio> and "binary-io.h".
9631         (Descriptors::open): Open the files in binary mode always.
9632         * script.cc (Lex::get_token): Treat \r as whitespace.
9633
9634 2009-10-09  Ian Lance Taylor  <iant@google.com>
9635
9636         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9637
9638 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9639             Ian Lance Taylor  <iant@google.com>
9640
9641         * configure.ac: Check for readv function also.
9642         * fileread.cc (readv): Define if not HAVE_READV.
9643         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9644         does not exist.
9645         * config.in: Regenerate.
9646         * configure: Regenerate.
9647
9648 2009-10-09  Doug Kwan  <dougkwan@google.com>
9649
9650         * layout.cc (Layout::make_output_section): Call target hook to make
9651         ordinary output section.
9652         (Layout::finalize): Adjust parameter list of call the
9653         Target::may_relax().
9654         * layout.h (class Layout::section_list): New method.
9655         * merge.h (Output_merge_base::entsize): Change visibility to public.
9656         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9657         New methods.
9658         (Output_merge_string::do_is_string): New method.
9659         * object.cc (Sized_relobj::do_setup): renamed from
9660         Sized_relobj::set_up.
9661         * object.h (Sized_relobj::adjust_shndx,
9662         Sized_relobj::initializ_input_to_output_maps,
9663         Sized_relobj::free_input_to_output_maps): Change visibilities to
9664         protected.
9665         (Sized_relobj::setup): Virtualize.
9666         (Sized_relobj::do_setup): New method declaration.
9667         (Sized_relobj::invalidate_section_offset,
9668         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9669         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9670         * options.cc (parse_int): New function.
9671         * options.h (parse_int): New declaration.
9672         (DEFINE_int): New macro.
9673         (stub_group_size): New option.
9674         * output.cc (Output_section::Output_section): Initialize memebers
9675         merge_section_map_, merge_section_by_properties_map_,
9676         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9677         (Output_section::add_input_section): Handled deferred code-fill
9678         generation and remove an old comment.
9679         (Output_section::add_relaxed_input_section): New method definition.
9680         (Output_section::add_merge_input_section): Use merge section by
9681         properties map to speed to search.  Update merge section maps
9682         as appropriate.
9683         (Output_section::build_relaxation_map): New method definition.
9684         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9685         Same.
9686         (Output_section::relax_input_section): Renamed to
9687         Output_section::convert_input_sections_to_relaxed_sections and change
9688         interface to take a vector of pointers to relaxed sections.
9689         (Output_section::find_merge_section,
9690         Output_section::find_relaxed_input_section): New method definitions.
9691         (Output_section::is_input_address_mapped,
9692         Output_section::output_offset, Output_section::output_address):
9693         Use output section data maps to speed up searching.
9694         (Output_section::find_starting_output_address): Add comments.
9695         (Output_section::do_write,
9696         Output_section::write_to_postprocessing_buffer): Do code-fill
9697         generation as appropriate.
9698         (Output_section::get_input_sections): Invalidate relaxed input section
9699         map.
9700         (Output_section::restore_states): Adjust type of checkpoint .
9701         Invalidate relaxed input section map.
9702         * output.h (Output_merge_base): New class declaration.
9703         (Input_section_specifier): New class defintion.
9704         (class Output_relaxed_input_section) Change base class to
9705         Output_section_data_build.
9706         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9707         base class initializer.
9708         (Output_section::add_relaxed_input_section): New method declaration.
9709         (Output_section::Input_section): Change visibility to protected.
9710         (Output_section::Input_section::relobj,
9711         Output_section::Input_section::shndx): Handle relaxed input sections.
9712         Output_section::input_sections) Change visibility to protected.  Also
9713         define overload to return a non-const pointer.
9714         (Output_section::Merge_section_properties): New class defintion.
9715         (Output_section::Merge_section_by_properties_map,
9716         Output_section::Output_section_data_by_input_section_map,
9717         Output_section::Relaxation_map): New types.
9718         (Output_section::relax_input_section): Rename method to
9719         Output_section::convert_input_sections_to_relaxed_sections and change
9720         interface to take a vector of relaxed section pointers.
9721         (Output_section::find_merge_section,
9722         Output_section::find_relaxed_input_section,
9723         Output_section::build_relaxation_map,
9724         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9725         New method declarations.
9726         (Output_section::merge_section_map_
9727         Output_section::merge_section_by_properties_map_,
9728         Output_section::relaxed_input_section_map_,
9729         Output_section::is_relaxed_input_section_map_valid_,
9730         Output_section::generate_code_fills_at_write_): New data members.
9731         * script-sections.cc
9732         (Output_section_element_input::set_section_addresses): Call
9733         current_data_size and addralign methods of relaxed input sections.
9734         (Orphan_output_section::set_section_addresses): Call current_data_size
9735         and addralign methods of relaxed input sections.
9736         * symtab.cc (Symbol_table::compute_final_value): Extract template
9737         from the body of Symbol_table::sized_finalize_symbol.
9738         (Symbol_table::sized_finalized_symbol): Call
9739         Symbol_table::compute_final_value.
9740         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9741         (Symbol_table::compute_final_value): New templated method declaration.
9742         * target.cc (Target::do_make_output_section): New method defintion.
9743         * target.h (Target::make_output_section): New method declaration.
9744         (Target::relax): Add more parameters for input objects, symbol table
9745         and layout.  Adjust call to do_relax.
9746         (Target::do_make_output_section): New method declaration.
9747         (Target::do_relax): Add parameters for input objects, symbol table
9748         and layout.
9749
9750 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9751
9752         * pread.c: Include stdio.h.
9753
9754 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9755
9756         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9757         defined.
9758
9759 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9760
9761         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9762         Change read_shndx type to unsigned int.
9763         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9764         int.
9765         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9766         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9767         Change read_shndx type to unsigned int.
9768         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9769         int.
9770         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9771         * layout.cc (Layout::create_symtab_sections): Cast the result of
9772         local_symcount * symsize to off_t in the gold_assert.
9773
9774 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9775
9776         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9777         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9778         R_ARM_BASE_ABS.
9779         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9780         (Arm_relocate_functions::thm_abs5): New function.
9781         (Arm_relocate_functions::abs12): New function.
9782         (Arm_relocate_functions::abs16): New function.
9783         (Arm_relocate_functions::base_abs): New function.
9784         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9785         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9786         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9787         R_ARM_BASE_ABS.
9788         (Scan::global): Likewise.
9789         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9790         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9791         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9792         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9793         R_ARM_BASE_ABS.
9794
9795 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9796
9797         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9798         (Arm_relocate_functions::movt_prel): New function.
9799         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9800         (Arm_relocate_functions::thm_movt_prel): New function.
9801         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9802         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9803         (Scan::global, Relocate::relocate): Likewise.
9804         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9805
9806 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9807
9808         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9809         Incremental_checker.
9810         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9811         unsigned int.
9812         (class Incremental_inputs_header): New class.
9813         (Incremental_inputs_header_writer): Edit comment.
9814         (Incremental_inputs_entry): New class.
9815         (Incremental_inputs_entry_writer): Edit comment.
9816         (Sized_incremental_binary::do_find_incremental_inputs_section):
9817         Add *strtab_shndx parameter, fill it.
9818         (Sized_incremental_binary::do_check_inputs): New method.
9819         (Incremental_checker::can_incrementally_link_output_file): Use
9820         Sized_incremental_binary::check_inputs.
9821         (Incremental_inputs::report_command_line): Save command line in
9822         command_line_.
9823         * incremental.h:
9824         (Incremental_binary::find_incremental_inputs_section): New
9825         method.
9826         (Incremental_binary::do_find_incremental_inputs_section): Add
9827         strtab_shndx parameter.
9828         (Incremental_binary::do_check_inputs): New pure virtual method.
9829         (Sized_incremental_binary::do_check_inputs): Declare.
9830         (Incremental_checker::Incremental_checker): Add incremental_inputs
9831         parameter, use it to initialize incremental_inputs_.
9832         (Incremental_checker::incremental_inputs_): New field.
9833         (Incremental_checker::command_line): New method.
9834         (Incremental_checker::inputs): New method.
9835         (Incremental_checker::command_line_): New field.
9836
9837 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9838
9839         * incremental.cc: Include <cstdarg> and "target-select.h".
9840         (vexplain_no_incremental): New function.
9841         (explain_no_incremental): New function.
9842         (Incremental_binary::error): New method.
9843         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9844         method.
9845         (make_sized_incremental_binary): New function.
9846         (open_incremental_binary): New function.
9847         (can_incrementally_link_file): Add checks if output is ELF and has
9848         inputs section.
9849         * incremental.h: Include "elfcpp_file.h" and "output.h".
9850         (Incremental_binary): New class.
9851         (Sized_incremental_binary): New class.
9852         (open_incremental_binary): Declare.
9853         * object.cc (is_elf_object): Use
9854         elfcpp::Elf_recognizer::is_elf_file.
9855         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9856         * output.h (Output_file::filesize): New method.
9857
9858 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9859
9860         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9861         New function.
9862         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9863         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9864         function.
9865         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9866         function.
9867         (Arm_relocate_functions::movw_abs_nc): New function.
9868         (Arm_relocate_functions::movt_abs): New function.
9869         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9870         (Arm_relocate_functions::thm_movt_abs): New function.
9871         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9872         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9873         (Scan::global): Likewise.
9874         (Relocate::relocate): Likewise.
9875         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9876
9877 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9878
9879         * arm.cc (Arm_relocate_functions::got_prel) New function.
9880         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9881         (Relocate::relocate): Likewise.
9882         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9883
9884 2009-10-06  Ian Lance Taylor  <iant@google.com>
9885
9886         * options.h (class General_options): Define
9887         split_stack_adjust_size parameter.
9888         * object.h (class Object): Add uses_split_stack_ and
9889         has_no_split_stack_ fields.  Add uses_split_stack and
9890         has_no_split_stack accessor functions.  Declare
9891         handle_split_stack_section.
9892         (class Reloc_symbol_changes): Define.
9893         (class Sized_relobj): Define Function_offsets.  Declare
9894         split_stack_adjust, split_stack_adjust_reltype, and
9895         find_functions.
9896         * object.cc (Object::handle_split_stack_section): New function.
9897         (Sized_relobj::do_layout): Call handle_split_stack_section.
9898         * dynobj.cc (Sized_dynobj::do_layout): Call
9899         handle_split_stack_section.
9900         * reloc.cc (Sized_relobj::relocate_sections): Call
9901         split_stack_adjust for executable sections in split_stack
9902         objects.  Pass reloc_map to relocate_section.
9903         (Sized_relobj::split_stack_adjust): New function.
9904         (Sized_relobj::split_stack_adjust_reltype): New function.
9905         (Sized_relobj::find_functions): New function.
9906         * target-reloc.h: Include "object.h".
9907         (relocate_section): Add reloc_symbol_changes parameter.  Change
9908         all callers.
9909         * target.h (class Target): Add calls_non_split method.  Declare
9910         do_calls_non_split virtual method.  Declare match_view and
9911         set_view_to_nop.
9912         * target.cc: Include "elfcpp.h".
9913         (Target::do_calls_non_split): New function.
9914         (Target::match_view): New function.
9915         (Target::set_view_to_nop): New function.
9916         * gold.cc (queue_middle_tasks): Give an error if mixing
9917         split-stack and non-split-stack objects with -r.
9918         * i386.cc (Target_i386::relocate_section): Add
9919         reloc_symbol_changes parameter.
9920         (Target_i386::do_calls_non_split): New function.
9921         * x86_64.cc (Target_x86_64::relocate_section): Add
9922         reloc_symbol_changes parameter.
9923         (Target_x86_64::do_calls_non_split): New function.
9924         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9925         parameter.
9926         * powerpc.cc (Target_powerpc::relocate_section): Add
9927         reloc_symbol_changes parameter.
9928         * sparc.cc (Target_sparc::relocate_section): Add
9929         reloc_symbol_changes parameter.
9930         * configure.ac: Call AM_CONDITIONAL for the default target.
9931         * configure: Rebuild.
9932         * testsuite/Makefile.am (TEST_AS): New variable.
9933         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9934         (check_DATA): Add split_i386 and split_x86_64 files.
9935         (SPLIT_DEFSYMS): Define.
9936         (split_i386_[1234n].o): New targets.
9937         (split_i386_[124]): New targets.
9938         (split_i386_[1234r].stdout): New targets.
9939         (split_x86_64_[1234n].o): New targets.
9940         (split_x86_64_[124]): New targets.
9941         (split_x86_64_[1234r].stdout): New targets.
9942         (MOSTLYCLEANFILES): Add new executables.
9943         * testsuite/split_i386.sh: New file.
9944         * testsuite/split_x86_64.sh: New file.
9945         * testsuite/split_i386_1.s: New file.
9946         * testsuite/split_i386_2.s: New file.
9947         * testsuite/split_i386_3.s: New file.
9948         * testsuite/split_i386_4.s: New file.
9949         * testsuite/split_i386_n.s: New file.
9950         * testsuite/split_x86_64_1.s: New file.
9951         * testsuite/split_x86_64_2.s: New file.
9952         * testsuite/split_x86_64_3.s: New file.
9953         * testsuite/split_x86_64_4.s: New file.
9954         * testsuite/split_x86_64_n.s: New file.
9955         * testsuite/testfile.cc (Target_test): Update relocation_section
9956         function.
9957         * testsuite/Makefile.in: Rebuild.
9958
9959 2009-10-06  Ian Lance Taylor  <iant@google.com>
9960
9961         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9962         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9963         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9964         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9965         the address on ldo_addrs_.
9966         (Target_i386::Relocate::fix_up_ldo): New function.
9967
9968 2009-10-06   Rafael Espindola  <espindola@google.com>
9969
9970         * plugin.cc (add_input_library): New.
9971         (Plugin::load): Add add_input_library to tv.
9972         (Plugin_manager::add_input_file): Add the is_lib argument.
9973         (add_input_file): Update call to Plugin_manager::add_input_file.
9974         (add_input_library): New.
9975         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
9976
9977 2009-09-30  Doug Kwan  <dougkwan@google.com>
9978
9979         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
9980         symbol and call Symbol::may_need_copy_reloc to determine if
9981         a copy reloc is needed.
9982         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
9983         nocopyreloc is given in command line.
9984         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
9985         given in command line.
9986         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
9987         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
9988         of the removed Target_i386::may_need_copy_reloc.
9989         * options.h (copyreloc): New option with default value false.
9990         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9991         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
9992         instead of the removed Target_powerpc::may_need_copy_reloc.
9993         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
9994         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
9995         instead of the removed Target_sparc::may_need_copy_reloc.
9996         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
9997         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
9998         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
9999         instead of the removed Target_x86_64::may_need_copy_reloc.
10000
10001 2009-09-30  Ian Lance Taylor  <iant@google.com>
10002
10003         * object.h (class Object): Remove target_ field, and target,
10004         sized_target, and set_target methods.
10005         (Object::sized_target): Remove.
10006         (class Sized_relobj): Update declarations.  Remove sized_target.
10007         * object.cc (Sized_relobj::setup): Remove target parameter.
10008         Change all callers.
10009         (Input_objects::add_object): Don't do anything with the target.
10010         (make_elf_sized_object): Add punconfigured parameter.  Change all
10011         callers.  Set or test parameter target.
10012         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10013         Change all callers.
10014         * parameters.cc (Parameters::set_target): Change parameter type to
10015         be non-const.
10016         (Parameters::default_target): Remove.
10017         (set_parameters_target): Change parameter type to be non-const.
10018         (parameters_force_valid_target): New function.
10019         (parameters_clear_target): New function.
10020         * parameters.h (class Parameters): Update declarations.  Remove
10021         default_target method.  Add sized_target and clear_target
10022         methods.  Change target_ to be non-const.
10023         (set_parameters_target): Update declaration.
10024         (parameters_force_valid_target): Declare.
10025         (parameters_clear_target): Declare.
10026         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10027         as NULL if we aren't searching.
10028         (Add_symbols::run): Don't check for compatible target.
10029         * fileread.cc (Input_file::open_binary): Call
10030         parameters_force_valid_target.
10031         * gold.cc (queue_middle_tasks): Likewise.
10032         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10033         set_target on object.
10034         * dynobj.h (class Sized_dynobj): Update declarations.
10035         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10036         make_elf_object returns NULL.
10037         (Archive::include_member): Don't check whether object target is
10038         compatible.
10039         * output.cc (Output_section::add_input_section): Get target from
10040         parameters.
10041         (Output_section::relax_input_section): Likewise.
10042         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10043         parameters.
10044         (Sized_relobj::do_scan_relocs): Likewise.
10045         (Sized_relobj::relocate_sections): Likewise.
10046         * resolve.cc (Symbol_table::resolve): Likewise.
10047         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10048         parameter.  Change all callers.
10049         (Symbol_table::add_from_object): Get target from parameters.
10050         (Symbol_table::add_from_relobj): Don't check object target.
10051         (Symbol_table::add_from_dynobj): Likewise.
10052         (Symbol_table::define_special_symbol): Get target from
10053         parameters.
10054         * symtab.h (class Symbol_table): Update declaration.
10055         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10056         parameter.  Change all callers.  Clear parameter target.
10057         (Binary_test): Test target here.
10058         * testsuite/object_unittest.cc (gold_testsuite): Remove
10059         target_test_pointer parameter.  Change all callers.
10060         (Object_test): Test target here.
10061
10062 2009-09-26  Ian Lance Taylor  <iant@google.com>
10063
10064         * testsuite/initpri1.c: Don't try to use constructor priorities if
10065         compiling with gcc before 4.3.
10066
10067 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10068
10069         * testsuite/retain_symbols_file_test.sh (check_present): Change
10070         output file name to retain_symbols_file_test.stdout.
10071         (check_absent): Likewise.
10072
10073 2009-09-18  Craig Silverstein  <csilvers@google.com>
10074
10075         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10076         * options.cc: Include <cerrno> and <fstream>.
10077         (General_options::finalize): Parse -retain-symbols-file tag.
10078         * options.h: New flag.
10079         (General_options): New method should_retain_symbol, new
10080         variable symbols_to_retain.
10081         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10082         should_retain_symbol map.
10083         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10084         * testsuite/Makefile.in: Regenerate.
10085         * testsuite/retain_symbols_file_test.sh: New file.
10086
10087 2009-09-18  Nick Clifton  <nickc@redhat.com>
10088
10089         * po/es.po: Updated Spanish translation.
10090
10091 2009-09-17  Doug Kwan  <dougkwan@google.com>
10092
10093         * debug.h (DEBUG_RELAXATION): New constant.
10094         (DEBUG_ALL): Add DEBUG_RELAXATION.
10095         (debug_string_to_enum): Add relaxation debug option.
10096         * layout.cc
10097         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10098         Layout::Relaxation_debug_check::read_sections,
10099         Layout::Relaxation_debug_check::read_sections): New method definitions.
10100         (Layout::Layout): Initialize data members
10101         record_output_section_data_from_scrips_,
10102         script_output_section_data_list_ and relaxation_debug_check_.
10103         (Layout::save_segments, Layout::restore_segments,
10104         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10105         Layout::relaxation_loop_body): New method definitions.
10106         (Layout::finalize): Support relaxation.  Move section layout code to
10107         Layout::relaxation_loop_body.
10108         (Layout::set_asection_address_from_script): Move code for orphan
10109         section placement out.
10110         (Layout::place_orphan_sections_in_script): New method definition.
10111         * layout.h (Output_segment_headers, Output_file_header):
10112         New forward class declarations.
10113         (Layout::~Layout): Define.
10114         (Layout::new_output_section_data_from_script): New method definition.
10115         (Layout::place_orphan_sections_in_script): New method declaration.
10116         (Layout::Segment_states): New type declaration.
10117         (Layout::save_segments, Layout::restore_segments,
10118         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10119         Layout::relaxation_loop_body): New method declarations.
10120         (Layout::Output_section_data_list): New type declaration.
10121         (Layout::Relaxation_debug_check): New class definition.
10122         (Layout::record_output_section_data_from_script_,
10123         Layout::script_output_section_data_list_, Layout::segment_states_,
10124         Layout::relaxation_debug_check_): New data members.
10125         * output.cc: (Output_section_headers::do_size): New method definition.
10126         (Output_section_headers::Output_section_headers): Move size
10127         computation to Output_section_headers::do_size.
10128         (Output_segment_headers::do_size): New method definition.
10129         (Output_file_header::Output_file_header): Move size computation to
10130         Output_file_header::do_size and call it.
10131         (Output_file_header::do_size): New method definition.
10132         (Output_data_group::Output_data_group): Adjust call to
10133         Output_section_data.
10134         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10135         (Output_symtab_xindex::do_write): Add array bound check.
10136         (Output_section::Input_section::print_to_mapfile): Handle
10137         RELAXED_INPUT_SECTION_CODE.
10138         (Output_section::Output_section): Initialize data member checkpoint_.
10139         (Output_section::~Output_section): Delete checkpoint object pointed
10140         by checkpoint_.
10141         (Output_section::add_input_section): Always add an Input_section if
10142         relaxing.
10143         (Output_section::add_merge_input_section): Add assert.
10144         (Output_section::relax_input_section): New method definition.
10145         (Output_section::set_final_data_size): Set load address to zero for
10146         an unallocated section.
10147         (Output_section::do_address_and_file_offset_have_reset_values):
10148         New method definition.
10149         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10150         Handle relaxed input section.
10151         (Output_section::sort_attached_input_sections): Checkpoint input
10152         section list lazily.
10153         (Output_section::get_input_sections): Change type of input_sections to
10154         list of Simple_input_section pointers.  Checkpoint input section list
10155         lazily.  Also handle relaxed input sections.
10156         (Output_section::add_input_section_for_script): Take a reference to
10157         a Simple_input_section object instead of Relobj pointer and section
10158         index as parameter.  Handle relaxed input sections.
10159         (Output_section::save_states, Output_section::restore_states): New
10160         method definitions.
10161         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10162         (Output_data::is_data_size_fixed): New method definition.
10163         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10164         if it is fixed.
10165         (Output_data::address_and_file_offset_have_reset_values): New method
10166         definition.
10167         (Output_data::do_address_and_file_offset_have_reset_values): New method
10168         definition.
10169         (Output_data::set_data_size): Check that data size is not fixed.
10170         (Output_data::fix_data_size): New method definition.
10171         (Output_data::is_data_size_fixed_): New data member.
10172         (Output_section_headers::set_final_data_size): New method definition.
10173         (Output_section_headers::do_size): New method declaration.
10174         (Output_segment_headers::set_final_data_size): New method definition.
10175         (Output_segment_headers::do_size): New method declaration.
10176         (Output_file_header::set_final_data_size)::New method definition.
10177         (Output_file_header::do_size)::New method declaration.
10178         (Output_section_data::Output_section_data): Add new parameter
10179         is_data_size_fixed and use it to fix data size.
10180         (Output_data_const::Output_data_const): Adjust call to base class
10181         constructor and fix data size.
10182         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10183         base class constructor and fix data size.
10184         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10185         base class constructor and fix data size.
10186         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10187         class constructor and fix data size.
10188         (Output_data_group::set_final_data_size): New method definition.
10189         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10190         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10191         class constructor and fix data size.
10192         (Output_relaxed_input_section): New class definition.
10193         (Output_section::Simple_input_section): New class definition.
10194         (Output_section::get_input_sections): Adjust parameter list.
10195         (Output_section::add_input_section_for_script): Same.
10196         (Output_section::save_states, Output_section::restore_states,
10197         Output_section::do_address_and_file_offset_have_reset_values,
10198         (Output_section::Input_section::Input_section): Handle
10199         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10200         Output_relaxed_input_section.
10201         (Output_section::Input_section::is_input_section,
10202         Output_section::Input_section::set_output_section): Handle relaxed
10203         input section.
10204         (Output_section::Input_section::is_relaxed_input_section,
10205         Output_section::Input_section::output_section_data,
10206         Output_section::Input_section::relaxed_input_section): New method
10207         definitions.
10208         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10209         value.
10210         (Output_section::Input_section::u1_): Update comments.
10211         (Output_section::Input_section::u2_): Add new union member poris.
10212         (Output_section::Checkpoint_output_section): New classs definition.
10213         (Output_section::relax_input_section): New method declaration.
10214         (Output_section::checkpoint_): New data member.
10215         (Output_segment): Update comments.
10216         (Output_segment::Output_segment): Un-privatize copy constructor.
10217         (Output_segment::operator=): Un-privatize.
10218         * script-sections.cc (Output_section_element::Input_section_list):
10219         Change element type to Output_section::Simple_input_section.
10220         (Output_section_element_dot_assignment::set_section_addresses):
10221         Register output section data for relaxation clean up.
10222         (Output_data_exression::Output_data_expression): Adjust call to base
10223         constructor to fix data size.
10224         (Output_section_element_data::set_section_addresses): Register
10225         Output_data_expression object for relaxation clean up.
10226         (struct Input_section_info): Replace Relobj pointer and section index
10227         pair with Output_section::Simple_input_section and Convert struct to a
10228         class.
10229         (Input_section_sorter::operator()): Adjust access to
10230         Input_section_info data member to use accessors.
10231         (Output_section_element_input::set_section_addresses): Use layout
10232         parameter.  Adjust code to use Output_section::Simple_input_section
10233         and Input_secction_info classes.  Register filler for relaxation
10234         clean up.
10235         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10236         and section index pair with Output_section::Simple_input_section
10237         class.  Adjust code accordingly.
10238         (Phdrs_element::release_segment): New method definition.
10239         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10240         segment list.
10241         (Script_sections::release_segments): New method definition.
10242         * gold/script-sections.h (Script_sections::release_segments): New
10243         method declaration.
10244         * gold/target.h (Target::may_relax, Target::relax,
10245         Target::do_may_relax, Target::do_relax): New method definitions.
10246
10247 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10248
10249         * arm.cc (has_signed_unsigned_overflow): New function.
10250         (Arm_relocate_functions::abs8): New function.
10251         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10252         (Target_arm::Scan::global): Likewise.
10253         (Target_arm::relocate::relocate): Likewise.
10254         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10255         Likewise.
10256
10257 2009-09-16  Cary Coutant  <ccoutant@google.com>
10258
10259         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10260         * testsuite/Makefile.in: Regenerate.
10261
10262 2009-09-11  Nick Clifton  <nickc@redhat.com>
10263
10264         * po/gold.pot: Updated by the Translation project.
10265
10266 2009-09-08  Cary Coutant  <ccoutant@google.com>
10267
10268         * output.cc (Output_file::open): Add execute permission to empty file.
10269         * testsuite/Makefile.am (permission_test): New test.
10270         * testsuite/Makefile.in: Regenerate.
10271
10272 2009-09-02  Ian Lance Taylor  <iant@google.com>
10273
10274         * output.cc (Output_file::resize): Call map_no_anonymous rather
10275         than map.
10276
10277 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10278
10279         * gold.cc: Include "incremental.h".
10280         (queue_initial_tasks): Call Incremental_checker methods.
10281         * incremental.cc: Include "output.h".
10282         (Incremental_checker::can_incrementally_link_output_file): New
10283         method.
10284         * incremental.h (Incremental_checker): New class.
10285
10286         * output.cc (Output_file::open_for_modification): New method.
10287         (Output_file::map_anonymous): Changed return type to bool.  Record
10288         map in base_ field.
10289         (Output_file::map_no_anonymous): New method, broken out of map.
10290         (Output_file::map): Use map_no_anonymous and map_anonymous.
10291         * output.h (class Output_file): Update declarations.
10292
10293 2009-08-24  Cary Coutant  <ccoutant@google.com>
10294
10295         * options.h (Command_line::Pre_options): New class.
10296         (Command_line::pre_options): New member.
10297         * options.cc (gold::options::ready_to_register): New variable.
10298         (One_option::register_option): Do nothing if not registering options.
10299         Assert if same short option registered twice.
10300         (General_options::General_options): Turn off option registration when
10301         done constructing.
10302         (Command_line::Pre_options::Pre_options): New constructor.
10303
10304 2009-08-24  Cary Coutant  <ccoutant@google.com>
10305
10306         * options.h (General_options::no_keep_memory): Remove incorrect
10307         short option.
10308
10309 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10310
10311         * Makefile.am (am__skiplex, am__skipyacc): New.
10312         * Makefile.in: Regenerate.
10313
10314 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10315
10316         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10317         (INCLUDES): ... this.
10318         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10319         (AM_CPPFLAGS): Renamed from ...
10320         (INCLUDE): ... this.
10321         * Makefile.in, testsuite/Makefile.in: Regenerate.
10322
10323         * Makefile.in: Regenerate.
10324         * aclocal.m4: Likewise.
10325         * config.in: Likewise.
10326         * configure: Likewise.
10327         * testsuite/Makefile.in: Likewise.
10328
10329         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10330         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10331         * Makefile.in: Regenerate.
10332         * testsuite/Makefile.in: Regenerate.
10333
10334 2009-08-19  Cary Coutant  <ccoutant@google.com>
10335
10336         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10337         symbols in shared libraries overridden by hidden or internal symbols
10338         in the main program.
10339
10340 2009-08-19  Chris Demetriou  <cgd@google.com>
10341
10342         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10343         checking source file names in error messages.
10344
10345 2009-08-18  Doug Kwan  <dougkwan@google.com>
10346
10347         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10348         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10349         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10350         an elfcpp::Ehdr as parameter.
10351         * object.cc (Object::set_target): Remove the version that looks up
10352         a target and sets it.
10353         (Sized_relobj::setup): Take a Target object instead of
10354         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10355         (make_elf_sized_object): Find target and ask target to
10356         make an ELF object.
10357         * object.h: (Object::set_target): Remove the version that looks up
10358         a target and sets it.
10359         (Sized_relobj::setup): Take a Target object instead of
10360         an elfcpp:Ehdr as parameter.
10361         * target.cc: Include dynobj.h.
10362         (Target::do_make_elf_object_implementation): New.
10363         (Target::do_make_elf_object): New.
10364         * target.h (Target::make_elf_object): New template declaration.
10365         (Target::do_make_elf_object): New method declarations.
10366         (Target::do_make_elf_object_implementation): New template declaration.
10367
10368 2009-08-14  Ian Lance Taylor  <iant@google.com>
10369
10370         * gold.h (FUNCTION_NAME): Define.
10371         (gold_unreachable): Use FUNCTION_NAME.
10372
10373 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10374
10375         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10376         symbol in the --keep-unique list is not found.
10377
10378 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10379
10380         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10381         been maked as --keep-unique.
10382         (Icf::unfold_section): New function.
10383         * icf.h (Icf::unfold_section): New function.
10384         * options.h (General_options::keep_unique): New option.
10385         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10386         * testsuite/Makefile.in: Regenerate.
10387         * testsuite/icf_keep_unique_test.sh: New file.
10388         * testsuite/icf_keep_unique_test.cc: New file.
10389
10390 2009-08-12  Cary Coutant  <ccoutant@google.com>
10391
10392         PR 10471
10393         * resolve.cc (Symbol_table::resolve): Check for references from
10394         dynamic objects to hidden and internal symbols.
10395         * testsuite/Makefile.am (hidden_test.sh): New test.
10396         * testsuite/Makefile.in: Regenerate.
10397         * testsuite/hidden_test.sh: New script.
10398         * testsuite/hidden_test_1.c: New test source.
10399         * testsuite/hidden_test_main.c: New test source.
10400
10401 2009-08-11  Doug Kwan  <dougkwan@google.com>
10402
10403         * arm.cc: Update comments.
10404         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10405         segment to locate the .ARM.exidx section if present.
10406
10407 2009-08-09  Doug Kwan  <dougkwan@google.com>
10408
10409         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10410         patch.
10411
10412 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10413         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10414         compiler warnings.
10415
10416 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10417
10418         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10419         valid tls_segment only for non-debug-section relocations.
10420         * testsuite/Makefile.am: Add gc_tls_test.
10421         * testsuite/Makefile.in: Regenerate.
10422         * testsuite/gc_tls_test.cc: New file.
10423         * testsuite/gc_tls_test.sh: New file.
10424
10425 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10426
10427         * icf.cc: New file.
10428         * icf.h: New file.
10429         * Makefile.am (CCFILES): Add icf.cc.
10430         (HFILES): Add icf.h
10431         * Makefile.in: Regenerate.
10432         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10433         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10434         section, symbol and addend information for the relocs.
10435         * gold.cc (queue_middle_tasks): Call identical code folding.
10436         * gold.h: Add defines for multimap.
10437         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10438         to the call of finalize_local_symbols.
10439         * main.cc (main): Create object of class Icf.
10440         * object.cc (Sized_relobj::do_layout): Allow this function to be
10441         called twice during icf.
10442         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10443         to sections marked as identical by icf.
10444         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10445         when available.
10446         (Sized_relobj::do_section_entsize): New function.
10447         * object.h (Object::section_entsize): New function.
10448         (Object::do_section_entsize): New pure virtual function.
10449         (Relobj::finalize_local_symbols): Add new parameter.
10450         (Relobj::do_section_entsize): New function.
10451         * options.h (General_options::icf): New option.
10452         (General_options::icf_iterations): New option.
10453         (General_options::print_icf_sections): New option.
10454         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10455         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10456         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10457         icf.
10458         * symtab.cc (Symbol_table::is_section_folded): New function.
10459         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10460         to sections marked as identical by icf.
10461         * symtab.h (Symbol_table::set_icf): New function.
10462         (Symbol_table::icf): New function.
10463         (Symbol_table::is_section_folded): New function.
10464         (Symbol_table::icf_): New data member.
10465         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10466         * testsuite/Makefile.am: Add commands to build icf_test.
10467         * testsuite/Makefile.in: Regenerate.
10468         * testsuite/icf_test.sh: New file.
10469         * testsuite/icf_test.cc: New file.
10470
10471 2009-07-24  Chris Demetriou  <cgd@google.com>
10472
10473         * layout.cc (is_compressible_debug_section): Fix incorrect
10474         comment about compressed section names.
10475
10476 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10477
10478         PR 10419
10479         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10480
10481 2009-07-16  Ian Lance Taylor  <iant@google.com>
10482
10483         PR 10400
10484         * layout.h: #include <map>.
10485         (class Kept_section): Change from struct to class.  Add accessors
10486         and setters.  Add section size to Comdat_group mapping.  Change
10487         Comdat_group to std::map.  Add is_comdat_ field.  Add
10488         linkonce_size field in union.
10489         (class Layout): Update declaration of find_or_add_kept_section.
10490         Don't declare find_kept_object.
10491         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10492         parameter.  Add object, shndx, is_comdat, and is_group_name
10493         parameters.  Change all callers.  Adjust for new Kept_section.
10494         (Layout::find_kept_object): Remove.
10495         * object.cc (Sized_relobj::include_section_group): Update use of
10496         Kept_section.  Rename secnum to shndx.  Only record
10497         Kept_comdat_section if sections are the same size.
10498         (Sized_relobj::include_linkonce_section): Update use of
10499         Kept_section.  Only record Kept_comdat_section if sections are the
10500         same size.  Set size of linkonce section.
10501         (Sized_relobj::map_to_kept_section): Update call to
10502         get_kept_comdat_section.
10503         * object.h (class Sized_relobj): Rename fields in
10504         Kept_comdat_section to drop trailing underscores; change object
10505         field to Relobj*.  Change Kept_comdat_section_table to store
10506         struct rather than pointer.
10507         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10508         Add kept_object and kept_shndx parameters.  Change all callers.
10509         (Sized_relobj::get_kept_comdat_section): Change return type to
10510         bool.  Add kept_object and kept_shndx parameters.  Change all
10511         callers.
10512         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10513         Layout::find_or_add_kept_section.
10514
10515 2009-07-09  Ian Lance Taylor  <iant@google.com>
10516
10517         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10518         Reserve space in the hash table.
10519
10520 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10521
10522         * fileread.cc (File_read::get_mtime): New method.
10523         * fileread.h (Timespec): New structure.
10524         (File_read::get_mtime): New method.
10525         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10526         Renamed from timestamp_nsec.
10527         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10528         Elf_Xword.
10529         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10530         timestamp_nsec.
10531         (Incremental_inputs::report_archive): Save mtime; style fix.
10532         (Incremental_inputs::report_obejct): Save mtime; style fix.
10533         (Incremental_inputs::report_script): Save mtime; style fix.
10534         (Incremental_inputs::finalize_inputs): Style fix.
10535         (Incremental_inputs::finalize): Style fix.
10536         (Incremental_inputs::create_input_section_data): Store inputs
10537         mtime.
10538         * incremental.h (Incremental_inputs::report_script): Add mtime
10539         argument.
10540         (Incremental_inputs::Input_info::Input_info): Intialize only one
10541         union member.
10542         (Incremental_inputs::Input_info::archive): Move to nameless
10543         union.
10544         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10545         (Incremental_inputs::Input_info::script): Move to nameless union.
10546         (Incremental_inputs::mtime): New field.
10547         * script.cc (read_input_script): Pass file mtime to
10548         Incremental_input.
10549         * script.h (Script_info::inputs): Style fix.
10550
10551 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10552
10553         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10554         instead of 32.
10555
10556 2009-06-24  Ian Lance Taylor  <iant@google.com>
10557
10558         PR 10156
10559         * layout.cc (Layout::choose_output_section): If we find an
10560         existing section, update the flags.
10561         (Layout::create_notes): New function, broken out of
10562         Layout::finalize.
10563         (Layout::finalize): Don't create note sections.
10564         (Layout::create_note): Don't crash if linker script discards
10565         section.
10566         (Layout::create_gold_note): Likewise.
10567         (Layout::create_build_id): Likewise.  Don't set
10568         after_input_sections on the section.
10569         (Layout::create_executable_stack_info): Remove target parameter.
10570         Change caller.
10571         * layout.h (class Layout): Declare create_notes.  Update
10572         declaration of create_executable_stack_info.
10573         * gold.cc (queue_middle_tasks): Call create_notes.
10574         * output.cc (Output_section::update_flags_for_input_section): Move
10575         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10576         invalid.
10577         * output.h (Output_data::mark_address_invalid): New function.
10578         (class Output_section): Only declare, not define,
10579         update_flags_for_input_section.  Remove set_flags.
10580
10581 2009-06-24  Ian Lance Taylor  <iant@google.com>
10582
10583         * script-sections.cc (Output_section_definition::
10584         set_section_addresses): Rename shadowing local load_address to
10585         laddr.
10586
10587 2009-06-24  Ian Lance Taylor  <iant@google.com>
10588
10589         PR 10244
10590         * reloc.cc (relocate_sections): Skip empty relocation sections.
10591
10592 2009-06-23  Ian Lance Taylor  <iant@google.com>
10593
10594         PR 10156
10595         * layout.cc (Layout::create_note): Use choose_output_section
10596         rather than make_output_section.
10597
10598 2009-06-23  Ian Lance Taylor  <iant@google.com>
10599
10600         PR 10237
10601         * options.cc (General_options::parse_V): Set printed_version_.
10602         (General_options::General_options): Initialize printed_version_.
10603         * options.h (class General_options): Add printed_version_ field.
10604         * gold.cc (queue_initial_tasks): If there are no input files,
10605         don't give a fatal error if we printed the version information.
10606         (queue_middle_tasks): If using -r with a shared object, give a
10607         fatal error rather than an ordinary error.
10608
10609 2009-06-23  Ian Lance Taylor  <iant@google.com>
10610
10611         PR 10219
10612         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10613         (Layout::make_output_section): Set have_stabstr_section_ if we see
10614         a .stab*str section.
10615         (Layout::finalize): Call link_stabs_sections.
10616         (Layout::link_stabs_sections): New file.
10617         * layout.h (class Layout): Add have_stabstr_section_ field.
10618         Declare link_stabs_sections.
10619
10620 2009-06-23  Doug Kwan  <dougkwan@google.com>
10621
10622         * Makefile.am (libgold_a_LIBADD): New.
10623         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10624         * Makefile.in: Regenerate.
10625         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10626         * configure: Regenerate.
10627         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10628         * fileread.cc: Include sys/state.h
10629         * gold.h: Declare memmem and strndup if found missing.
10630         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10631
10632 2009-06-23  Ian Lance Taylor  <iant@google.com>
10633
10634         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10635         * configure: Rebuild.
10636
10637 2009-06-23  Ian Lance Taylor  <iant@google.com>
10638
10639         PR 10147
10640         * object.cc (Object::section_contents): Don't try to get a view if
10641         the section has length zero.
10642         (Object::handle_gnu_warning_section): If the section is empty, use
10643         the name of the section as the warning.
10644
10645 2009-06-23  Ian Lance Taylor  <iant@google.com>
10646
10647         PR 10133
10648         * stringpool.h (class Stringpool_template): Add optimize_ field.
10649         (Stringpool_template::set_optimize): New function.
10650         * stringpool.cc (Stringpool_template::Stringpool_template):
10651         Initialize optimize_ field.
10652         (Stringpool_template::set_string_offsets): Test local optimize
10653         fild rather than parameter.
10654         * layout.cc (Layout::Layout): Call set_optimize on the section
10655         name stringpool.
10656
10657 2009-06-22  Ian Lance Taylor  <iant@google.com>
10658
10659         PR 10030
10660         * yyscript.y: Parse TARGET.
10661         * script.cc (script_set_target): New function.
10662         * script-c.h (script_set_target): Declare.
10663         * options.cc (General_options::string_to_object_format): Rename
10664         from string_to_object_format in anonymous namespace.  Change
10665         callers.
10666         * options.h (class General_options): Declare
10667         string_to_object_format.
10668
10669 2009-06-22  Ian Lance Taylor  <iant@google.com>
10670
10671         * script-sections.cc (Script_sections::create_segments): Don't put
10672         program headers in a PT_LOAD segment if -n or -N.
10673
10674 2009-06-22  Ian Lance Taylor  <iant@google.com>
10675
10676         PR 10141
10677         * options.h (class General_options): Add -z lazy and -z now.  Sort
10678         -z options into alphabetical order.
10679         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10680
10681 2009-06-21  Ian Lance Taylor  <iant@google.com>
10682
10683         * layout.cc (Layout::make_output_section): Call
10684         Target::new_output_section.
10685         (Layout::attach_allocated_section_to_segment): Put large section
10686         sections in a separate load segment with the large segment flag
10687         set.
10688         (Layout::segment_precedes): Sort large data segments after other
10689         load segments.
10690         (align_file_offset): New static function.
10691         (Layout::set_segment_offsets): Use align_file_offset.
10692         * output.h (class Output_section): Add is_small_section_ and
10693         is_large_section_ fields.
10694         (Output_section::is_small_section): New function.
10695         (Output_section::set_is_small_section):  New function.
10696         (Output_section::is_large_section): New function.
10697         (Output_section::set_is_large_section): New function.
10698         (Output_section::is_large_data_section): New function.
10699         (class Output_segment): Add is_large_data_segment_ field.
10700         (Output_segment::is_large_data_segment): New function.
10701         (Output_segment::set_is_large_data_segment): New function.
10702         * output.cc (Output_section::Output_section): Initialize new
10703         fields.
10704         (Output_segment::Output_segment): Likewise.
10705         (Output_segment::add_output_section): Add assertion that large
10706         data sections always go in large data segments.  Force small data
10707         sections to the end of the list of data sections.  Force small BSS
10708         sections to the start of the list of BSS sections.  For large BSS
10709         sections to the end of the list of BSS sections.
10710         * symtab.h (class Symbol): Declare is_common_shndx.
10711         (Symbol::is_defined): Check Symbol::is_common_shndx.
10712         (Symbol::is_common): Likewise.
10713         (class Symbol_table): Define enum Commons_section_type.  Update
10714         declarations.  Add small_commons_ and large_commons_ fields.
10715         * symtab.cc (Symbol::is_common_shndx): New function.
10716         (Symbol_table::Symbol_table): Initialize new fields.
10717         (Symbol_table::add_from_object): Put small and large common
10718         symbols in the right list.
10719         (Symbol_table::sized_finalized_symbol): Check
10720         Symbol::is_common_shndx.
10721         (Symbol_table::sized_write_globals): Likewise.
10722         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10723         common symbol lists.  Don't call do_allocate_commons_list if the
10724         list is empty.
10725         (Symbol_table::do_allocate_commons_list): Remove is_tls
10726         parameter.  Add comons_section_type parameter.  Change all
10727         callers.  Handle small and large common symbols.
10728         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10729         Symbol::is_common_shndx.
10730         * resolve.cc (symbol_to_bits): Likewise.
10731         * target.h (Target::small_common_shndx): New function.
10732         (Target::small_common_section_flags): New function.
10733         (Target::large_common_shndx): New function.
10734         (Target::large_common_section_flags): New function.
10735         (Target::new_output_section): New function.
10736         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10737         small_common_section_flags, and large_common_section_flags
10738         fields.
10739         (Target::do_new_output_section): New virtual function.
10740         * arm.cc (Target_arm::arm_info): Initialize new fields.
10741         * i386.cc (Target_i386::i386_info): Likewise.
10742         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10743         Likewise.
10744         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10745         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10746         (Target_x86_64::do_new_output_section): New function.
10747         * configure.ac: Define conditional MCMODEL_MEDIUM.
10748         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10749         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10750         (large_LDFLAGS): Define.
10751         * testsuite/large.c: New file.
10752         * testsuite/testfile.cc (Target_test::test_target_info):
10753         Initialize new fields.
10754         * configure, testsuite/Makefile.in: Rebuild.
10755
10756 2009-06-05  Doug Kwan  <dougkwan@google.com>
10757
10758         * Makefile.am (CCFILES): Add target.cc.
10759         * Makefile.in: Regenerate.
10760         * i386.cc (class Target_i386): Define new virtual method to
10761         override do_is_local_label_name in parent.
10762         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10763         local symbols if --discard-locals or -X is given.
10764         * options.h (class General_options): Declare new options
10765         '--discard-locals' and '-X' for discarding locals.
10766         * target.h (class Target): Define new methods is_local_label_name.
10767         Declare new virtual method do_is_local_label_name.
10768         * target.cc: New file.
10769         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10770         (check_SCRIPTS): Add discard_locals_test.sh.
10771         (check_DATA): Add discard_local_tests.syms.
10772         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10773         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10774         * testsuite/Makefile.in: Regenerate.
10775         * testsuite/discard_locals_test.c: New file.
10776         * testsuite/discard_locals_test.sh: Same.
10777
10778 2009-06-05  Doug Kwan  <dougkwan@google.com>
10779
10780         * object.cc (Sized_relobj::Sized_relobj): Initialize
10781         discarded_eh_frame_shndx_ to -1U.
10782         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10783         section.
10784         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10785         a discarded .eh_frame section.
10786         (Sized_relobj::do_finalize_local_symbols): Ditto.
10787         * object.h (class Sized_relobj): Declare new member
10788         discarded_eh_frame_shndx_.
10789         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10790         (local_labels_test.o, local_labels_test): New rules.
10791         * testsuite/Makefile.in: Regenerate.
10792
10793 2009-06-04  Doug Kwan  <dougkwan@google.com>
10794
10795         * layout.cc (Layout::section_name_mapping): Add mapping for
10796         special ARM sections.
10797
10798 2009-06-03  Doug Kwan  <dougkwan@google.com>
10799
10800         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10801         (utils::has_overflow): Same.
10802
10803 2009-06-03  Ian Lance Taylor  <iant@google.com>
10804
10805         * layout.cc (Layout::section_name_mapping): New array, replacing
10806         Layout::linkonce_mapping.
10807         (Layout::section_name_mapping_count): New variable, replacing
10808         Layout::linkonce_mapping_count.
10809         (Layout::linkonce_output_name): Remove.
10810         (Layout::output_section_name): Rewrite.
10811         * layout.h (class Layout): Rename Linkonce_mapping to
10812         Section_name_mapping, linkonce_mapping to section_name_mapping,
10813         linkonce_mapping_count to section_name_mapping_count.  Don't
10814         declare linkonce_output_name.
10815
10816 2009-06-03  Doug Kwan  <dougkwan@google.com>
10817
10818         * gold/arm.cc (namespace utils): New.
10819         (Target_arm::reloc_is_non_pic): Define new method.
10820         (class Arm_relocate_functions): New.
10821         (Target_arm::Relocate::relocate): Handle relocation types used by
10822         Android.
10823
10824 2009-06-03  Ian Lance Taylor  <iant@google.com>
10825
10826         * arm.cc (Target_arm::scan::global): Use || instead of |.
10827
10828 2009-06-02  Doug Kwan  <dougkwan@google.com>
10829
10830         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10831         issued_non_pic_error_.
10832         (class Target_arm::Scan): Declare new method check_non_pic.
10833         Define new method symbol_needs_plt_entry.
10834         Declare new data member issued_non_pic_error_.
10835         (class Target_arm::Relocate): Declare new method
10836         should_apply_static_reloc.
10837         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10838         (Target_arm::Scan::check_non_pic): Define new method.
10839         (Target_arm::Scan::local): Handle a small subset of reloc types used
10840         by Android.
10841         (Target_arm::Scan::local): Same.
10842         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10843
10844 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10845
10846         * incremental.cc (Incremental_inputs::report_command_line): Filter
10847         out --incremental-* options.
10848
10849 2009-05-29  Doug Kwan  <dougkwan@google.com>
10850
10851         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10852         template class.
10853         (class Target_arm): Update comment.
10854         (Target_arm::Target_arm): Initialize new data members GOT_,
10855         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10856         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10857         and Target_arm::rel_dyn_section.
10858         Declare new_enum Target_arm::Got_type.
10859         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10860         and DYNBSS_.
10861         Update commments for member do_dynsym_value.
10862         (Target_arm::got_size, Target_arm::plt_section,
10863         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10864         new methods inside class defintion.
10865         (Target_arm::got_section): Define new method.
10866         (Target_arm::rel_dyn_section): Same.
10867         (Output_data_plt_arm): New template class.
10868         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10869         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10870         (Output_data_plt_arm::add_entry): Same.
10871         (Output_data_plt_arm::first_plt_entry): Define new
10872         static data member for PLT instruction template.
10873         (Output_data_plt_arm::plt_entry): Same.
10874         (Output_data_plt_arm::do_write): Define new method.
10875         (Target_arm::make_plt_entry): Same.
10876         (Target_arm::do_finalize_sections): Same.
10877         (Target_arm::do_dynsym_value): Same.
10878
10879 2009-05-28  Doug Kwan  <dougkwan@google.com>
10880
10881         * Makefile.am (TARGETSOURCES): Add arm.cc.
10882         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10883         * Makefile.in: Regenerate.
10884         * arm.cc: New file.
10885         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10886
10887 2009-05-26  Doug Kwan  <dougkwan@google.com>
10888
10889         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10890         (General_options::check_excluded_libs): Strip off directories in
10891         archive name before matching like GNU ld does.
10892         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10893         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10894         (exclude_libs_test_LDFLAGS): Add linker option
10895         -Wl,--exclude-libs,libexclude_libs_test_3
10896         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10897         an explicit archive without using -l.
10898         (alt/libexclude_libs_test_3.a): New make rule.
10899         * testsuite/Makefile.in: Regenerate.
10900         * testsuite/exclude_libs_test.c : Declare lib3_default().
10901         (main): Call it.
10902         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10903         * exclude_libs_test_3.c: New file.
10904
10905 2009-05-26  Nick Clifton  <nickc@redhat.com>
10906
10907         * po/id.po: New Indonesian translation.
10908         * po/gold.pot: Updated template file.
10909
10910 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10911
10912         * testsuite/Makefile.am: Add -ffunction-sections to compile
10913         gc_comdat_test files.  Add -Wl,--gc-sections to build
10914         gc_comdat_test.
10915         * testsuite/Makefile.in: Regenerate.
10916         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10917
10918 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10919
10920         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10921         kept comdat section was garbage collected.
10922         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10923         * testsuite/Makefile.in: Regenerate.
10924         * testsuite/gc_comdat_test.sh: New file.
10925         * testsuite/gc_comdat_test_1.cc: New file.
10926         * testsuite/gc_comdat_test_2.cc: New file.
10927
10928 2009-05-19  Doug Kwan  <dougkwan@google.com>
10929
10930         * archive.cc (Archive::Archive): Move constructor from archive.h
10931         to here.  Initialize no_export_.
10932         (Archive::get_elf_object_for_member): Set no_export flag of object.
10933         * archive.h (Archive::Archive): Move constructor body to
10934         archive.cc.
10935         (Archive::no_export): New method.
10936         (Archive::no_export_): New field.
10937         * object.h (Object::Object): Initialize no_export_ to false.
10938         (Object::no_export, Object::set_no_export): New methods.
10939         (Object::no_export_): New field.
10940         * options.cc (General_options::parse_exclude_libs): New method.
10941         (General_options::check_excluded_libs) Same.
10942         * options.h (exclude_libs): New option.
10943         (General_options::check_excluded_libs): New method declaration.
10944         (General_options::excluded_libs_): New field.
10945         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10946         default or protected visibility if an object has no-export flag set.
10947         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10948         (check_SCRIPTS): Add exclude_libs_test.sh.
10949         (check_DATA): Add exclude_libs_test.syms.
10950         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10951         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10952         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10953         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10954         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10955         libexclude_libs_test_2.a): New rules.
10956         * testsuite/Makefile.in: Regenerate.
10957         * testsuite/exclude_libs_test.c: New file.
10958         * testsuite/exclude_libs_test.sh: Ditto.
10959         * testsuite/exclude_libs_test_1.c: Ditto.
10960         * testsuite/exclude_libs_test_2.c: Ditto.
10961
10962 2009-05-15  Ian Lance Taylor  <iant@google.com>
10963
10964         * configure.ac: Check for declarations for cases where libiberty.h
10965         checks HAVE_DECL_xxx.
10966         * configure, config.in: Rebuild.
10967
10968 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10969
10970         * gold.h (Incremental_argument_list): Remove (invalid) forward
10971         declaration.
10972         * incremental.cc (Incremental_inputs::report_achive): New method.
10973         (Incremental_inputs::report_object): New method.
10974         (Incremental_inputs::report_script): New method.
10975         (Incremental_inputs::finalize_inputs): New method.
10976         (Incremental_inputs::finalize): Call finalize_inputs().
10977         (Incremental_inputs::sized_create_incremental_inputs_section_data):
10978         Create inputs entries.
10979         * incremental.h (Incremental_input_type): New enum.
10980         (Incremental_inputs::Incremental_input): Initialize new fields.
10981         (Incremental_inputs::report_inputs): New method.
10982         (Incremental_inputs::report_achive): New method.
10983         (Incremental_inputs::report_object): New method.
10984         (Incremental_inputs::report_script): New method.
10985         (Incremental_inputs::finalize_inputs): New method.
10986         (Incremental_inputs::Input_info): New struct.
10987         (Incremental_inputs::Input_info_map): New typedef.
10988         (Incremental_inputs::lock_): New field.
10989         (Incremental_inputs::Inputs_): New field.
10990         (Incremental_inputs::Inputs_map): New field.
10991         * main.cc (main): Call Incremental_input::report_inputs.
10992         * options.h (Input_argument_list): Typedef moved from
10993         Input_arguments.
10994         (Input_file_group::Files): Remove, use ::Input_argument_list.
10995         (Input_file_group::Input_argument_list): Remove, use
10996         ::Input_argument_list.
10997         * plugin.cc (Plugin_manager::add_input_file): Add error in
10998         incremental build.
10999         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11000         functions.
11001         * script.cc (read_input_script): Call
11002         Incremental_input::report_script.
11003         * script.h (Script_info): New class.
11004
11005 2009-04-27  Ian Lance Taylor  <iant@google.com>
11006
11007         * x86_64.cc (do_adjust_output_section): Set entsize to
11008         plt_entry_size.
11009
11010 2009-04-23  Elliott Hughes  <enh@google.com>
11011
11012         * output.cc (Output_file::close): After short writes, continue
11013         writing from the correct offset in the buffer being written.
11014
11015 2009-04-23  Chris Demetriou  <cgd@google.com>
11016
11017         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11018         * configure: Regenerate.
11019         * config.in: Regenerate.
11020         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11021         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11022
11023 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11024
11025         * incremental.cc (Incremental_inputs_header_data): Renamed from
11026         Incremental_input_header_data.
11027         (Incremental_inputs_header_data::data_size): New field.
11028         (Incremental_inputs_header_data::put_input_file_count): Renamed
11029         from input_file_count.
11030         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11031         from command_line_offset.
11032         (Incremental_inputs_header_data::put_reserved): Renamed from
11033         put_reserved.
11034         (Incremental_inputs_entry_data): Renamed from
11035         Incremental_input_entry_data.
11036         (Incremental_inputs_entry_data::data_size): New field.
11037         (Incremental_inputs::report_command_line): New method.
11038         (Incremental_inputs::finalize): New method.
11039         (Incremental_inputs::create_incremental_inputs_data): New method.
11040         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11041         * incremental.h: New file.
11042         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11043         (Layout::finalize): Create incremental inputs section in
11044         incremental builds.
11045         (Layout::create_incremental_info_sections): New method.
11046         * layout.h (Layout::incremental_inputs): New method.
11047         (Layout::create_incremental_info_sections): New method.
11048         (Layout::incremental_inputs_): New field.
11049         * main.cc (main): Notify Incremental_input of the command line.
11050
11051 2009-04-01  Ian Lance Taylor  <iant@google.com>
11052             Mikolaj Zalewski  <mikolajz@google.com>
11053
11054         * gold.h (reserve_unordered_map): Define, three versions, one for
11055         each version of Unordered_map.
11056         * layout.cc (Layout::Layout): Remove options parameter.  Add
11057         number_of_input_files parameter.  Don't initialize options_.
11058         Initialize number_of_input_files_ and resized_signatures_.  Move
11059         sections_are_attached_.
11060         (Layout::layout_group): Reserve space for group_signatures_.
11061         (Layout::find_or_add_kept_section): Change name parameter to be a
11062         reference.  Resize signatures_ map when it gets large enough.
11063         (Layout::layout_eh_frame): Use parameters->options() instead of
11064         this->options_.
11065         (Layout::make_output_section): Likewise.
11066         (Layout::attach_allocated_section_to_segment): Likewise.
11067         (Layout::finalize, Layout::create_executable_stack): Likewise.
11068         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11069         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11070         * layout.h (class Layout): Update declarations.  Remove options_
11071         field.  Add number_of_input_files_ and resized_signatures_
11072         fields.  Move sections_are_attached_ field.
11073         * main.cc (main): Pass number of input files to Layout
11074         constructor.  Don't pass options.
11075
11076 2009-03-30  Ian Lance Taylor  <iant@google.com>
11077
11078         * ffsll.c (ffsll): Correct implementation.
11079
11080 2009-03-27  Ian Lance Taylor  <iant@google.com>
11081
11082         * ffsll.c: New file.
11083         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11084         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11085         * ftruncate.c (ftruncate): Declare before definition.
11086         * mremap.c (mremap): Likewise.
11087         * pread.c (pread): Likewise.
11088         * configure, Makefile.in, config.in: Rebuild.
11089
11090         * mremap.c: New file.
11091         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11092         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11093         (mremap): Declare if HAVE_MREMAP is not defined.
11094         * configure, Makefile.in, config.in: Rebuild.
11095
11096 2009-03-27  Cary Coutant  <ccoutant@google.com>
11097
11098         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11099         position independent.
11100         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11101         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11102
11103 2009-03-24  Cary Coutant  <ccoutant@google.com>
11104
11105         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11106         an executable.
11107         (needs_dynamic_reloc): Likewise.
11108
11109 2009-03-24  Ian Lance Taylor  <iant@google.com>
11110
11111         * yyscript.y (file_cmd): Recognize EXTERN.
11112         (extern_name_list, extern_name_list_body): New nonterminals.
11113         * script.cc (script_add_extern): Define.
11114         * script-c.h (script_add_extern): Declare.
11115
11116 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11117
11118         * object.cc (is_elf_object): Define.
11119         * object.h (is_elf_object): Declare.
11120         * archive.cc (Archive::get_elf_object_for_member): Call
11121         is_elf_object.
11122         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11123
11124 2009-03-24  Elliott Hughes  <enh@google.com>
11125
11126         * output.cc (Output_file::map_anonymous): Define.
11127         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11128         try an anonymous one.  Report the size if the mmap fails.
11129         * output.h (class Output_file): Declare map_anonymous.
11130
11131 2009-03-24  Ian Lance Taylor  <iant@google.com>
11132
11133         * target-select.cc (instantiate_target): Don't acquire the lock if
11134         the instantiated_target_ field has already been set.
11135
11136 2009-03-23  Ian Lance Taylor  <iant@google.com>
11137
11138         * gold-threads.h (class Initialize_lock): Define.
11139         * gold-threads.cc (class Initialize_lock_once): Define.
11140         (initialize_lock_control): New static variable.
11141         (initialize_lock_pointer): New static variable.
11142         (initialize_lock_once): New static function.
11143         (Initialize_lock::Initialize_lock): Define.
11144         (Initialize_lock::initialize): Define.
11145         * target-select.h: Include "gold-threads.h".
11146         (class Target_selector): Add lock_ and initialize_lock_ fields.
11147         Don't define instantiate_target, just declare it.
11148         * target-select.cc (Target_selector::Target_selector): Initialize
11149         new fields.
11150         (Target_selector::instantiate_target): Define.
11151         * descriptors.h: Include "gold-threads.h".
11152         (class Descriptors): Add initialize_lock_ field.
11153         * descriptors.cc (Descriptors::Descriptors): Initialize new
11154         field.
11155         (Descriptors::open): Use initialize_lock_ field
11156         * errors.h (class Errors): Add initialize_lock_ field.
11157         * errors.cc (Errors::Errors): Initialize new field.
11158         (Errors::initialize_lock): Use initialize_lock_ field.
11159         * powerpc.cc (class Target_selector_powerpc): Remove
11160         instantiated_target_ field.  In do_recognize call
11161         instantiate_target rather than do_instantiate_target.  In
11162         do_instantiate_target just allocate a new target.
11163         * sparc.cc (class Target_selector_sparc): Likewise.
11164
11165         * freebsd.h: New file.
11166         * i386.cc: Include "freebsd.h".
11167         (Target_i386): Derive from Target_freebsd rather than
11168         Sized_target.
11169         (Target_selector_i386): Derive from Target_selector_freebsd rather
11170         than Target_selector.
11171         * x86_64.cc: Include "freebsd.h".
11172         (Target_x86_64): Derive from Target_freebsd rather than
11173         Sized_target.
11174         (Target_selector_x86_64): Derive from Target_selector_freebsd
11175         rather than Target_selector.
11176         * target.h (class Target): Add adjust_elf_header and
11177         do_adjust_elf_header.
11178         * output.cc (Output_file_header:: do_sized_write): Call target
11179         adjust_elf_header routine.
11180         * configure.tgt: Set targ_osabi.
11181         * configure.ac: Define GOLD_DEFAULT_OSABI.
11182         * parameters.cc (Parameters::default_target): Pass
11183         GOLD_DEFAULT_OSABI to select_target.
11184         * target-select.h (class Target_selector): Make instantiate_target
11185         protected rather than private.
11186         * Makefile.am (HFILES): Add freebsd.h.
11187         * configure, Makefile.in, config.in: Rebuild.
11188
11189         * merge.cc (do_add_input_section): Correct pend value.  Change
11190         message about last entry not being null terminated from error to
11191         warning.
11192
11193 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11194
11195         * incremental.cc: New file.
11196         * Makefile.am (CCFILES): Add incremental.cc.
11197         * Makefile.in: Rebuild.
11198
11199 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11200
11201         * layout.cc (Layout::output_section_name): Preserve names
11202         of '.note.' sections.
11203
11204 2009-03-19  Ian Lance Taylor  <iant@google.com>
11205
11206         * descriptors.cc (Descriptors::open): Check that the options are
11207         valid before using them.
11208
11209 2009-03-18  Ian Lance Taylor  <iant@google.com>
11210
11211         * script-sections.h: Include <list>.
11212         (class Script_sections): Change Sections_elements from std::vector
11213         to std::list.  Typedef public Elements_iterator.  Add
11214         orphan_section_placement_, data_segment_align_start_, and
11215         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11216         field.
11217         * script-sections.cc (class Orphan_section_placement): New class.
11218         (class Sections_element): Add virtual functions is_relro and
11219         orphan_section_init.  Remove virtual function place_orphan_here.
11220         (class Output_section_definition): Add is_relro and
11221         orphan_section_init.  Remove place_orphan_here.
11222         (class Orphan_output_section): Likewise.
11223         (Script_sections::Script_sections): Update for field changes.
11224         (Script_sections::data_segment_align): Set saw_data_segment_align_
11225         and data_segment_align_start_, not data_segment_align_index.
11226         (Script_sections::data_segment_relro_end): Check
11227         saw_data_segment_align_.  Use data_segment_align_start_ rather
11228         than data_segment_align_index_.
11229         (Script_sections::place_orphan): Rewrite to use
11230         Orphan_section_placement.
11231
11232 2009-03-17  Ian Lance Taylor  <iant@google.com>
11233
11234         * archive.cc (Archive::add_symbols): Check for a version attached
11235         to the symbol name in the archive map.
11236         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11237         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11238         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11239         (ver_test_11.a): New target.
11240         * testsuite/Makefile.in: Rebuild.
11241
11242         * configure.ac: Check for chsize and posix_fallocate.  Replace
11243         ftruncate.
11244         * ftruncate.c: New file, from gnulib.
11245         * output.cc (posix_fallocate): Define dummy version if not
11246         HAVE_POSIX_FALLOCATE.
11247         (Output_file::map): Call posix_fallocate rather than lseek and
11248         write.
11249         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11250         * configure, Makefile.in, config.in: Rebuild.
11251
11252 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11253
11254         * layout.h (Layout::create_note): Add section_name parameter.
11255         * layout.cc (Layout::create_note): Likewise.
11256         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11257
11258 2009-03-17  Ian Lance Taylor  <iant@google.com>
11259
11260         * descriptors.cc: Include "options.h".
11261         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11262         (Descriptors::open): Always use O_CLOEXEC when opening a new
11263         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11264         then set FD_CLOEXEC.
11265
11266         * sparc.cc (class Target_sparc): Add has_got_section.
11267         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11268         make sure we have a GOT section.
11269
11270         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11271         (Target_sparc::Scan::local): Likewise.
11272         (Target_sparc::Scan::global): Likewise.
11273         (Target_sparc::Relocate::relocate): Likewise.
11274         (Target_sparc::Relocate::relocate_tls): Likewise.
11275
11276         * symtab.cc (Symbol_table::define_default_version): New function,
11277         broken out of add_from_object.
11278         (Symbol_table::add_from_object): Call define_default_version.
11279         (Symbol_table::define_special_symbol): Add resolve_oldsym
11280         parameter.  Change all callers.  If the version for a symbol comes
11281         from a version script, resolve it with the symbol with the same
11282         name with no version.  Also add the symbol without a version if
11283         appropriate.
11284         (do_define_in_output_data): If resolving with oldsym, don't delete
11285         sym.
11286         (do_define_in_output_segment): Likewise.
11287         (do_define_as_constant): Likewise.
11288         * symtab.h (class Symbol_table): Update declarations.
11289
11290 2009-03-13  Ian Lance Taylor  <iant@google.com>
11291
11292         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11293         (Read_symbols::requeue): New function.
11294         (Read_symbols::do_read_symbols): If make_elf_object fails because
11295         the target type is not configured, and the file was searched for,
11296         issue a warning and retry with the next directory.
11297         (Add_symbols::run): If the file has an incompatible format, and
11298         it was searched for, requeue the Read_symbols task.  On error,
11299         release the object.
11300         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11301         dirindex parameter to constructor.  Change all callers.  Declare
11302         incompatible_warning and requeue.
11303         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11304         input_argument_ and input_group_ fields.  Add them to
11305         constructor.  Change all callers.
11306         (class Read_script): Add dirindex_ field.  Add it to constructor.
11307         Change all callers.
11308         * archive.cc (Archive::setup): Remove input_objects parameter.
11309         Change all callers.
11310         (Archive::get_file_and_offset): Likewise.
11311         (Archive::read_all_symbols): Likewise.
11312         (Archive::read_symbols): Likewise.
11313         (Archive::get_elf_object_for_member): Remove input_objects
11314         parameter.  Add punconfigured parameter.  Change all callers.
11315         (Archive::add_symbols): Change return type to bool.  Check return
11316         value of include_member.
11317         (Archive::include_all_members): Likewise.
11318         (Archive::include_member): Change return type to bool.  Return
11319         false if first included object has incompatible target.  Set
11320         included_member_ field.
11321         (Add_archive_symbols::run): If add_symbols returns false, requeue
11322         Read_symbols task.
11323         * archive.h (class Archive): Add included_member_ field.
11324         Initialize it in constructor.  Add input_file and searched_for
11325         methods.  Update declarations.
11326         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11327         input_argument_ fields.  Add them to constructor.  Change all
11328         callers.
11329         * script.cc: Include "target-select.h".
11330         (class Parser_closure): Add skip_on_incompatible_target_ and
11331         found_incompatible_target_ fields.  Add
11332         skip_on_incompatible_target parameter to constructor.  Change all
11333         callers.  Add methods skip_on_incompatible_target,
11334         clear_skip_on_incompatible_target, found_incompatible_target, and
11335         set_found_incompatible_target.
11336         (read_input_script): Add dirindex parameter.  Change all callers.
11337         If parser finds an incompatible target, requeue Read_symbols
11338         task.
11339         (script_set_symbol): Clear skip_on_incompatible_target in
11340         closure.
11341         (script_add_assertion, script_parse_option): Likewise.
11342         (script_start_sections, script_add_phdr): Likewise.
11343         (script_check_output_format): New function.
11344         * script.h (read_input_script): Update declaration.
11345         * script-c.h (script_check_output_format): Declare.
11346         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11347         (ignore_cmd): Remove OUTPUT_FORMAT.
11348         * fileread.cc (Input_file::Input_file): Add explicit this.
11349         (Input_file::will_search_for): New function.
11350         (Input_file::open): Add pindex parameter.  Change all callers.
11351         * fileread.h (class Input_file): Add input_file_argument method.
11352         Declare will_search_for.  Update declarations.
11353         * object.cc (make_elf_object): Add punconfigured parameter.
11354         Change all callers.
11355         * object.h (class Object): Make input_file public.  Add
11356         searched_for method.
11357         (make_elf_object): Update declaration.
11358         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11359         restart search.
11360         * dirsearch.h (class Dirsearch): Update declaration.
11361         * options.h (class General_options): Add --warn-search-mismatch.
11362         * parameters.cc (Parameters::is_compatible_target): New function.
11363         * parameters.h (class Parameters): Declare is_compatible_target.
11364         * workqueue.cc (Workqueue::add_blocker): New function.
11365         * workqueue.h (class Workqueue): Declare add_blocker.
11366
11367         * fileread.cc (Input_file::open): Remove options parameter.
11368         Change all callers.
11369         (Input_file::open_binary): Likewise.
11370         * script.cc (read_input_script): Likewise.
11371         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11372         options parameter from constructor.  Change all callers.
11373         (class Read_script): Likewise.
11374         * fileread.h (class Input_file): Update declarations.
11375         * script.h (read_input_script): Update declaration.
11376
11377 2009-03-10  Nick Clifton  <nickc@redhat.com>
11378
11379         * po/es.po: New Spanish translation.
11380
11381 2009-03-06  Cary Coutant  <ccoutant@google.com>
11382
11383         * options.cc (parse_short_option): Keep dash_z from registering itself.
11384
11385 2009-03-03  Ian Lance Taylor  <iant@google.com>
11386
11387         PR 9918
11388         * target-reloc.h (relocate_section): Pass output_section to
11389         relocate.
11390         * i386.cc (Target_i386::should_apply_static_reloc): Add
11391         output_section parameter.  Change all callers.
11392         (Target_i386::Relocate::relocate): Add output_section parameter.
11393         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11394         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11395         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11396         * testsuite/two_file_shared.sh: New script.
11397         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11398         (check_DATA): Add two_file_shared.dbg.
11399         (two_file_shared.dbg): New target.
11400         * testsuite/Makefile.in: Rebuild.
11401
11402 2009-03-01  Ian Lance Taylor  <iant@google.com>
11403
11404         * configure.ac: Check for byteswap.h.
11405         * configure: Rebuild.
11406         * config.in: Rebuild.
11407
11408 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11409
11410         * layout.cc (Layout::find_or_add_kept_section): New function.
11411         (Layout::add_comdat): Removed.
11412         * layout.h (struct Kept_section): Move out of class Layout.
11413         Remove trailing underscores from field names.  Add group_sections
11414         field.  Rename group_ field to is_group.  Change all uses.
11415         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11416         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11417         comdat_groups_ field.
11418         (Sized_relobj::include_section_group): Use
11419         find_or_add_kept_section and Kept_section::group_sections.
11420         (Sized_relobj::include_linkonce_section): Likewise.
11421         * object.cc (class Sized_relobj): Don't define Comdat_group or
11422         Comdat_group_table.  Remove find_comdat_group and
11423         add_comdat_group.  Remove comdat_groups_ field.
11424         * plugin.cc (include_comdat_group): Use
11425         Layout::find_or_add_kept_section.
11426
11427 2009-02-28  Ian Lance Taylor  <iant@google.com>
11428
11429         * README: --gc-sections and map files are now supported.  Document
11430         some build requirements.
11431
11432         PR 6992
11433         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11434         relocatable link set the value of the section symbol to zero.
11435         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11436         relocatable link don't include the section address in the local
11437         symbol value.
11438
11439 2009-02-27  Ian Lance Taylor  <iant@google.com>
11440
11441         PR 6811
11442         * options.h (class Search_directory): Add is_system_directory.
11443         (class General_options): Declare is_in_system_directory.
11444         * options.cc (get_relative_sysroot): Make static.
11445         (get_default_sysroot): Make static.
11446         (General_optoins::is_in_system_directory): New function.
11447         * fileread.cc (Input_file::is_in_system_directory): New function.
11448         * fileread.h (class Input_file): Declare is_in_system_directory.
11449         * object.h (class Object): Add is_in_system_directory.
11450         (class Input_objects): Remove system_library_directory_ field.
11451         * object.cc (Input_objects::add_object): Don't set
11452         system_library_directory_.
11453         (input_objects::found_in_system_library_directory): Remove.
11454         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11455         parameter.  Change all callers.
11456         (Symbol_table::sized_write_globals): Likewise.
11457         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11458         Call Object::is_in_system_directory.
11459         * symtab.h (class Symbol_table): Update declarations.
11460
11461         PR 5990
11462         * descriptors.h (Open_descriptor): Add is_on_stack field.
11463         * descriptors.cc (Descriptors::open): If the descriptor is on the
11464         top of the stack, remove it.  Initialize is_on_stack field.
11465         (Descriptors::release): Only add pod to stack if it is not on the
11466         stack already.
11467         (Descriptors::close_some_descriptor): Clear stack_next and
11468         is_on_stack fields.
11469
11470         PR 7091
11471         * output.cc (Output_section::find_starting_output_address): Rename
11472         from starting_output_address; add PADDR parameter; change return
11473         type.
11474         * output.h (class Output_section): Declare
11475         find_starting_output_address instead of starting_output_address.
11476         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11477         section symbol for which we can't find a merge section.
11478
11479         PR 9836
11480         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11481         hidden or internal, force the symbol to be local.
11482         * resolve.cc (Symbol::override_visibility): Define.
11483         (Symbol::override_base): Use override_visibility.
11484         (Symbol_table::resolve): Likewise.
11485         (Symbol::override_base_with_special): Likewise.
11486         (Symbol_table::override_with_special): If the visibility is hidden
11487         or internal, force the symbol to be local.
11488         * symtab.h (class Symbol): Add set_visibility and
11489         override_visibility.
11490         * testsuite/ver_test_1.sh: New file.
11491         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11492         (check_DATA): Add ver_test_1.syms.
11493         (ver_test_1.syms): New target.
11494         * testsuite/Makefile.in: Rebuild.
11495
11496 2009-02-25  Cary Coutant  <ccoutant@google.com>
11497
11498         * layout.cc (Layout::choose_output_section): Don't rename sections
11499         when using a linker script that has a SECTIONS clause.
11500         * Makefile.in: Regenerate.
11501
11502         * testsuite/Makefile.am (script_test_5.sh): New test case.
11503         * testsuite/Makefile.in: Regenerate.
11504         * testsuite/script_test_5.cc: New file.
11505         * testsuite/script_test_5.sh: New file.
11506         * testsuite/script_test_5.t: New file.
11507
11508 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11509
11510         * archive.cc (Archive::include_member): Update calls to add_symbols.
11511         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11512         the Layout argument.
11513         * dynobj.h (do_add_symbols): Add the Layout argument.
11514         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11515         Layout argument.
11516         * object.h (Object::add_symbols): Add the Layout argument.
11517         (Object::do_add_symbols): Add the Layout argument.
11518         (Sized_relobj::do_add_symbols): Add the Layout argument.
11519         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11520         Unify the two versions.
11521         (Add_plugin_symbols): Remove.
11522         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11523         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11524         (Add_plugin_symbols): Remove.
11525         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11526         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11527         (Add_symbols::run): Make it work with Pulginobj.
11528
11529 2009-02-06  Ian Lance Taylor  <iant@google.com>
11530
11531         * object.cc (Sized_relobj::do_layout): Make info message start
11532         with lower case letter.
11533
11534 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11535
11536         * binary.cc: Fix file comment.
11537
11538         * options.h (enum Incremental_disposition): Define.
11539         (class General_options): Add new options: --incremental,
11540         --incremental_changed, --incremental_unchanged,
11541         --incremental_unknown.  Add incremental_disposition_ and
11542         implicit_incremental_ fields.
11543         (General_options::incremental_disposition): New function.
11544         (class Position_dependent_options): Add incremental_disposition
11545         option.
11546         (Position_dependent_options::copy_from_options): Set incremental
11547         dispositions.
11548         * options.cc (General_options::parse_incremental_changed): New
11549         function.
11550         (General_options::parse_incremental_unchanged): New function.
11551         (General_options::parse_incremental_unknown): New function.
11552         (General_options::General_options): Initialize new fields
11553         incremental_disposition_ and implicit_incremental_.
11554         (General_options::finalize): Check for uasge of --incremental-*
11555         without --incremental.
11556
11557 2009-02-06  Chris Demetriou  <cgd@google.com>
11558
11559         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11560         pointer and to report location as the file name associated with
11561         the symbol.
11562         (gold_undefined_symbol_at_location): New function to replace the
11563         old gold_undefined_symbol functionality.
11564         * target-reloc.h (relocate_section): Update to use
11565         gold_undefined_symbol_at_location.
11566         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11567         Call gold_undefined_symbol function rather than gold_error.
11568         * errors.h (Errors::undefined_symbol): Take location as a
11569         string, rather than calculating it from a relocation.
11570         * errors.cc (Errors::fatal): Print "fatal error:" before the
11571         formatted message.
11572         (Errors::error, Errors::error_at_location): Print "error: "
11573         before the formatted message.
11574         (Errors::undefined_symbol): Take location as a string, rather
11575         than calculating it from a relocation.
11576         (gold_undefined_symbol_at_location): New function akin to
11577         old gold_undefined_symbol, calculates location from relocation.
11578         (gold_undefined_symbol): Change to take only a Symbol pointer
11579         and to report location as the file name associated with the symbol.
11580         * testsuite/debug_msg.sh: Update for changed error messages.
11581         * testsuite/undef_symbol.sh: Likewise.
11582
11583 2009-02-04  Duncan Sands  <baldrick@free.fr>
11584
11585         PR 9812
11586         * reduced_debug_output.h
11587         (Output_reduced_debug_abbrev_section::failed): Use format for
11588         gold_warning.
11589         (Output_reduced_debug_info_section::faild): Likewise.
11590
11591 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11592
11593         * script.cc (Lazy_demangler): New class.
11594         (Version_script_info::get_symbol_version_helper): Demangle a
11595         symbol only once.
11596
11597 2009-01-29  Cary Coutant  <ccoutant@google.com>
11598
11599         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11600         to __tls_get_addr.
11601         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11602
11603 2009-01-28  Ian Lance Taylor  <iant@google.com>
11604
11605         * version.cc (version_string): Bump to 1.9.
11606
11607         * gold.h: Include <cstring> and <stdint.h>.
11608         * version.cc: Include <cstdio>.
11609         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11610         warning.
11611         * reduced_debug_output.cc (insert_into_vector): Rename from
11612         Insert_into_vector; change all callers.  Use Swap_unaligned to
11613         avoid aliasing issue; remove union since it is unnecessary.
11614
11615 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11616
11617         * Makefile.am (CCFILES): Add gc.cc.
11618         (HFILES): Add gc.h.
11619         * Makefile.in: Regenerate.
11620         * gold.cc (Gc_runner): New class.
11621         (queue_initial_tasks): Call garbage collection related tasks
11622         when corresponding options are invoked.
11623         (queue_middle_gc_tasks): New function.
11624         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11625         processed early before laying out sections during garbage collection.
11626         * gold.h (queue_middle_gc_tasks): New function.
11627         (is_prefix_of): Move from "layout.cc".
11628         * i386.cc (Target_i386::gc_process_relocs): New function.
11629         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11630         * main.cc (main): Create object of class "Garbage_collection".
11631         * object.cc (Relobj::copy_symbols_data): New function.
11632         (Relobj::is_section_name_included): New function.
11633         (Sized_relobj::do_layout): Allow this function to be called twice
11634         during garbage collection and defer layout of section during the
11635         first call.
11636         * object.h (Relobj::get_symbols_data): New function.
11637         (Relobj::is_section_name_included): New function.
11638         (Relobj::copy_symbols_data): New function.
11639         (Relobj::set_symbols_data): New function.
11640         (Relobj::get_relocs_data): New function.
11641         (Relobj::set_relocs_data): New function.
11642         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11643         (Relobj::gc_process_relocs): New function.
11644         (Relobj::do_gc_process_relocs): New pure virtual function.
11645         (Relobj::sd_): New data member.
11646         (Sized_relobj::is_output_section_offset_invalid): New function.
11647         (Sized_relobj::do_gc_process_relocs): New function.
11648         * options.h (General_options::gc_sections): Modify to not be a no-op.
11649         (General_options::print_gc_sections): New option.
11650         * plugin.cc (Plugin_finish::run): Remove function call to
11651         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11652         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11653         * reloc.cc (Read_relocs::run): Add task to process relocs and
11654         determine unreferenced sections when doing garbage collection.
11655         (Gc_process_relocs): New class.
11656         (Sized_relobj::do_gc_process_relocs): New function.
11657         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11658         sections that are garbage collected.
11659         * reloc.h (Gc_process_relocs): New class.
11660         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11661         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11662         symbols whose corresponding sections are garbage collected.
11663         (Symbol_table::Symbol_table): Add new parameter for the garbage
11664         collection object.
11665         (Symbol_table::gc_mark_undef_symbols): New function.
11666         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11667         (Symbol_table::gc_mark_dyn_syms): New function.
11668         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11669         as garbage.
11670         (Symbol_table::add_from_object): Likewise.
11671         (Symbol_table::add_from_relobj): When building shared objects, do not
11672         treat externally visible symbols as garbage.
11673         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11674         table information for static and relocatable links.
11675         * symtab.h (Symbol_table::set_gc): New function.
11676         (Symbol_table::gc): New function.
11677         (Symbol_table::gc_mark_undef_symbols): New function.
11678         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11679         (Symbol_table::gc_mark_dyn_syms): New function.
11680         (Symbol_table::gc_): New data member.
11681         * target.h (Sized_target::gc_process_relocs): New pure virtual
11682         function.
11683         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11684         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11685
11686 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11687
11688         * options.h (General_options::gc_sections): Define as a no-op for now.
11689         (General_options::no_keep_memory): Ditto.
11690         (General_options::Bshareable): Define.
11691         * options.cc (General_options::finalize): Honor -Bshareable.
11692
11693 2009-01-20  Andreas Schwab  <schwab@suse.de>
11694
11695         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11696         read the value in the contents, since we don't use it.  Use the
11697         template endianness when writing.
11698         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11699
11700 2009-01-19  Andreas Schwab  <schwab@suse.de>
11701
11702         * configure.tgt (powerpc64-*): Fix targ_obj.
11703
11704 2009-01-15  Ian Lance Taylor  <iant@google.com>
11705
11706         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11707         local symbols when stripping all symbols.
11708
11709 2009-01-14  Cary Coutant  <ccoutant@google.com>
11710
11711         * output.cc (Output_reloc): Add explicit instantiations.
11712
11713 2009-01-14  Cary Coutant  <ccoutant@google.com>
11714
11715         * archive.cc (Archive::get_elf_object_for_member): Remove call
11716         to File_read::claim_for_plugin.
11717         * descriptors.cc (Descriptors::open): Remove reference to
11718         is_claimed.
11719         (Descriptors::claim_for_plugin): Remove.
11720         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11721         (Descriptors::is_claimed): Remove.
11722         (claim_descriptor_for_plugin): Remove.
11723         * fileread.cc (File_read::claim_for_plugin): Remove.
11724         * fileread.h (File_read::claim_for_plugin): Remove.
11725         (File_read::descriptor): Reopen descriptor if necessary.
11726         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11727         (Plugin_manager::all_symbols_read): Add task parameter. Change
11728         all callers.
11729         (Plugin_manager::get_input_file): New function.
11730         (Plugin_manager::release_input_file): New function.
11731         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11732         corresponding data member.
11733         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11734         and pass to base constructor. Change all callers.
11735         (get_input_file, release_input_file): New functions.
11736         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11737         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11738         (Plugin_manager::all_symbols_read): Add task parameter.
11739         (Plugin_manager::get_input_file): New function.
11740         (Plugin_manager::release_input_file): New function.
11741         (Plugin_manager::task_): New data member.
11742         (Pluginobj::Pluginobj): Add filesize parameter.
11743         (Pluginobj::filename): New function.
11744         (Pluginobj::descriptor): New function.
11745         (Pluginobj::filesize): New function.
11746         (Pluginobj::filesize_): New data member.
11747         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11748         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11749         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11750
11751         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11752         with archive libraries.
11753         * testsuite/Makefile.in: Regenerate.
11754         * testsuite/plugin_test.c (struct sym_info): New type.
11755         (get_input_file, release_input_file): New static variables.
11756         (onload): Capture new transfer vector entries.
11757         (claim_file_hook): Stop reading at end of file according to filesize.
11758         Factor out parsing of readelf output into separate function.
11759         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11760         APIs and get the source file name from the symbol table.  Convert
11761         source file name to corresponding object file name.  Print info
11762         message when adding new input files.
11763         (parse_readelf_line): New function.
11764         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11765         * testsuite/plugin_test_2.sh: Likewise.
11766         * testsuite/plugin_test_3.sh: Likewise.
11767         * testsuite/plugin_test_4.sh: New test case.
11768
11769 2009-01-07  Ian Lance Taylor  <iant@google.com>
11770
11771         * version.cc (version_string): Bump to 1.8.
11772
11773 2008-12-23  Cary Coutant  <ccoutant@google.com>
11774
11775         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11776         * plugin.cc (Plugin_manager::finish): Rename as
11777         layout_deferred_objects.  Move cleanup to separate function.
11778         (Plugin_manager::cleanup): New function.
11779         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11780         separately.
11781         * plugin.h (Plugin_manager::finish): Rename as
11782         layout_deferred_objects.
11783         (Plugin_manager::cleanup): New function.
11784         (Plugin_manager::cleanup_done): New field.
11785
11786 2008-12-23  Cary Coutant  <ccoutant@google.com>
11787
11788         * plugin.cc (is_visible_from_outside): New function.
11789         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11790         so we don't return "IR only" status for exported symbols or -r links.
11791
11792         * testsuite/Makefile.am (plugin_test_3): New test case.
11793         * testsuite/Makefile.in: Regenerate.
11794         * testsuite/plugin_test_3.sh: New file.
11795
11796 2008-12-22  Cary Coutant  <ccoutant@google.com>
11797
11798         * object.cc (Sized_relobj::layout_section): New function.
11799         (Sized_relobj::do_layout): Defer layout of input sections until after
11800         plugin has provided replacement files.
11801         (Sized_relobj::do_layout_deferred_sections): New function.
11802         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11803         (Relobj::layout_deferred_sections): New function.
11804         (Relobj::do_layout_deferred_sections): New function.
11805         (Sized_relobj::do_layout_deferred_sections): New function.
11806         (Sized_relobj::layout_section): New function.
11807         (Sized_relobj::Deferred_layout): New structure.
11808         (Sized_relobj::deferred_layout_): New field.
11809         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11810         Change all callers.  Layout deferred sections.
11811         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11812         references.
11813         (Plugin_hook::run): Move code from do_plugin_hook inline.
11814         (Plugin_hook::do_plugin_hook): Remove.
11815         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11816         (Plugin_manager::finish): Renamed, was cleanup.
11817         (Plugin_manager::should_defer_layout): New function.
11818         (Plugin_manager::add_deferred_layout_object): New function.
11819         (Plugin_manager::Deferred_layout_list): New type.
11820         (Plugin_manager::deferred_layout_objects_): New field.
11821         (Plugin_hook::do_plugin_hook): Remove.
11822
11823 2008-12-17  Ian Lance Taylor  <iant@google.com>
11824
11825         * options.h (class General_options): Add --no case for
11826         --export-dynamic.
11827
11828 2008-12-16  Cary Coutant  <ccoutant@google.com>
11829
11830         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11831         vector.
11832         (Plugin_manager::claim_file): Create plugin object even if
11833         plugin did not call the add_symbols callback.
11834         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11835         asking for more symbols than were added.
11836         * testsuite/Makefile.am (plugin_test_1): Add test case with
11837         no global symbols.
11838         (empty.syms): New target.
11839         * testsuite/Makefile.in: Regenerate.
11840         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11841         message. Don't call add_symbols if no globals.
11842         (all_symbols_read_hook): Don't provide replacement for empty
11843         claimed file.
11844
11845 2008-12-12  Ian Lance Taylor  <iant@google.com>
11846
11847         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11848         r_type == 0 for a local symbol with r_sym == 0.
11849         (scan_relocatable_relocs): Pass r_sym to
11850         local_non_section_strategy.
11851         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11852         r_sym parameter.
11853
11854         * configure.ac: Update test for TLS descriptors: they are
11855         supported as of glibc 2.9.
11856         * configure: Rebuild.
11857
11858 2008-12-11  Ian Lance Taylor  <iant@google.com>
11859
11860         PR 7091
11861         * target-reloc.h (Default_scan_relocatable_relocs): For each
11862         function, map r_type == 0 to RELOC_DISCARD.
11863
11864 2008-12-10  Cary Coutant  <ccoutant@google.com>
11865
11866         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11867         object to override a kept COMDAT group from a plugin object.
11868
11869 2008-12-09  Ian Lance Taylor  <iant@google.com>
11870
11871         PR 7088
11872         * yyscript.y (file_cmd): Handle INPUT.
11873
11874         * testsuite/initpri1.c: Change all declarations to be full
11875         prototypes by adding void, to avoid compiler warnings.
11876
11877 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11878
11879         * options.cc (General_options::parse_plugin_opt): New.
11880         (General_options::add_plugin): The argument now is just the filename.
11881         (General_options::add_plugin_option): New.
11882         * options.h (plugin_opt): New.
11883         (add_plugin): Change argument name.
11884         (add_plugin_option): New.
11885         * plugin.cc (Plugin::load): Don't parse the plugin option.
11886         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11887         (Plugin::add_option): New.
11888         (Plugin::args_): Change type.
11889         (Plugin::filename_): New.
11890         (Plugin_manager::add_plugin_option): New.
11891         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11892         * testsuite/Makefile.in: Regenerate.
11893
11894 2008-12-05  Cary Coutant  <ccoutant@google.com>
11895
11896         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11897         Handle --strip-lto-sections option.
11898         * options.h (strip_lto_sections): New option.
11899
11900 2008-12-01  Cary Coutant  <ccoutant@google.com>
11901
11902         * plugin.cc (ld_plugin_message): Change format parameter to const.
11903         Fix mismatch between new[] and delete.
11904
11905 2008-11-14  Cary Coutant  <ccoutant@google.com>
11906
11907         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11908         instead of -1U.
11909
11910 2008-11-05  Craig Silverstein  <csilvers@google.com>
11911
11912         * options.cc (General_options::parse_dynamic_list): New function.
11913         * options.h (General_options): New flags dynamic_list,
11914         dynamic_list_data, dynamic_list_cpp_new, and
11915         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11916         (General_options::in_dynamic_list): New function.
11917         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11918         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11919         (Lex::can_continue_name): Likewise.
11920         (yylex): Likewise.
11921         (read_script_file): New parameter script_options.
11922         (read_dynamic_list): New function.
11923         (Script_options::define_dynamic_list): New function.
11924         (dynamic_list_keyword_parsecodes): New variable.
11925         (dynamic_list_keywords): New variable.
11926         * script.h (Script_options::define_dynamic_list): New function
11927         prototype.
11928         (read_dynamic_list): New function prototype.
11929         * symtab.cc (strprefix): New macro.
11930         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11931         dynamic_list_data, dynamic_list_cpp_new, and
11932         dynamic_list_cpp_typeinfo.
11933         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11934         (dynamic_list_expr): New rule.
11935         (dynamic_list_nodes): Likewise.
11936         (dynamic_list_node): Likewise.
11937         * testsuite/Makefile.am (dynamic_list): New test.
11938         * testsuite/Makefile.in: Regenerated.
11939         * testsuite/dynamic_list.t: New file.
11940         * testsuite/dynamic_list.sh: New file.
11941
11942 2008-11-05  Craig Silverstein  <csilvers@google.com>
11943
11944         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11945         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11946         (t11_last): Likewise.
11947         * testsuite/ver_test_6.c (main): Likewise.
11948
11949 2008-10-07  Cary Coutant  <ccoutant@google.com>
11950
11951         * options.c (General_options::finalize): Add check for -static and
11952         -shared.
11953         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11954         is not empty.
11955
11956 2008-10-02  Cary Coutant  <ccoutant@google.com>
11957
11958         * plugin.cc (make_sized_plugin_object): Fix conditional
11959         compilation to work when not all targets are enabled.
11960
11961 2008-09-29  Cary Coutant  <ccoutant@google.com>
11962
11963         * archive.cc (Archive::get_file_and_offset): Use filename instead
11964         of name to get library path.
11965         (Archive::include_member): Unlock external member of a thin archive.
11966
11967         * testsuite/Makefile.am (TEST_AR): New variable.
11968         (thin_archive_test_1): New test.
11969         (thin_archive_test_2): New test.
11970         * testsuite/Makefile.in: Regenerate.
11971         * testsuite/thin_archive_main.cc: New file.
11972         * testsuite/thin_archive_test_1.cc: New file.
11973         * testsuite/thin_archive_test_2.cc: New file.
11974         * testsuite/thin_archive_test_3.cc: New file.
11975         * testsuite/thin_archive_test_4.cc: New file.
11976
11977 2008-09-29  Cary Coutant  <ccoutant@google.com>
11978
11979         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
11980         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
11981         instead of -1U.
11982         (Sized_relobj::do_finalize_local_symbols): Likewise.
11983         (Sized_relobj::map_to_kept_section): Likewise.
11984         * object.h (Sized_relobj::invalid_address): New constant.
11985         (Sized_relobj::do_output_section_offset): Check for invalid_address
11986         and return -1ULL.
11987         * output.cc (Output_reloc::local_section_offset): Use constant
11988         invalid_address instead of -1U.
11989         (Output_reloc::get_address): Likewise.
11990         (Output_section::output_address): Change -1U to -1ULL.
11991         * output.h (Output_reloc::invalid_address): New constant.
11992         * reloc.cc (Sized_relobj::write_sections): Use constant
11993         invalid_address instead of -1U.
11994         (Sized_relobj::relocate_sections): Likewise.
11995         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
11996         values for merge sections.
11997         * target-reloc.h (relocate_for_relocatable): Use constant
11998         invalid_address instead of -1U.
11999
12000 2008-09-19  Cary Coutant  <ccoutant@google.com>
12001
12002         Add plugin functionality for link-time optimization (LTO).
12003         * configure.ac (plugins): Add --enable-plugins option.
12004         * configure: Regenerate.
12005         * config.in: Regenerate.
12006         * Makefile.am (LIBDL): New variable.
12007         (CCFILES): Add plugin.cc.
12008         (HFILES): Add plugin.h.
12009         (ldadd_var): Add LIBDL.
12010         * Makefile.in: Regenerate.
12011
12012         * archive.cc: Include "plugin.h".
12013         (Archive::setup): Don't preread archive symbols when using a plugin.
12014         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12015         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12016         files.
12017         (Archive::include_member): Add symbols from plugin objects.
12018         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12019         * descriptors.cc (Descriptors::open): Check for file descriptors
12020         abandoned by plugins.
12021         (Descriptors::claim_for_plugin): New function.
12022         * descriptors.h (Descriptors::claim_for_plugin): New function.
12023         (Open_descriptor::is_claimed): New field.
12024         (claim_descriptor_for_plugin): New function.
12025         * fileread.cc (File_read::claim_for_plugin): New function.
12026         * fileread.h (File_read::claim_for_plugin): New function.
12027         (File_read::descriptor): New function.
12028         * gold.cc: Include "plugin.h".
12029         (queue_initial_tasks): Add task to call plugin hooks for generating
12030         new object files.
12031         * main.cc: Include "plugin.h".
12032         (main): Load plugin libraries.
12033         * object.h (Pluginobj): Declare.
12034         (Object::pluginobj): New function.
12035         (Object::do_pluginobj): New function.
12036         (Object::set_target): New function.
12037         * options.cc: Include "plugin.h".
12038         (General_options::parse_plugin): New function.
12039         (General_options::General_options): Initialize plugins_ field.
12040         (General_options::add_plugin): New function.
12041         * options.h (Plugin_manager): Declare.
12042         (General_options): Add --plugin option.
12043         (General_options::has_plugins): New function.
12044         (General_options::plugins): New function.
12045         (General_options::add_plugin): New function.
12046         (General_options::plugins_): New field.
12047         * plugin.cc: New file.
12048         * plugin.h: New file.
12049         * readsyms.cc: Include "plugin.h".
12050         (Read_symbols::do_read_symbols): Check for archive before checking
12051         for ELF file.  Call plugin hooks to claim files.
12052         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12053         from a real object file; force override when processing replacement
12054         files.
12055         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12056         (Symbol::init_base_object): Likewise.
12057         (Symbol::init_base_output_data): Likewise.
12058         (Symbol::init_base_output_segment): Likewise.
12059         (Symbol::init_base_constant): Likewise.
12060         (Symbol::init_base_undefined): Likewise.
12061         (Symbol::output_section): Assert that object is not a plugin.
12062         (Symbol_table::add_from_pluginobj): New function.
12063         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12064         undefined.
12065         (Symbol_table::sized_write_globals): Likewise.
12066         (Symbol_table::add_from_pluginobj): Instantiate template.
12067         * symtab.h (Sized_pluginobj): Declare.
12068         (Symbol::in_real_elf): New function.
12069         (Symbol::set_in_real_elf): New function.
12070         (Symbol::in_real_elf_): New field.
12071         (Symbol_table::add_from_pluginobj): New function.
12072
12073         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12074         (LIBDL): New variable.
12075         (LDADD): Add LIBDL.
12076         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12077         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12078         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12079         (MOSTLYCLEANFILES): Likewise.
12080         * testsuite/Makefile.in: Regenerate.
12081         * testsuite/plugin_test.c: New file.
12082         * testsuite/plugin_test_1.sh: New file.
12083         * testsuite/plugin_test_2.sh: New file.
12084
12085 2008-09-16  Ian Lance Taylor  <iant@google.com>
12086
12087         * target-reloc.h (relocate_section): Check whether a symbol is
12088         defined by the ABI before reporting an undefined symbol error.
12089         * target.h (Target::is_defined_by_abi): Make parameter const.
12090         (Target::do_is_defined_by_abi): Likewise.
12091         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12092         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12093         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12094         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12095         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12096         * testsuite/Makefile.in: Rebuild.
12097
12098         * fileread.cc (make_view): Add casts to avoid warning.
12099
12100 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12101
12102         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12103         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12104
12105 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12106
12107         * options.h (General_options::output_is_executable): New.
12108         (General_options::output_is_pie): New.
12109         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12110         for shared libraries.
12111         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12112
12113 2008-09-11  Chris Demetriou  <cgd@google.com>
12114
12115         * options.h (origin): New -z option.
12116         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12117         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12118         in DT_FLAGS_1.
12119
12120 2008-09-05  Cary Coutant  <ccoutant@google.com>
12121
12122         * fileread.cc (File_read::make_view): Add check for attempt to map
12123         beyond end of file.
12124
12125 2008-09-05  Cary Coutant  <ccoutant@google.com>
12126
12127         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12128         explicit instantiations.
12129
12130 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12131
12132         PR gold/6858
12133         * options.cc (General_options::finalize): Allow undefined symbols
12134         in shlibs if linking -shared.
12135
12136         PR gold/6859
12137         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12138         symbols as not needing a dynsym entry.
12139
12140 2008-08-20  Craig Silverstein  <csilvers@google.com>
12141
12142         * fileread.cc (File_read::open): Do not lock the file unless it
12143         was successfully opened.
12144
12145 2008-08-14  Cary Coutant  <ccoutant@google.com>
12146
12147         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12148         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12149         * testsuite/tls_test.cc (struct int128): 128-bit struct
12150         for testing TLS relocs with non-zero addend.
12151         (v12): New TLS variable.
12152         (t12): New test.
12153         (t_last): Add check for v12.
12154         * testsuite/tls_test.h (t12): New function.
12155         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12156
12157 2008-08-13  Ian Lance Taylor  <iant@google.com>
12158
12159         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12160         set tls_segment_ or relro_segment_.
12161         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12162         when appropriate.
12163         * output.h (Output_section::clear_is_relro): New function.
12164         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12165         sections specially even when output_data_ is empty.
12166         (Output_segment::maximum_alignment): When first section is relro,
12167         only force alignment for PT_LOAD segments.
12168         * script.cc (script_data_segment_align): New function.
12169         (script_data_segment_relro_end): New function.
12170         * script-c.h (script_data_segment_align): Declare.
12171         (script_data_segment_relro_end): Declare.
12172         * script-sections.h (class Script_sections): Declare
12173         data_segment_align and data_segment_relro_end.  Add fields
12174         segment_align_index_ and saw_relro_end_.
12175         * script-sections.cc (class Sections_element): Add set_is_relro
12176         virtual function.  Add new bool* parameter to place_orphan_here.
12177         Add get_output_section virtual function.
12178         (class Output_section_definition): Add set_is_relro.  Add new
12179         bool* parameter to place_orphan_here.  Add get_output_section.
12180         Add is_relro_ field.
12181         (Output_section_definition::Output_section_definition): Initialize
12182         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12183         and is_relro_ fields.
12184         (Output_section_definition::place_orphan_here): Add is_relro
12185         parameter.
12186         (Output_section_definition::set_section_addresses): Set relro for
12187         output section.
12188         (Output_section_definition::alternate_constraint): Likewise.
12189         (class Orphan_output_section): Add new bool* parameter to
12190         place_orphan_here.  Add get_output_section.
12191         (Orphan_output_section::place_orphan_here): Add is_relro
12192         parameter.
12193         (Script_sections::Script_sections): Initialize
12194         data_segment_align_index_ and saw_relro_end_.
12195         (Script_sections::data_segment_align): New function.
12196         (Script_sections::data_segment_relro_end): New function.
12197         (Script_sections::place_orphan): Set or clear is_relro.
12198         (Script_sections::set_section_addresses): Force alignment of first
12199         TLS section.
12200         * yyscript.y (exp): Call script_data_segment_align and
12201         script_data_segment_relro_end.
12202         * testsuite/relro_script_test.t: New file.
12203         * testsuite/relro_test.cc (using_script): Declare.
12204         (t1, t2): Test using_script.
12205         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12206         (relro_script_test_SOURCES): Define.
12207         (relro_script_test_DEPENDENCIES): Define.
12208         (relro_script_test_LDFLAGS): Define.
12209         (relro_script_test_LDADD): Define.
12210         (relro_script_test.so): New target.
12211         * testsuite/Makefile.in: Rebuild.
12212
12213 2008-08-06  Cary Coutant <ccoutant@google.com>
12214
12215         * archive.cc (Archive::total_archives, Archive::total_members)
12216         (Archive::total_members_loaded): New variables.
12217         (Archive::setup): Add parameter.  Add option to preread
12218         archive symbols.
12219         (Archive::read_armap): Add counter.
12220         (Archive::get_file_and_offset): New function.
12221         (Archive::get_elf_object_for_member): New function.
12222         (Archive::read_all_symbols): New function.
12223         (Archive::read_symbols): New function.
12224         (Archive::add_symbols): Add counters.
12225         (Archive::include_all_members): Use armap to find members if it's
12226         already built.
12227         (Archive::include_member): Skip reading symbols if already read.
12228         Factored code into Archive::get_file_and_offset and
12229         Archive::get_elf_object_for_member.  Changed call to
12230         Mapfile::report_include_archive_member.
12231         (Archive::print_stats): New function.
12232         * archive.h: Declare Object and Read_symbols_data classes.
12233         (Archive::Archive): Add initializers for new members.
12234         (Archive::setup): Add parameter.
12235         (Archive::print_stats): New function.
12236         (Archive::total_archives, Archive::total_members)
12237         (Archive::total_members_loaded): New variables.
12238         (Archive::get_file_and_offset): New function.
12239         (Archive::get_elf_object_for_member): New function.
12240         (Archive::read_all_symbols): New function.
12241         (Archive::read_symbols): New function.
12242         (Archive::Archive_member): New class.
12243         (Archive::members_): New member.
12244         (Archive::num_members_): New member.
12245         * main.cc: Include archive.h.
12246         (main): Call Archive::print_stats.
12247         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12248         archive parameter; member_name is now the fully-decorated name.
12249         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12250         * options.h: (General_options): Add --preread-archive-symbols option.
12251         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12252         Archive::setup.
12253
12254 2008-08-04  Ian Lance Taylor  <iant@google.com>
12255
12256         * symtab.h (Symbol::use_plt_offset): New function.
12257         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12258         * powerpc.cc (Relocate::relocate): Likewise.
12259         * sparc.cc (Relocate::relocate): Likewise.
12260         * x86_64.cc (Relocate::relocate): Likewise.
12261         * testsuite/weak_plt.sh: New test.
12262         * testsuite/weak_plt_main.cc: New test.
12263         * testsuite/weak_plt_shared.cc: New test.
12264         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12265         (check_PROGRAMS): Add weak_plt.
12266         (check_DATA): Add weak_plt_shared.so.
12267         (weak_plt_main_pic.o, weak_plt): New targets.
12268         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12269         * testsuite/Makefile.in: Rebuild.
12270
12271         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12272         gcctestdir/ld.
12273         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12274         * testsuite/Makefile.in: Rebuild.
12275
12276 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12277
12278         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12279         * Makefile.in: Regenerate.
12280         * po/POTFILES.in: Regenerate.
12281
12282 2008-07-29  Ian Lance Taylor  <iant@google.com>
12283
12284         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12285         symbols before other symbols.
12286         * testsuite/script_test_2.cc (test_addr): Declare.
12287         (test_addr_alias): Declare.
12288         (main): Check that test_addr and test_addr_alias have the right
12289         values.
12290         * testsuite/script_test_2.t: Define test_addr_alias and
12291         test_addr.
12292
12293 2008-07-24  Ian Lance Taylor  <iant@google.com>
12294
12295         PR 5990
12296         * descriptors.cc: New file.
12297         * descriptors.h: New file.
12298         * gold-threads.h (class Hold_optional_lock): New class.
12299         * fileread.cc: Include "descriptors.h".
12300         (File_read::~File_read): Release descriptor rather than closing
12301         it.
12302         (File_read::open) [file]: Call open_descriptor rather than open.
12303         Set is_descriptor_opened_.
12304         (File_read::open) [memory]: Assert that descriptor is not open.
12305         (File_read::reopen_descriptor): New function.
12306         (File_read::release): Release descriptor.
12307         (File_read::do_read): Make non-const.  Reopen descriptor.
12308         (File_read::read): Make non-const.
12309         (File_read::make_view): Reopen descriptor.
12310         (File_read::do_readv): Likewise.
12311         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12312         Update declarations.
12313         * layout.cc: Include "descriptors.h".
12314         (Layout::create_build_id): Use open_descriptor rather than open.
12315         * output.cc: Include "descriptors.h".
12316         (Output_file::open): Use open_descriptor rather than open.
12317         * archive.cc (Archive::const_iterator): Change Archive to be
12318         non-const.
12319         (Archive::begin, Archive::end): Make non-const.
12320         (Archive::count_members): Likewise.
12321         * archive.h (class Archive): Update declarations.
12322         * object.h (Object::read): Make non-const.
12323         * Makefile.am (CCFILES): Add descriptors.cc.
12324         (HFILES): Add descriptors.h.
12325         * Makefile.in: Rebuild.
12326
12327         PR 6716
12328         * gold.h: Always include <clocale>.  Add Solaris workarounds
12329         following code in binutils/sysdep.h.
12330
12331         PR 6048
12332         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12333         this->eh_frame_hdr_ is NULL before using it.
12334
12335         * dynobj.cc (Versions::Versions): Update comment.
12336
12337         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12338         the base version name.
12339
12340         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12341         array size plus one.
12342         (Stringpool_template::set_string_offsets): Subtract one from key
12343         before using it as an array index.
12344         (Stringpool_template::get_offset_with_length): Likewise.
12345         (Stringpool_template::write_to_buffer): Likewise.
12346         * stringpool.h (Stringpool_template::get_offset_from_key):
12347         Likewise.
12348
12349 2008-07-23  Ian Lance Taylor  <iant@google.com>
12350
12351         PR 6658
12352         * object.h (Merged_symbol_value::value): Do our best to handle a
12353         negative addend.
12354
12355         PR 6647
12356         * script.cc (Version_script_info::get_versions): Don't add empty
12357         version tag to return value.
12358         (Version_script_info::get_symbol_version_helper): Change return
12359         type to bool.  Add pversion parameter.  Change all callers.
12360         (script_register_vers_node): Don't require a non-NULL tag.
12361         * script.h (class Version_script_info): Update declarations.
12362         (Version_script_info::get_symbol_version): Change return type to
12363         bool.  Add version parameter.  Change all callers.
12364         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12365         handling.  Handle an empty version from a version script.
12366         (Symbol_table::define_special_symbol): Likewise.
12367         * testsuite/ver_test_10.script: New file.
12368         * testsuite/ver_test_10.sh: New file.
12369         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12370         (check_DATA): Add ver_test_10.syms.
12371         (ver_test_10.syms, ver_test_10.so): New target.
12372         * testsuite/Makefile.in: Rebuild.
12373
12374 2008-07-23  Simon Baldwin  <simonb@google.com>
12375
12376         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12377         to zero for undefined symbols from dynamic libraries.
12378
12379 2008-07-23  Ian Lance Taylor  <iant@google.com>
12380
12381         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12382         Change all callers.
12383         * symtab.h (class Symbol_table): Update declaration.
12384         * testsuite/ver_test_9.cc: New file.
12385         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12386         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12387         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12388         (ver_test_9.so, ver_test_9.o): New targets.
12389         * testsuite/Makefile.in: Rebuild.
12390
12391 2008-07-22  Ian Lance Taylor  <iant@google.com>
12392
12393         * options.h (class General_options): Define --check-sections.
12394         * layout.cc (Layout::set_segment_offsets): Handle
12395         --check-sections.
12396
12397         * options.h (class General_options): Define -n/--nmagic and
12398         -N/--omagic.
12399         * options.cc (General_options::finalize): For -n/--nmagic or
12400         -N/--omagic, set -static.
12401         * layout.cc (Layout::attach_allocated_section_to_segment): If
12402         -N/--omagic, don't put read-only and read-write sections in
12403         different segments.
12404         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12405         finding a read-only segment.
12406         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12407         don't set the minimum segment alignment to the common page size,
12408         and don't set the file offset to the address modulo the page size.
12409         * script-sections.cc (Script_sections::create_segments): If
12410         -n/--omagic, don't put read-only and read-write sections in
12411         different segments.
12412
12413         * cref.cc: New file.
12414         * cref.h: New file.
12415         * options.h (class General_options): Add --print-symbol-counts.
12416         * main.cc (main): Issue defined symbol report if requested.
12417         * archive.cc (Archive::interpret_header): Make into a const member
12418         function.
12419         (Archive::add_symbols): Call Input_objects::archive_start and
12420         archive_stop.
12421         (Archive::const_iterator): Define new class.
12422         (Archive::begin, Archive::end): New functions.
12423         (Archive::include_all_members): Rewrite to use iterator.
12424         (Archive::count_members): New function.
12425         * archive.h (class Archive): Update declarations.
12426         (Archive::filename): New function.
12427         * object.cc: Include "cref.h".
12428         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12429         (Sized_relobj::do_get_global_symbol_counts): New function.
12430         (Input_objects::add_object): Add object to cross-referencer.
12431         (Input_objects::archive_start): New function.
12432         (Input_objects::archive_stop): New function.
12433         (Input_objects::print_symbol_counts): New function.
12434         * object.h: Declare Cref and Archive.
12435         (Object::get_global_symbol_counts): New function.
12436         (Object::do_get_global_symbol_counts): New pure virtual function.
12437         (class Sized_relobj): Add defined_count_ field.  Update
12438         declarations.
12439         (class Input_objects): Add cref_ field.  Update constructor.
12440         Update declarations.
12441         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12442         defined_count_.
12443         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12444         symbol counts.
12445         (Sized_dynobj::do_get_global_symbol_counts): New function.
12446         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12447         defined_count_.  Update declarations.  Define Symbols typedef.
12448         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12449         parameter.  Change all callers.
12450         (Symbol_table::add_from_dynobj): Add sympointers and defined
12451         parameters.  Change all callers.
12452         * symtab.h (class Symbol_table): Update declarations.
12453         * Makefile.am (CCFILES): Add cref.cc.
12454         (HFILES): Add cref.h.
12455         * Makefile.in: Rebuild.
12456
12457 2008-07-22  Simon Baldwin  <simonb@google.com>
12458
12459         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12460         to zero when writing undefined symbols.
12461
12462 2008-07-22  Ian Lance Taylor  <iant@google.com>
12463
12464         * output.cc (Output_section::add_input_section): Don't try to
12465         merge empty merge sections.
12466
12467 2008-07-21  Craig Silverstein  <csilvers@google.com>
12468
12469         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12470         Include symbol version in error message.
12471
12472 2008-07-20  Chris Demetriou  <cgd@google.com>
12473
12474         * configure.ac (gold_cv_c_random_seed): New configured variable.
12475         (RANDOM_SEED_CFLAGS): New substituted variable.
12476         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12477         * configure: Rebuild.
12478         * Makefile.in: Likewise.
12479         * testsuite/Makefile.in: Likewise.
12480
12481 2008-07-18  Ian Lance Taylor  <iant@google.com>
12482
12483         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12484         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12485         * testsuite/ver_test_main.cc (main): Call t4.
12486         (t4, t4_2a): Define.
12487         * testsuite/ver_test_2.cc (t4_2): Define.
12488         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12489         * testsuite/ver_test_4.cc (t4_2a): Define.
12490         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12491         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12492
12493 2008-07-17  Ian Lance Taylor  <iant@google.com>
12494
12495         * dynobj.cc (Versions::add_def): If we give an error about a
12496         missing version, go ahead and create the version anyhow.
12497
12498 2008-07-10  Ian Lance Taylor  <iant@google.com>
12499
12500         Handle output sections with more than 0x7fffffff bytes.
12501         * object.h (class Relobj): Change map_to_output_ to
12502         output_sections_, and just keep a section pointer.  Change all
12503         uses.  Move comdat group support to Sized_relobj.
12504         (Relobj::is_section_specially_mapped): Remove.
12505         (Relobj::output_section): Remove poff parameter.  Change all
12506         callers.
12507         (Relobj::output_section_offset): New function.
12508         (Relobj::set_section_offset): Rewrite.
12509         (Relobj::map_to_output): Remove.
12510         (Relobj::output_sections): New function.
12511         (Relobj::do_output_section_offset): New pure virtual function.
12512         (Relobj::do_set_section_offset): Likewise.
12513         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12514         group support from Relobj.  Update declarations.
12515         (Sized_relobj::get_output_section_offset): New function.
12516         (Sized_relobj::do_output_section_offset): New function.
12517         (Sized_relobj::do_set_section_offset): New function.
12518         * object.cc (Relobj::output_section_address): Remove.
12519         (Sized_relobj::Sized_relobj): Initialize new fields.
12520         (Sized_relobj::include_section_group): Cast find_kept_object to
12521         Sized_relobj.
12522         (Sized_relobj::include_linkonce_section): Likewise.
12523         (Sized_relobj::do_layout): Use separate arrays for output section
12524         and output offset.
12525         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12526         output_sections.
12527         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12528         output_sections and section_offsets.
12529         (Sized_relobj::write_local_symbols): Likewise.
12530         (map_to_kept_section): Compute output address directly.
12531         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12532         output_sections and section_offsets.
12533         (Sized_relobj::write_sections): Likewise.
12534         (Sized_relobj::relocate_sections): Likewise.
12535         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12536         * output.h (class Output_reloc): Update declarations.  Change
12537         u2_.relobj to Sized_relobj*.
12538         (class Output_data_reloc): Change add functions to use
12539         Sized_relobj*.
12540         * output.cc (Output_reloc::Output_reloc): Change relobj to
12541         Sized_relobj*.
12542         (Output_reloc::local_section_offset): Change return type to
12543         Elf_Addr.  Use get_output_section_offset.
12544         (Output_reloc::get_address): Likewise.
12545         (Output_section::is_input_address_mapped): Don't call
12546         is_section_specially_mapped.
12547         (Output_section::output_offset): Likewise.
12548         (Output_section::output_address): Likewise.
12549         (Output_section::starting_output_address): Likewise.
12550         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12551         parameter to Sized_relobj*.
12552         (Copy_relocs::need_copy_reloc): Likewise.
12553         (Copy_relocs::save): Likewise.
12554         * copy-relocs.h (class Copy_relocs): Update declarations.
12555         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12556         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12557         * target-reloc.h (relocate_for_relocatable): Change
12558         offset_in_output_section type to Elf_Addr.  Change code that uses
12559         it as well.
12560         * layout.cc (Layout::layout): Always set *off.
12561         * mapfile.cc (Mapfile::print_input_section): Use
12562         output_section_offset.
12563         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12564         Sized_relobj*.
12565         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12566         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12567         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12568
12569 2008-07-03  Ian Lance Taylor  <iant@google.com>
12570
12571         * layout.cc (Layout::include_section): Do not discard unrecognized
12572         SHT_STRTAB sections.
12573
12574 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12575
12576         * script.cc (Lex::can_continue_name): Make '?' allowable in
12577         version-script names.
12578         * testsuite/version_script.map: Change glob pattern to use '?'
12579
12580 2008-06-30  Manish Singh  <yosh@gimp.org>
12581
12582         PR 6585
12583         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12584         Correct typo.
12585
12586 2008-06-30  Ian Lance Taylor  <iant@google.com>
12587
12588         PR 6660
12589         PR 6682
12590         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12591         versions]: Don't try to read the value in the contents, since we
12592         don't use it.  Use the template endianness when writing.
12593
12594 2008-06-25  Cary Coutant  <ccoutant@google.com>
12595
12596         * fileread.cc (File_read::make_view): Assert on zero-length view.
12597         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12598         symbol table when there are no symbols to read.
12599
12600 2008-06-23  Craig Silverstein  <csilvers@google.com>
12601
12602         * version.cc (version_string): Bump to 1.7
12603
12604 2008-06-18  Craig Silverstein  <csilvers@google.com>
12605
12606         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12607         constant 0xFFFF to type Valtype.
12608         (Powerpc_relocate_functions::rel16_ha): Likewise.
12609
12610 2008-06-17  Ian Lance Taylor  <iant@google.com>
12611
12612         * output.h (Output_section::Input_section): Initialize p2align_ to
12613         zero for Output_section_data constructors.
12614         (Output_section::Input_section::addralign): If not an input
12615         section, return the alignment of the Output_section_data.
12616         * testsuite/copy_test.cc: New file.
12617         * testsuite/copy_test_1.cc: New file.
12618         * testsuite/copy_test_2.cc: New file.
12619         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12620         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12621         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12622         (copy_test_1_pic.o, copy_test_1.so): New targets.
12623         (copy_test_2_pic.o, copy_test_2.so): New targets.
12624         * testsuite/Makefile.in: Rebuild.
12625
12626         * script-sections.cc (Script_sections::place_orphan): Initialize
12627         local variable exact.
12628
12629 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12630
12631         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12632
12633 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12634             David S. Miller  <davem@davemloft.net>
12635
12636         * powerpc.cc: New file.
12637         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12638         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12639         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12640         * Makefile.in: Rebuild.
12641
12642 2008-06-09  Ian Lance Taylor  <iant@google.com>
12643
12644         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12645         <exception>.
12646         (throwing, orig_terminate): New static variables.
12647         (terminate_handler): New static function.
12648         (t2): Set terminate handler.
12649
12650 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12651
12652         PR 6584
12653         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12654         alignment.
12655
12656 2008-05-30  Cary Coutant  <ccoutant@google.com>
12657
12658         * archive.cc (Archive::include_all_members) Correct to step
12659         over symbol table and extended name table in thin archives.
12660
12661 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12662
12663         PR 6407
12664         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12665         calculation.
12666
12667 2008-05-28  Caleb Howe  <cshowe@google.com>
12668
12669         * reduced_debug_output.cc: New file.
12670         * reduced_debug_output.h: New file.
12671         * options.h (class General_options): Add --strip-debug-non-line.
12672         * options.cc (General_options::finalize): Add strip_debug_non_line
12673         to the strip heirarchy.
12674         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12675         fields.
12676         * layout.cc: Include "reduced_debug_output.h".
12677         (Layout::Layout): Initialize new fields.
12678         (line_only_debug_sections): New static array.
12679         (is_lines_only_debug_sections): New static inline function.
12680         (Layout::include_section): Handle --strip-debug-non-line.
12681         (Layout::make_output_section): If --strip-debug-non-line, build
12682         new output sections for .debug_abbrev and .debug_info.
12683         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12684         gold.  Warn about possible overflow.
12685         (read_signed_LEB_128): Likewise.
12686         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12687         (read_signed_LEB_128): Declare.
12688         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12689         (HFILES): Add reduced_debug_output.h.
12690         * Makefile.in: Rebuild.
12691
12692 2008-05-21  Ian Lance Taylor  <iant@google.com>
12693
12694         * mapfile.cc: New file.
12695         * mapfile.h: New file.
12696         * options.h (class General_options): Add -M/--print-map and -Map.
12697         * options.cc (General_options::finalize): Make -M equivalent to
12698         -Map -.
12699         * main.cc: Include <cstdio> and "mapfile.h".
12700         (main): Open mapfile if requested.
12701         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12702         constructor.  Change caller.
12703         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12704         (queue_middle_tasks): Likewise.
12705         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12706         declarations.
12707         * archive.cc: Include "mapfile.h".
12708         (Archive::add_symbols): Add mapfile parameter.  Change all
12709         callers.  Pass mapfile, symbol, and reason to include_member.
12710         (Archive::include_all_members): Add mapfile parameter.  Change all
12711         callers.
12712         (Archive::include_member): Add mapfile, sym, and why parameters.
12713         Change all callers.  Report inclusion to map file.
12714         * archive.h: Include "fileread.h".
12715         (class Archive): Update declarations.
12716         (Archive::file): New const method.
12717         (class Add_archive_symbols): Add mapfile_ field.  Update
12718         constructor.  Change all callers.
12719         * readsyms.h (class Read_symbols): Likewise.
12720         (class Finish_group): Likewise.
12721         (class Read_script): Likewise.
12722         * common.cc: Include "mapfile.h".
12723         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12724         all callers.
12725         (Symbol_table::do_allocate_commons): Likewise.
12726         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12727         symbol allocation to mapfile.
12728         * common.h (class Allocate_commons_task): Add mapfile_ field.
12729         Update constructor.  Change all callers.
12730         * symtab.h (class Symbol_table): Update declarations.
12731         * layout.cc: Include "mapfile.h".
12732         (Layout_task_runner::run): Print information to mapfile.
12733         (Layout::create_gold_note): Change Output_data_fixed_space to
12734         Output_data_zero_fill.
12735         (Layout::create_build_id): Likewise.
12736         (Layout::print_to_mapfile): New function.
12737         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12738         constructor.  Change caller.
12739         (class Layout): Declare print_to_mapfile.
12740         * output.cc (Output_section::Input_section::print_to_mapfile): New
12741         function.
12742         (Output_section::add_input_section): If producing a map, always
12743         add to input_sections_ list.
12744         (Output_section::do_print_to_mapfile): New function.
12745         (Output_segment::print_sections_to_mapfile): New function.
12746         (Output_segment::print_section_list_to_mapfile): New function.
12747         * output.h: Include "mapfile.h".
12748         (Output_data::print_to_mapfile): New function.
12749         (Output_data::do_print_to_mapfile): New virtual function.
12750         (Output_segment_headers::do_print_to_mapfile): New function.
12751         (Output_file_header::do_print_to_mapfile): New function.
12752         (Output_data_const::do_print_to_mapfile): New function.
12753         (class Output_data_const_buffer): Add map_name_ field.  Update
12754         constructor.  Change all callers.  Add do_print_to_mapfile
12755         function.
12756         (class Output_data_fixed_space): Likewise.
12757         (class Output_data_space): Likewise.
12758         (class Output_data_zero_fill): New class.
12759         (Output_data_strtab::do_print_to_mapfile): New function.
12760         (Output_data_reloc_base::do_print_to_mapfile): New function.
12761         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12762         (Output_data_group::do_print_to_mapfile): New function.
12763         (Output_data_got::do_print_to_mapfile): New function.
12764         (Output_data_dynamic::do_print_to_mapfile): New function.
12765         (Output_symtab_xindex::do_print_to_mapfile): New function.
12766         (class Output_section): Declare do_print_to_mapflie.  Declare
12767         print_to_mapfile in Input_section.
12768         (class Output_segment): Declare new functions.
12769         * object.h (Sized_relobj::symbol_count): New function.
12770         * script-sections.cc
12771         (Output_section_element_dot_assignment::set_section_addresses):
12772         Change Output_data_fixed_space to Output_data_zero_fill.
12773         (Output_data_expression::do_print_to_mapfile): New function.
12774         * script.cc (read_input_script): Add mapfile parameter.  Change
12775         all callers.
12776         * script.h (read_input_script): Update declaration.
12777         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12778         (Eh_frame::do_print_to_mapfile): New function.
12779         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12780         (Output_merge_string::do_print_to_mapfile): New function.
12781         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12782         function.
12783         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12784         function.
12785         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12786         function.
12787         * Makefile.am (CCFILES): Add mapfile.cc.
12788         (HFILES): Add mapfile.h.
12789         * Makefile.in: Rebuild.
12790
12791 2008-05-19  Ian Lance Taylor  <iant@google.com>
12792
12793         * options.h (class General_options): Add -z relro.
12794         * layout.cc (Layout::Layout): Initialize relro_segment_.
12795         (Layout::add_output_section_data): Return the output section.
12796         (Layout::make_output_section): Rcognize relro sections and mark
12797         them appropriately.
12798         (Layout::attach_allocated_section_to_segment): Put relro sections
12799         in a PT_GNU_RELRO segment.
12800         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12801         section as relro.
12802         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12803         PT_TLS segments.
12804         (Layout::linkonce_mapping): Map d.rel.ro.local to
12805         .data.rel.ro.local.
12806         (Layout::output_section_name): Us .data.rel.ro.local for any
12807         section which begins with that.
12808         * layout.h (class Layout): Update add_output_section_data
12809         declaration.  Add relro_segment_ field.
12810         * output.cc (Output_section::Output_section): Initialize is_relro_
12811         and is_relro_local_ fields.
12812         (Output_segment::add_output_section): Group relro sections.
12813         (Output_segment::is_first_section_relro): New function.
12814         (Output_segment::maximum_alignment): If there is a relro section,
12815         align the segment to the common page size.
12816         (Output_segment::set_section_addresses): Track whether we are
12817         looking at relro sections.  If the last section is a relro
12818         section, align to the common page size.
12819         (Output_segment::set_section_list_addresses): Add in_relro
12820         parameter.  Change all callers.  Align to the page size when
12821         moving from relro to non-relro section.
12822         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12823         segment.
12824         * output.h (class Output_section): Add is_relro_ and
12825         is_relro_local_ fields.
12826         (Output_section::is_relro): New function.
12827         (Output_section::set_is_relro): New function.
12828         (Output_section::is_relro_local): New function.
12829         (Output_section::set_is_relro_local): New function.
12830         (class Output_segment): Update declarations.
12831         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12832         * sparc.cc (Target_sparc::got_section): Likewise.
12833         * x86_64.cc (Target_x86_64::got_section): Likewise.
12834         * testsuite/relro_test_main.cc: New file.
12835         * testsuite/relro_test.cc: New file.
12836         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12837         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12838         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12839         (relro_test.so, relro_test_pic.o): New targets.
12840         * testsuite/Makefile.in: Rebuild.
12841
12842 2008-05-16  Ian Lance Taylor  <iant@google.com>
12843
12844         * output.cc (Output_segment::add_output_section): Remove front
12845         parameter.
12846         * output.h (class Output_segment): Remove
12847         add_initial_output_section and overloaded add_output_section.
12848         Update declaration of remaining add_output_section.
12849         * layout.cc (Layout::create_interp): Call add_output_section
12850         rather than add_initial_output_section.
12851         (Layout::finish_dynamic_section): Likewise.
12852
12853         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12854         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12855         know the dynamic type.
12856         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12857         field.  Initialize it in constructor.
12858         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12859         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12860         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12861         reloc.
12862
12863         * output.cc (Output_reloc::get_address): Change return type to
12864         Elf_Addr.
12865         * output.h (class Output_reloc): Update get_address declaration.
12866         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12867         for section addresses.
12868
12869 2008-05-09  Ian Lance Taylor  <iant@google.com>
12870
12871         PR 6493
12872         * gold.cc (gold_nomem): Use return value of write.
12873
12874 2008-05-08  Ian Lance Taylor  <iant@google.com>
12875
12876         * symtab.c (Symbol::init_base_output_data): Add version
12877         parameter.  Change all callers.
12878         (Symbol::init_base_output_segment): Likewise.
12879         (Symbol::init_base_constant): Likewise.
12880         (Symbol::init_base_undefined): Likewise.
12881         (Sized_symbol::init_output_data): Likewise.
12882         (Sized_symbol::init_output_segment): Likewise.
12883         (Sized_symbol::init_constant): Likewise.
12884         (Sized_symbol::init_undefined): Likewise.
12885         (Symbol_table::do_define_in_output_data): If the new symbol has a
12886         version, mark it as the default.
12887         (Symbol_table::do_define_in_output_segment): Likewise.
12888         (Symbol_table::do_define_as_constant): Likewise.
12889         * symtab.h (class Symbol): Update declarations.
12890         (class Sized_symbol): Likewise.
12891         * resolve.cc (Symbol::override_version): New function.
12892         (Symbol::override_base): Call override_version.
12893         (Symbol::override_base_with_special): Likewise.
12894         * testsuite/ver_script_8.script: New file.
12895         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12896         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12897         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12898         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12899
12900 2008-05-06  Ian Lance Taylor  <iant@google.com>
12901
12902         PR 6049
12903         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12904         functions.
12905         (class General_options): Remove existing --undefined, and add
12906         --no-undefined instead.  Add new --undefined as synonym for -u.
12907         * archive.cc (Archive::add_symbols): Check whether symbol was
12908         named with -u.
12909         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12910         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12911         all uses.  Add IS_UNDEFINED.  Update declarations to split
12912         different versions of init_base.  Declare init_base_undefined.
12913         (Symbol::is_defined): Handle IS_UNDEFINED.
12914         (Symbol::is_undefined): Likewise.
12915         (Symbol::is_weak_undefined): Call is_undefined.
12916         (Symbol::is_absolute): Handle IS_CONSTANT.
12917         (class Sized_symbol): Update declarations to split different
12918         versions of init.  Declare init_undefined.
12919         (class Symbol_table): Declare new functions.
12920         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12921         Change all callers.
12922         (Symbol::init_base_output_data): Likewise.
12923         (Symbol::init_base_output_segment): Likewise.
12924         (Symbol::init_base_constant): Likewise.
12925         (Symbol::init_base_undefined): New function.
12926         (Sized_symbol::init_object): Rename from init.  Change all
12927         callers.
12928         (Sized_symbol::init_output_data): Likewise.
12929         (Sized_symbol::init_output_segment): Likewise.
12930         (Sized_symbol::init_constant): Likewise.
12931         (Sized_symbol::init_undefined): New function.
12932         (Symbol_table::add_undefined_symbols_from_command_line): New
12933         function.
12934         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12935         function.
12936         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12937         (Symbol::output_section): Likewise.
12938         (Symbol::set_output_section): Likewise.
12939         (Symbol_table::sized_finalize_symbol): Likewise.
12940         (Symbol_table::sized_write_globals): Likewise.
12941         * resolve.cc (Symbol_table::should_override): Likewise.
12942         (Symbol::override_base_with_special): Likewise.
12943
12944         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12945         symbol, change it to have default visibility.
12946         * testsuite/protected_1.cc: New file.
12947         * testsuite/protected_2.cc: New file.
12948         * testsuite/protected_3.cc: New file.
12949         * testsuite/protected_main_1.cc: New file.
12950         * testsuite/protected_main_2.cc: New file.
12951         * testsuite/protected_main_3.cc: New file.
12952         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12953         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12954         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12955         (protected_1.so): New target.
12956         (protected_1_pic.o, protected_2_pic.o): New targets.
12957         (protected_3_pic.o): New target.
12958         (check_PROGRAMS): Add protected_2.
12959         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12960         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12961         * testsuite/Makefile.in: Rebuild.
12962
12963         * options.h (DEFINE_var): Add set_user_set_##varname__.
12964         (DEFINE_bool_alias): New macro.
12965         (class General_options): Define -Bstatic using DEFINE_bool_alias
12966         rather than DEFINE_special.  Add --undefined as an alias for -z
12967         defs.
12968         * options.cc (General_options::parse_Bstatic): Remove.
12969
12970         * options.h (class General_options): Add --fatal-warnings.
12971         * main.cc (main): Implement --fatal-warnings.
12972         * errors.h (Errors::warning_count): New function.
12973
12974         * options.h (class General_options): Add -Bsymbolic-functions.
12975         * symtab.h (Symbol::is_preemptible): Check for
12976         -Bsymbolic-functions.
12977
12978 2008-05-05  Ian Lance Taylor  <iant@google.com>
12979
12980         * options.h (DEFINE_bool): For DASH_Z, create the negative option
12981         as noVARNAME rather than no-VARNAME.
12982         (class General_options): Add option -z combreloc.
12983         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
12984         get_address.
12985         (Output_reloc::sort_before) [SHT_REL]: New function.
12986         (Output_reloc::sort_before) [SHT_RELA]: New function.
12987         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
12988         Sort_relocs_comparison.
12989         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
12990         parameter.  Change all callers.
12991         (Output_data_reloc::Output_data_reloc) [both versions]: Add
12992         sort_relocs parameter.  Change all callers.
12993         * output.cc (Output_reloc::get_address): New function, broken out
12994         of write_rel.
12995         (Output_reloc::write_rel): Call it.
12996         (Output_reloc::compare): New function.
12997         (Output_data_reloc_base::do_write): Optionally sort relocs.
12998
12999         * configure.ac: If targ_extra_obj is set, link it in.
13000         * configure.tgt: Initialize all variables.
13001         (x86_64*): Set targ_extra_obj and targ_extra_size.
13002         * configure: Rebuild.
13003
13004         * object.cc (Sized_relobj::include_section_group): Adjust section
13005         indexes read from group data.  Build vector to pass to
13006         layout_group.
13007         * layout.cc (Layout::layout_group): Add flags and shndxes
13008         parameters.  Remove contents parameter.  Change caller.  Update
13009         explicit instantiations.
13010         * layout.h (class Layout): Update layout_group declaration.
13011         * output.cc (Output_data_group::Output_data_group): Add flags and
13012         input_shndxes parameters.  Remove contents parameter.  Change
13013         caller.
13014         (Output_data_group::do_write): Change input_sections_ to
13015         input_shndxes_.
13016         * output.h (class Output_data_group): Update constructor
13017         declaration.  Rename input_sections_ to input_shndxes_.
13018         * testsuite/many_sections_test.cc: Add template.
13019
13020 2008-04-30  Cary Coutant  <ccoutant@google.com>
13021
13022         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13023
13024         * layout.cc (Layout::include_section): Refactored check for debug
13025         info section.
13026         (Layout::add_comdat): Add new parameters.  Change type
13027         of signature parameter.  Add object and shndx to signatures table.
13028         (Layout::find_kept_object): New function.
13029         * layout.h: Include <cstring>.
13030         (Layout::is_debug_info_section): New function.
13031         (Layout::add_comdat): Add new parameters.
13032         (Layout::find_kept_object): New function.
13033         (Layout::Kept_section): New struct.
13034         (Layout::Signatures): Change type of map range.
13035         * object.cc (Relobj::output_section_address): New function.
13036         (Sized_relobj::include_section_group): Add new parameters.  Change
13037         calls to Layout::add_comdat.  Change to build table of kept comdat
13038         groups and table mapping discarded sections to kept sections.
13039         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13040         (Sized_relobj::do_layout): Change calls to include_section_group and
13041         include_linkonce_section.
13042         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13043         value to zero when section is discarded.
13044         (Sized_relobj::map_to_kept_section): New function.
13045         * object.h (Relobj::output_section_address): New function.
13046         (Relobj::Comdat_group): New type.
13047         (Relobj::find_comdat_group): New function.
13048         (Relobj::Comdat_group_table): New type.
13049         (Relobj::Kept_comdat_section): New type.
13050         (Relobj::Kept_comdat_section_table): New type.
13051         (Relobj::add_comdat_group): New function.
13052         (Relobj::set_kept_comdat_section): New function.
13053         (Relobj::get_kept_comdat_section): New function.
13054         (Relobj::comdat_groups_): New field.
13055         (Relobj::kept_comdat_sections_): New field.
13056         (Symbol_value::input_value): Update comment.
13057         (Sized_relobj::map_to_kept_section) New function.
13058         (Sized_relobj::include_linkonce_section): Add new parameter.
13059         * target-reloc.h (Comdat_behavior): New type.
13060         (get_comdat_behavior): New function.
13061         (relocate_section): Add code to map a discarded section to the
13062         corresponding kept section when applying a relocation.
13063
13064 2008-04-30  Craig Silverstein  <csilvers@google.com>
13065
13066         * dwarf_reader.cc (next_generation_count): New static var.
13067         (Addr2line_cache_entry): New struct.
13068         (addr2line_cache): New static var.
13069         (Dwarf_line_info::one_addr2line): Added caching.
13070         (Dwarf_line_info::clear_addr2line_cache): New function.
13071         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13072         cache-size parameter.
13073         (Dwarf_line_info::one_addr2line_cache): New function.
13074         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13075         new cache-size argument to one_addr2line(), and clear cache.
13076
13077 2008-04-28  Cary Coutant  <ccoutant@google.com>
13078
13079         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13080         R_386_PC8 relocations.
13081
13082 2008-04-23  Ian Lance Taylor  <iant@google.com>
13083
13084         * object.cc (Sized_relobj::include_section_group): Check for
13085         invalid section group.
13086
13087         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13088         header size.
13089
13090         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13091         than read for file header.
13092         * archive.cc (Archive::include_member): Likewise.
13093
13094 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13095
13096         * aclocal.m4: Regenerate.
13097         * configure: Regenerate.
13098
13099 2008-04-19  Ian Lance Taylor  <iant@google.com>
13100
13101         * version.cc (version_string): Bump to 1.6.
13102
13103         * testsuite/Makefile.am (many_sections_r_test): New target.
13104         (many_sections_r_test_SOURCES): Remove.
13105         (many_sections_r_test_DEPENDENCIES): Remove.
13106         (many_sections_r_test_LDFLAGS): Remove.
13107         (many_sections_r_test_LDADD): Remove.
13108
13109         * object.cc (Sized_relobj::do_add_symbols): Always pass
13110         local_symbol_count_ to add_from_relobj.
13111
13112         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13113         every thousand variables.
13114         * testsuite/Makefile.in: Rebuild.
13115
13116         * object.cc (Xindex::initialize_symtab_xindex): New function.
13117         (Xindex::read_symtab_xindex): New function.
13118         (Xindex::sym_xindex_to_shndx): New function.
13119         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13120         available.
13121         (Sized_relobj::do_initialize_xindex): New function.
13122         (Sized_relobj::do_read_symbols): Adjust section links.
13123         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13124         parameter.  Change all callers.
13125         (Sized_relobj::include_section_group): Adjust section links and
13126         symbol section indexes.
13127         (Sized_relobj::do_layout): Adjust section links.
13128         (Sized_relobj::do_count_local_symbols): Adjust section links and
13129         symbol section indexes.
13130         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13131         ordinary and special symbols.
13132         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13133         dynsym_xindex parameters.  Change all callers.  Adjust section
13134         links.  Use SHN_XINDEX when needed.
13135         (Sized_relobj::get_symbol_location_info): Adjust section links.
13136         Don't get fooled by special symbols.
13137         * object.h (class Xindex): Define.
13138         (class Object): Add xindex_ parameter.  Declare virtual functoin
13139         do_initialize_xindex.
13140         (Object::adjust_sym_shndx): New function.
13141         (Object::set_xindex): New protected function.
13142         (class Symbol_value): Add is_ordinary_shndx_ field.
13143         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13144         (Symbol_value::value): Assert ordinary section.
13145         (Symbol_value::initialize_input_to_output_map): Likewise.
13146         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13147         Change all callers.
13148         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13149         all callers.
13150         (class Sized_relobj): Update declarations.
13151         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13152         parameter.  Change all callers.
13153         (Sized_relobj::adjust_shndx): New function.
13154         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13155         field.
13156         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13157         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13158         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13159         (Sized_dynobj::read_dynsym_section): Adjust section links.
13160         (Sized_dynobj::read_dynamic): Likewise.
13161         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13162         section links.
13163         (Sized_dynobj::do_initialize_xindex): New function.
13164         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13165         do_initialize_xindex.
13166         (Sized_dynobj::adjust_shndx): New function.
13167         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13168         dynsym_xindex_ fields.
13169         (Layout::finalize): Add a call to set_section_indexes before
13170         creating the symtab sections.
13171         (Layout::set_section_indexes): Don't do anything if the section
13172         already has a section index.
13173         (Layout::create_symtab_sections): Add shnum parameter.  Change
13174         caller.  Create .symtab_shndx section if needed.
13175         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13176         caller.
13177         (Layout::allocated_output_section_count): New function.
13178         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13179         needed.
13180         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13181         fields.  Update declarations.
13182         (Layout::symtab_xindex): New function.
13183         (Layout::dynsym_xindex): New function.
13184         (class Write_symbols_task): Add layout_ field.
13185         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13186         Change caller.
13187         * output.cc (Output_section_headers::Output_section_headers): Add
13188         shstrtab_section parameter.  Change all callers.
13189         (Output_section_headers::do_sized_write): Store overflow values
13190         for section count and section string table section index in
13191         section header zero.
13192         (Output_file_header::do_sized_write): Check for overflow of
13193         section count and section string table section index.
13194         (Output_symtab_xindex::do_write): New function.
13195         (Output_symtab_xindex::endian_do_write): New function.
13196         * output.h (class Output_section_headers): Add shstrtab_section_.
13197         Update declarations.
13198         (class Output_symtab_xindex): Define.
13199         (Output_section::has_out_shndx): New function.
13200         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13201         field.
13202         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13203         Change all callers.
13204         (Sized_symbol::init): Likewise.
13205         (Symbol::output_section): Check for ordinary symbol.
13206         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13207         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13208         callers.
13209         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13210         Change all callers.  Simplify handling of symbols from sections
13211         not included in the link.
13212         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13213         distinction.
13214         (Weak_alias_sorter::operator()): Assert that symbols are
13215         ordinary.
13216         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13217         distinction.
13218         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13219         parameters.  Change all callers.
13220         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13221         symbol distinction.  Use SHN_XINDEX when needed.
13222         (Symbol_table::write_section_symbol): Add symtab_xindex
13223         parameter.  Change all callers.
13224         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13225         SHN_XINDEX when needed.
13226         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13227         declarations.
13228         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13229         (Symbol::is_defined): Check is_ordinary.
13230         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13231         (Symbol::is_absolute, Symbol::is_common): Likewise.
13232         (class Sized_symbol): Update declarations.
13233         (class Symbol_table): Update declarations.
13234         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13235         parameters.  Change all callers.
13236         (Sized_symbol::override): Likewise.
13237         (Symbol_table::override): Likewise.
13238         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13239         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13240         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13241         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13242         to be in an ordinary section.
13243         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13244         object and is_ordinary parameters.  Change all callers.
13245         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13246         Change all callers.  Don't add undefined or non-ordinary symbols
13247         to reloc_map_.
13248         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13249         Change all callers.
13250         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13251         declarations.
13252         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13253         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13254         (Sized_relobj::relocate_sections): Likewise.
13255         * target-reloc.h (scan_relocs): Adjust section symbol index.
13256         (scan_relocatable_relocs): Likewise.
13257         * i386.cc (Scan::local): Check for ordinary symbols.
13258         * sparc.cc (Scan::local): Likewise.
13259         * x86_64.cc (Scan::local): Likewise.
13260         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13261         to symbol_section_and_value.
13262         * testsuite/many_sections_test.cc: New file.
13263         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13264         (check_PROGRAMS): Add many_sections_test.
13265         (many_sections_test_SOURCES): Define.
13266         (many_sections_test_DEPENDENCIES): Define.
13267         (many_sections_test_LDFLAGS): Define.
13268         (BUILT_SOURCES): Add many_sections_define.h.
13269         (many_sections_define.h): New target.
13270         (BUILT_SOURCES): Add many_sections_check.h.
13271         (many_sections_check.h): New target.
13272         (check_PROGRAMS): Add many_sections_r_test.
13273         (many_sections_r_test_SOURCES): Define.
13274         (many_sections_r_test_DEPENDENCIES): Define.
13275         (many_sections_r_test_LDFLAGS): Define.
13276         (many_sections_r_test_LDADD): Define.
13277         (many_sections_r_test.o): New target.
13278         * testsuite/Makefile.in: Rebuild.
13279
13280 2008-04-17  Cary Coutant  <ccoutant@google.com>
13281
13282         * errors.cc (Errors::info): New function.
13283         (gold_info): New function.
13284         * errors.h (Errors::info): New function.
13285         * gold.h (gold_info): New function.
13286         * object.cc (Input_objects::add_object): Print trace output.
13287         * options.cc (options::parse_set): New function.
13288         (General_options::parse_wrap): Deleted.
13289         (General_options::General_options): Deleted initializer.
13290         * options.h (options::String_set): New typedef.
13291         (options::parse_set): New function.
13292         (DEFINE_set): New macro.
13293         (General_options::wrap): Changed to use DEFINE_set. Changed
13294         callers of any_wrap_symbols and is_wrap_symbol.
13295         (General_options::trace, General_options::trace_symbol):
13296         New options.
13297         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13298         (General_options::wrap_symbols_): Deleted.
13299         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13300
13301 2008-04-17  David S. Miller  <davem@davemloft.net>
13302
13303         * options.cc (General_options::parse_V): New function.
13304         * options.h: Add entries for -V and -Qy.
13305
13306 2008-04-17  Ian Lance Taylor  <iant@google.com>
13307
13308         * common.cc (Symbol_table::allocate_commons): Remove options
13309         parameter.  Change caller.
13310         (Symbol_table::do_allocate_commons): Remove options parameter.
13311         Change caller.  Just call do_allocate_commons_list twice.
13312         (Symbol_table::do_allocate_commons_list): New function, broken out
13313         of do_allocate_commons.
13314         * common.h (class Allocate_commons_task): Remove options_ field.
13315         Update constructor.
13316         * symtab.cc (Symbol_table::Symbol_table): Initialize
13317         tls_commons_.
13318         (Symbol_table::add_from_object): Put TLS common symbols on
13319         tls_commons_ list.
13320         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13321         which are IN_OUTPUT_DATA.
13322         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13323         allocate_commons and do_allocate_commons declarations.  Declare
13324         do_allocate_commons_list.
13325         * gold.cc (queue_middle_tasks): Update creation of
13326         Allocate_commons_task to not pass options.
13327         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13328         (TLS_TEST_C_FLAGS): New variable.
13329         (tls_test_c_pic.o): New target.
13330         (tls_test_shared.so): Link in tls_test_c_pic.o.
13331         (tls_test_c_pic_ie.o): New target.
13332         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13333         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13334         (tls_test_c.o): New target.
13335         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13336         (tls_pic_test_LDADD): Likewise.
13337         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13338         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13339         (tls_test_c_gnu2.o): New target.
13340         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13341         tls_test_c_gnu2.o.
13342         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13343         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13344         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13345         * testsuite/tls_test.cc: Include "config.h".
13346         (t_last): Call t11_last.
13347         * testsuite/tls_test.h (t11, t11_last): Declare.
13348         * testsuite/tls_test_c.c: New file.
13349         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13350         * configure.ac: Check for OpenMP support.
13351         * configure, config.in, Makefile.in: Rebuild.
13352         * testsuite/Makefile.in: Rebuild.
13353
13354 2008-04-16  Cary Coutant  <ccoutant@google.com>
13355
13356         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13357         (Target_i386::tls_base_symbol_defined_): New field.
13358         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13359         (Target_i386::Scan::global): Likewise.
13360         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13361         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13362         (Target_x86_64::tls_base_symbol_defined_): New field.
13363         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13364         (Target_x86_64::Scan::global): Likewise.
13365
13366 2008-04-16  Cary Coutant  <ccoutant@google.com>
13367
13368         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13369         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13370         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13371         building shared libraries.
13372         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13373         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13374         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13375         * testsuite/Makefile.in: Rebuild.
13376         * testsuite/weak_undef.h: New file.
13377         * testsuite/weak_undef_file1.cc: Add extra test cases.
13378         * testsuite/weak_undef_file2.cc: Likewise.
13379         * testsuite/weak_undef_test.cc: Likewise.
13380
13381 2008-04-16  David S. Miller  <davem@davemloft.net>
13382
13383         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13384         Add issued_non_pic_error_ field.  Declare check_non_pic.
13385         (Target_sparc::Scan::check_non_pic): New function.
13386         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13387         (Target_sparc::Scan::global): Likewise.
13388
13389         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13390         * configure: Rebuild.
13391
13392         * options.h (DEFINE_enable): New macro.
13393         (new_dtags): New enable option.
13394         (initfirst, interpose, loadfltr, nodefaultlib,
13395         nodelete, nodlopen, nodump): New -z options.
13396         * layout.cc (Layout:finish_dynamic_section): If new
13397         dtags enabled, emit DT_RUNPATH.  Also, emit a
13398         DT_FLAGS_1 containing any specified -z flags.
13399
13400 2008-04-16  Ian Lance Taylor  <iant@google.com>
13401
13402         * copy-relocs.cc: New file.
13403         * copy-relocs.h: New file.
13404         * reloc.cc: Remove Copy_relocs code.
13405         * reloc.h: Likewise.
13406         * reloc-types.h (struct Reloc_types) [both versions]: Add
13407         get_reloc_addend_noerror.
13408         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13409         variants of add_global which take an addend which must be zero.
13410         * i386.cc: Include "copy-relocs.h".
13411         (class Target_i386): Change type of copy_relocs_ to variable,
13412         update initializer.
13413         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13414         Change all callers.
13415         (Target_i386::do_finalize_sections): Change handling of
13416         copy_relocs_.
13417         * sparc.cc: Include "copy-relocs.h".
13418         (class Target_sparc): Change type of copy_relocs_ to variable,
13419         update initializer.
13420         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13421         Change all callers.
13422         (Target_sparc::do_finalize_sections): Change handling of
13423         copy_relocs_.
13424         * x86_64.cc: Include "copy-relocs.h".
13425         (class Target_x86_64): Change type of copy_relocs_ to variable,
13426         update initializer.
13427         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13428         class.  Change all callers.
13429         (Target_x86_64::do_finalize_sections): Change handling of
13430         copy_relocs_.
13431         * Makefile.am (CCFILES): Add copy-relocs.cc.
13432         (HFILES): Add copy-relocs.h.
13433
13434         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13435
13436         * testsuite/script_test_4.sh: Permit leading zeroes.
13437
13438 2008-04-15  Ian Lance Taylor  <iant@google.com>
13439
13440         * script-sections.cc (Script_sections::create_segments): Use
13441         header_size_adjustment even when there is enough room for the
13442         headers.
13443         * testsuite/script_test_4.sh: New file.
13444         * testsuite/script_test_4.t: New file.
13445         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13446         (check_DATA): Add script_test_4.stdout.
13447         (MOSTLYCLEANFILES): Likewise.
13448         (script_test_4): New target.
13449         (script_test_4.stdout): New target.
13450         * testsuite/Makefile.in: Rebuild.
13451
13452         * sparc.cc: Add definitions for Output_data_plt_sparc class
13453         constants.
13454
13455 2008-04-14  David S. Miller  <davem@davemloft.net>
13456
13457         * sparc.cc: New file.
13458         * Makefile.am (TARGETSOURCES): Add sparc.cc
13459         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13460         * configure.tgt: Document targ_extra_size and
13461         targ_extra_big_endian.  Add entries for sparc-* and
13462         sparc64-*.
13463         * configure.ac: Handle targ_extra_size and
13464         targ_extra_big_endian.
13465         * Makefile.in: Rebuild.
13466         * configure: Likewise.
13467         * po/POTFILES.in: Likewise.
13468         * po/gold.pot: Likewise.
13469
13470 2008-04-14  Ian Lance Taylor  <iant@google.com>
13471
13472         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13473         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13474         in the name/type/flags to section mapping.  Don't call
13475         allocate_output_section.
13476         (Layout::choose_output_section): Change parameter from adjust_name
13477         to is_input_section.  Don't permit input sections after sections
13478         are attached to segments.  Don't call allocate_output_section.
13479         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13480         not write_enable_output_section.
13481         (Layout::make_output_section): Don't push to
13482         unattached_section_list_ nor call attach_to_segment.  Call
13483         attach_section_to_segment if sections are attached.
13484         (Layout::attach_sections_to_segments): New function.
13485         (Layout::attach_section_to_segment): New function.
13486         (Layout::attach_allocated_section_to_segment): Rename from
13487         attach_to_segment.  Remove flags parameter.
13488         (Layout::allocate_output_section): Remove function.
13489         (Layout::write_enable_output_section): Remove function.
13490         * layout.h (class Layout): Update for above changes.  Add new
13491         field sections_are_attached_.
13492         * output.h (Output_section::update_flags_for_input_section): New
13493         function.
13494         * output.cc (Output_section::add_input_section): Call
13495         update_flags_for_input_section.
13496         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13497
13498 2008-04-11  Cary Coutant  <ccoutant@google.com>
13499
13500         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13501         thought unnecessary.
13502         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13503
13504 2008-04-11  Ian Lance Taylor  <iant@google.com>
13505
13506         * output.h (class Output_section_data): Remove inline definition
13507         of set_addralign.
13508         * output.cc (Output_section_data::set_addralign): New function.
13509
13510 2008-04-11  Cary Coutant  <ccoutant@google.com>
13511
13512         Add support for TLS descriptors for i386 and x86_64.
13513         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13514         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13515         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13516         GOT_TYPE_TLS_DESC.
13517         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13518         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13519         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13520         relocations.
13521         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13522         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13523         Fix problem with initial-exec relocations.
13524         (Target_i386::Relocate::relocate_tls): Likewise.
13525         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13526         relaxation.
13527         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13528         support for section-plus-offset dynamic table entries.
13529         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13530         (Output_data_dynamic::Dynamic_entry): Add support for
13531         section-plus-offset dynamic table entries.
13532         (Output_data_dynamic::Classification): Likewise.
13533         (Output_data_dynamic::classification_): Renamed offset_.
13534         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13535         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13536         (Target_x86_64::make_plt_section): New function.
13537         (Target_x86_64::reserve_tlsdesc_entries): New function.
13538         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13539         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13540         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13541         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13542         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13543         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13544         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13545         add extra PLT entry for TLS descriptors.
13546         (Output_data_plt_x86_64::got_): New field.
13547         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13548         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13549         fields.
13550         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13551         descriptors.
13552         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13553         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13554         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13555         R_386_TLS_DESC_CALL relocations.
13556         (Target_x86_64::Scan::global): Likewise.
13557         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13558         for TLS descriptors.
13559         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13560         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13561         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13562         GD-to-IE relaxation.
13563         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13564         and TLS_DESCRIPTORS.
13565         * Makefile.in: Rebuild.
13566         * configure: Rebuild.
13567         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13568         (tls_test_shared2.so): New target.
13569         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13570         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13571         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13572         (tls_shared_gd_to_ie_test_LDADD): New variable.
13573         (tls_shared_gnu2_gd_to_ie_test): New target.
13574         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13575         New targets.
13576         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13577         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13578         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13579         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13580         (tls_shared_gnu2_test): New target.
13581         (tls_test_gnu2_shared.so): New target.
13582         (tls_shared_gnu2_test_SOURCES): New variable.
13583         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13584         (tls_shared_gnu2_test_LDFLAGS): New variable.
13585         (tls_shared_gnu2_test_LDADD): New variable.
13586         * testsuite/Makefile.in: Rebuild.
13587         * testsuite/Makefile.
13588
13589 2008-04-11  Ian Lance Taylor  <iant@google.com>
13590
13591         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13592         justsyms.t.
13593         * testsuite/Makefile.in: Rebuild.
13594
13595         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13596         long.
13597         * testsuite/script_test_2.cc (main): Adjust test.
13598
13599 2008-04-11  David S. Miller  <davem@davemloft.net>
13600             Ian Lance Taylor  <iant@google.com>
13601
13602         * options.h (General_options): Add entries for '-Y' and
13603         '-relax'.
13604         * options.cc (General_options:finalize): If -Y was used, add those
13605         entries to the library path instead of the default "/lib" and
13606         "/usr/lib".
13607
13608 2008-04-11  David S. Miller  <davem@davemloft.net>
13609
13610         * testsuite/justsyms.t: Start at 0x100.
13611         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13612         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13613         long.
13614         * testsuite/script_test_2.cc: Adjust string and section length
13615         checks.
13616
13617 2008-04-09  Ian Lance Taylor  <iant@google.com>
13618
13619         PR gold/5996
13620         * script-sections.cc (Sections_element::allocate_to_segment): Add
13621         orphan parameter.
13622         (Output_section_definition::allocate_to_segment): Likewise.
13623         (Orphan_output_section::allocate_to_segment): Likewise.
13624         (Script_sections::attach_sections_using_phdrs_clause): Don't
13625         propagate non-PT_LOAD segments to orphan sections.
13626         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13627         readelf rather than objdump.
13628         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13629         .interp section and PT_INTERP segment are the same size.
13630         * testsuite/Makefile.in: Rebuild.
13631
13632         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13633         aliases for symbols defined in the same object.
13634         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13635         (weak_alias_test_SOURCES): New variable.
13636         (weak_alias_test_DEPENDENCIES): New variable.
13637         (weak_alias_test_LDFLAGS): New variable.
13638         (weak_alias_test_LDADD): New variable.
13639         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13640         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13641         (weak_alias_test_3.o): New target.
13642         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13643         * testsuite/weak_alias_test_main.cc: New file.
13644         * testsuite/weak_alias_test_1.cc: New file.
13645         * testsuite/weak_alias_test_2.cc: New file.
13646         * testsuite/weak_alias_test_3.cc: New file.
13647
13648 2008-04-08  Ian Lance Taylor  <iant@google.com>
13649
13650         * options.h (class General_options): Add --noinhibit-exec option.
13651         * main.cc (main): Check --noinhibit-exec.
13652
13653         * options.h (class General_options): Define --wrap as a special
13654         option.  Add wrap_symbols_ field.
13655         (General_options::any_wrap_symbols): New function.
13656         (General_options::is_wrap_symbol): New function.
13657         * options.cc (General_options::parse_wrap): New function.
13658         (General_options::General_options): Initialize wrap_symbols_.
13659         * symtab.cc (Symbol_table::wrap_symbol): New function.
13660         (Symbol_table::add_from_object): Handle --wrap.
13661         * symtab.h (class Symbol_table): Declare wrap_symbol.
13662         * target.h (Target::wrap_char): New function.
13663         (Target::Target_info): Add wrap_char field.
13664         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13665         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13666         * testsuite/testfile.cc (Target_test::test_target_info):
13667         Likewise.
13668
13669         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13670         there is one.
13671
13672         * layout.h (class Layout): Add added_eh_frame_data_ field.
13673         * layout.cc (Layout::Layout): Initialize new field.
13674         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13675         output section until we find a section we merged successfully.
13676         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13677         that the size be non-zero.
13678
13679         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13680         qualifier.
13681
13682 2008-04-08  Craig Silverstein  <csilvers@google.com>
13683
13684         * configure.ac: Export new conditional variable HAVE_ZLIB.
13685         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13686         on HAVE_ZLIB.
13687         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13688         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13689
13690 2008-04-07  Ian Lance Taylor  <iant@google.com>
13691
13692         * version.cc (version_string): Set to "1.5".
13693
13694         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13695         Add issued_non_pic_error_ field.  Declare check_non_pic.
13696         (Target_x86_64::Scan::check_non_pic): New function.
13697         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13698         (Target_x86_64::Scan::global): Likewise.
13699
13700         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13701         addend parameter.  Change caller.  Handle merge sections.
13702         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13703         Address to Addend.  Don't add in the result of
13704         local_section_offset, pass down the addend and use the returned
13705         value.
13706         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13707         Update declarations of local_section_offset and symbol_value.
13708         * testsuite/two_file_test_1.cc (t18): New function.
13709         * testsuite/two_file_test_2.cc (f18): New function.
13710         * testsuite/two_file_test_main.cc (main): Call t18.
13711         * testsuite/two_file_test.h (t18, f18): Declare.
13712
13713         * configure.ac: Don't test for objdump, c++filt, or readelf.
13714         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13715         conditionals.
13716         (TEST_READELF): New variable.
13717         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13718         (check_PROGRAMS): Add two_file_strip_test.
13719         (two_file_strip_test): New target.
13720         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13721         (two_file_same_shared_strip_test_SOURCES): New variable.
13722         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13723         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13724         (two_file_same_shared_strip_test_LDADD): New variable.
13725         (two_file_shared_strip.so): New target.
13726         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13727         (ver_test_5.syms, ver_test_7.syms): Likewise.
13728         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13729         (strip_test_3.stdout): Use TEST_OBJDUMP.
13730         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13731
13732 2008-04-04  Cary Coutant  <ccoutant@google.com>
13733
13734         * symtab.h (Symbol::is_weak_undefined): New function.
13735         (Symbol::is_strong_undefined): New function.
13736         (Symbol::is_absolute): New function.
13737         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13738         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13739         absolute symbols.
13740         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13741         (weak_undef_test): New target.
13742         * testsuite/Makefile.in: Rebuild.
13743         * testsuite/weak_undef_file1.cc: New file.
13744         * testsuite/weak_undef_file2.cc: New file.
13745         * testsuite/weak_undef_test.cc: New file.
13746
13747 2008-04-03  Craig Silverstein  <csilvers@google.com>
13748
13749         * compressed_output.h (class Output_compressed_section): Use
13750         unsigned buffer.
13751         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13752         add zlib header.
13753         (zlib_compressed_suffix): Removed.
13754         (Output_compressed_section::set_final_data_size): Use unsigned
13755         buffers.
13756         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13757         Fix linker invocation.
13758         (flagstest_o_specialfile_and_compress_debug_sections):
13759         Likewise.
13760         * testsuite/Makefile.in: Regenerated.
13761
13762 2008-04-02  David S. Miller  <davem@davemloft.net>
13763
13764         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13765         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13766
13767 2008-04-02  Craig Silverstein  <csilvers@google.com>
13768
13769         * TODO: New file.
13770
13771 2008-04-02  Ian Lance Taylor  <iant@google.com>
13772
13773         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13774         parameters.  Update for new key type to views_.  Change all
13775         callers.
13776         (File_read::read): Adjust for byteshift in returned view.
13777         (File_read::add_view): New function, broken out of
13778         find_and_make_view.
13779         (File_read::make_view): New function, broken out of
13780         find_and_make_view.
13781         (File_read::find_or_make_view): Add offset and aligned
13782         parameters.  Rewrite accordingly.  Change all callers.
13783         (File_read::get_view): Add offset and aligned parameters.  Adjust
13784         for byteshift in return value.
13785         (File_read::get_lasting_view): Likewise.
13786         * fileread.h (class File_read): Update declarations.
13787         (class File_read::View): Add byteshift_ field.  Add byteshift to
13788         constructor.  Add byteshift method.
13789         * archive.h (Archive::clear_uncached_views): New function.
13790         (Archive::get_view): Add aligned parameter.  Change all callers.
13791         * object.h (Object::get_view): Add aligned parameter.  Change all
13792         callers.
13793         (Object::get_lasting_view): Likewise.
13794
13795         * fileread.cc (File_read::release): Don't call clear_views if
13796         there are multiple objects.
13797         * fileread.h (File_read::clear_uncached_views): New function.
13798         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13799         on the archive.
13800
13801 2008-03-31  Cary Coutant  <ccoutant@google.com>
13802
13803         Add thin archive support.
13804         * archive.cc (Archive::armagt): New const.
13805         (Archive::setup): Remove task parameter and calls to unlock.
13806         (Archive::unlock_nested_archives): New function.
13807         (Archive::read_header): Add nested_off parameter. Change
13808         all callers.
13809         (Archive::interpret_header): Likewise.
13810         (Archive::include_all_members): Change to handle thin
13811         archives.
13812         (Archive::include_member): Likewise.
13813         * archive.h (Archive::Archive): Add new parameters and
13814         initializers.
13815         (Archive::armagt): New const.
13816         (Archive::setup): Remove task parameter.
13817         (Archive::unlock_nested_archives): New function.
13818         (Archive::read_header): Add nested_off parameter.
13819         (Archive::interpret_header): Likewise.
13820         (Archive::Nested_archive_table): New typedef.
13821         (Archive::is_thin_archive_): New field.
13822         (Archive::nested_archives_): New field.
13823         (Archive::options_): New field.
13824         (Archive::dirpath_): New field.
13825         (Archive::task_): New field.
13826         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13827         for thin archives.  Pass additional parameters to
13828         Archive::Archive.  Unlock the archive file after calling
13829         Archive::setup.
13830
13831 2008-03-29  Ian Lance Taylor  <iant@google.com>
13832
13833         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13834         version symbol to be local.
13835         * testsuite/ver_test_4.sh: New file.
13836         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13837         (check_DATA): Add ver_test_4.syms.
13838         (ver_test_4.syms): New target.
13839         * testsuite/Makefile.in: Rebuild.
13840
13841         * output.cc
13842         (Output_section::Input_section_sort_entry::has_priority): New
13843         function.
13844         (Output_section::Input_section_sort_entry::match_file_name): New
13845         function.
13846         (Output_section::Input_section_sort_entry::match_section_name):
13847         Remove.
13848         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13849         Remove.
13850         (Output_section::Input_section_sort_entry::match_section_file):
13851         Remove.
13852         (Output_section::Input_section_sort_compare::operator()): Rewrite
13853         using new Input_section_sort_entry functions.  Sort crtbegin and
13854         crtend first.  Sort sections with no priority before sections with
13855         a priority.
13856         * testsuite/initpri1.c (d3): Check j != 4.
13857         (cd5): New constructor/destructor function.
13858         (main): Check j != 2.
13859
13860         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13861         new symbol when resolving, don't call set_is_default.
13862         * testsuite/ver_test_7.cc: New file.
13863         * testsuite/ver_test_7.sh: New file.
13864         * testsuite/Makefile.am (ver_test_7.so): New target.
13865         (ver_test_7.o): New target.
13866         (check_SCRIPTS): Add ver_test_7.sh.
13867         (check_DATA): Add ver_test_7.syms.
13868         (ver_test_7.syms): New target.
13869
13870 2008-03-28  Ian Lance Taylor  <iant@google.com>
13871
13872         * layout.cc (Layout::layout): If we see an input section with a
13873         name that needs sorting, set the must_sort flag for the output
13874         section.
13875         (Layout::make_output_section): If the name of the output section
13876         indicates that it might require sorting, set the may_sort flag.
13877         * output.h (Output_section::may_sort_attached_input_sections): New
13878         function.
13879         (Output_section::set_may_sort_attached_input_sections): New
13880         function.
13881         (Output_section::must_sort_attached_input_sections): New
13882         function.
13883         (Output_section::set_must_sort_attached_input_sections): New
13884         function.
13885         (class Output_section): Declare Input_section_sort_entry.  Define
13886         Input_section_sort_compare.  Declare
13887         sort_attached_input_sections.  Add new fields:
13888         may_sort_attached_input_sections_,
13889         must_sort_attached_input_sections_,
13890         attached_input_sections_are_sorted_.
13891         * output.cc (Output_section::Output_section): Initialize new
13892         fields.
13893         (Output_section::add_input_section): Add an entry to
13894         input_sections_ if may_sort or must_sort are true.
13895         (Output_section::set_final_data_size): Call
13896         sort_attached_input_sections if necessary.
13897         (Output_section::Input_section_sort_entry): Define new class.
13898         (Output_section::Input_section_sort_compare::operator()): New
13899         function.
13900         (Output_section::sort_attached_input_sections): New function.
13901         * configure.ac: Check whether the compiler supports constructor
13902         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13903         * testsuite/initpri1.c: New file.
13904         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13905         CONSTRUCTOR_PRIORITY.
13906         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13907         (initpri1_LDFLAGS): New variable.
13908         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13909
13910 2008-03-27  Ian Lance Taylor  <iant@google.com>
13911
13912         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13913         * testsuite/common_test_1.c: New file.
13914         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13915         (common_test_1_SOURCES): New variable.
13916         (common_test_1_DEPENDENCIES): New variable.
13917         (common_test_1_LDFLAGS): New variable.
13918
13919         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13920         and commons_ correctly when NAME/VERSION does not override
13921         NAME/NULL.
13922         * testsuite/ver_test_6.c: New file.
13923         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13924         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13925         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13926
13927 2008-03-26  Ian Lance Taylor  <iant@google.com>
13928
13929         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13930         of an undefined symbol from a version script.
13931         * testsuite/Makefile.am (ver_test_5.so): New target.
13932         (ver_test_5.o): New target.
13933         (check_SCRIPTS): Add ver_test_5.sh.
13934         (check_DATA): Add ver_test_5.syms.
13935         (ver_test_5.syms): New target.
13936         * testsuite/ver_test_5.cc: New file.
13937         * testsuite/ver_test_5.script: New file.
13938         * testsuite/ver_test_5.sh: New file.
13939         * Makefile.in, testsuite/Makefile.in: Rebuild.
13940
13941         PR gold/5986
13942         Fix problems building gold with gcc 4.3.0.
13943         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13944         (gold_error_at_location, gold_warning_at_location): Use it.
13945         * configure.ac: Check whether we can compile and use a template
13946         function with a printf attribute.
13947         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13948         when jumping over bytes.
13949         * object.cc: Instantiate Object::read_section_data.
13950         * debug.h: Include <cstring>
13951         * dwarf_reader.cc: Include <algorithm>
13952         * main.cc: Include <cstring>.
13953         * options.cc: Include <cstring>.
13954         * output.cc: Include <cstring>.
13955         * script.cc: Include <cstring>.
13956         * script.h: Include <string>.
13957         * symtab.cc: Include <cstring> and <algorithm>.
13958         * target-select.cc: Include <cstring>.
13959         * version.cc: Include <string>.
13960         * testsuite/testmain.cc: Include <cstdlib>.
13961         * configure, config.in: Rebuild.
13962
13963 2008-03-25  Ian Lance Taylor  <iant@google.com>
13964
13965         * options.cc: Include "../bfd/bfdver.h".
13966         (options::help): Print bug reporting address.
13967
13968         * version.cc (print_version): Adjust output for current value of
13969         BFD_VERSION_STRING.
13970
13971         * NEWS: New file.
13972
13973         * options.cc (options::help): Print list of supported targets.
13974         * target-select.h: Include <vector>.
13975         (class Target_selector): Make machine_, size_, and is_big_endian_
13976         fields const.  Add bfd_name_ and instantiated_target_ fields.
13977         (Target_selector::Target_selector): Add bfd_name parameter.
13978         (Target_selector::recognize): Make non-virtual, call
13979         do_recognize.
13980         (Target_selector::recognize_by_name): Make non-virtual, call
13981         do_recognize_by_name.
13982         (Target_selector::supported_names): New function.
13983         (Target_selector::bfd_name): New function.
13984         (Target_selector::do_instantiate_target): New pure virtual
13985         function.
13986         (Target_selector::do_recognize): New virtual function.
13987         (Target_selector::do_recognize_by_name): New virtual function.
13988         (Target_selector::instantiate_target): New private function.
13989         (supported_target_names): Declare.
13990         * target-select.cc (Target_selector::Target_selector): Update for
13991         new parameter and fields.
13992         (select_target_by_name): Check that the name matches before
13993         calling recognize_by_name.
13994         (supported_target_names): New function.
13995         * i386.cc (class Target_selector_i386): Update Target_selector
13996         constructor call.  Remove recognize and recognize_by_name.  Add
13997         do_instantiate_target.
13998         * x86_64.cc (class Target_selector_x86_64): Likewise.
13999         * testsuite/testfile.cc (class Target_selector_test): Update for
14000         changes to Target_selector.
14001
14002         * README: Rewrite, with some notes on unsupported features.
14003
14004 2008-03-24  Cary Coutant  <ccoutant@google.com>
14005
14006         * i386.cc (Target_i386::Got_type): New enum declaration.
14007         (Target_i386::Scan::local): Updated callers of Output_data_got
14008         member functions.
14009         (Target_i386::Scan::global): Likewise.
14010         (Target_i386::Relocate::relocate): Likewise.
14011         (Target_i386::Relocate::relocate_tls): Likewise.
14012         * object.h (Got_offset_list): New class.
14013         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14014         (Sized_relobj::local_got_offset): Likewise.
14015         (Sized_relobj::set_local_got_offset): Likewise.
14016         (Sized_relobj::local_has_tls_got_offset): Removed.
14017         (Sized_relobj::local_tls_got_offset): Removed.
14018         (Sized_relobj::set_local_tls_got_offset): Removed.
14019         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14020         * output.cc (Output_data_got::add_global): Added got_type parameter.
14021         (Output_data_got::add_global_with_rel): Likewise.
14022         (Output_data_got::add_global_with_rela): Likewise.
14023         (Output_data_got::add_global_pair_with_rel): New function.
14024         (Output_data_got::add_global_pair_with_rela): New function.
14025         (Output_data_got::add_local): Added got_type parameter.
14026         (Output_data_got::add_local_with_rel): Likewise.
14027         (Output_data_got::add_local_with_rela): Likewise.
14028         (Output_data_got::add_local_pair_with_rel): New function.
14029         (Output_data_got::add_local_pair_with_rela): New function.
14030         (Output_data_got::add_global_tls): Removed.
14031         (Output_data_got::add_global_tls_with_rel): Removed.
14032         (Output_data_got::add_global_tls_with_rela): Removed.
14033         (Output_data_got::add_local_tls): Removed.
14034         (Output_data_got::add_local_tls_with_rel): Removed.
14035         (Output_data_got::add_local_tls_with_rela): Removed.
14036         * output.h (Output_data_got::add_global): Added got_type parameter.
14037         (Output_data_got::add_global_with_rel): Likewise.
14038         (Output_data_got::add_global_with_rela): Likewise.
14039         (Output_data_got::add_global_pair_with_rel): New function.
14040         (Output_data_got::add_global_pair_with_rela): New function.
14041         (Output_data_got::add_local): Added got_type parameter.
14042         (Output_data_got::add_local_with_rel): Likewise.
14043         (Output_data_got::add_local_with_rela): Likewise.
14044         (Output_data_got::add_local_pair_with_rel): New function.
14045         (Output_data_got::add_local_pair_with_rela): New function.
14046         (Output_data_got::add_global_tls): Removed.
14047         (Output_data_got::add_global_tls_with_rel): Removed.
14048         (Output_data_got::add_global_tls_with_rela): Removed.
14049         (Output_data_got::add_local_tls): Removed.
14050         (Output_data_got::add_local_tls_with_rel): Removed.
14051         (Output_data_got::add_local_tls_with_rela): Removed.
14052         * resolve.cc (Symbol::override_base_with_special): Removed
14053         reference to has_got_offset_ field.
14054         * symtab.cc (Symbol::init_fields): Replaced initialization
14055         of got_offset_ with got_offsets_.  Removed initialization
14056         of has_got_offset_
14057         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14058         (Symbol::got_offset): Likewise.
14059         (Symbol::set_got_offset): Likewise.
14060         (Symbol::has_tls_got_offset): Removed.
14061         (Symbol::tls_got_offset): Removed.
14062         (Symbol::set_tls_got_offset): Removed.
14063         (Symbol::got_offset_): Removed.
14064         (Symbol::tls_mod_got_offset_): Removed.
14065         (Symbol::tls_pair_got_offset_): Removed.
14066         (Symbol::got_offsets_): New field.
14067         (Symbol::has_got_offset): Removed.
14068         (Symbol::has_tls_mod_got_offset): Removed.
14069         (Symbol::has_tls_pair_got_offset): Removed.
14070         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14071         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14072         member functions.
14073         (Target_x86_64::Scan::global): Likewise.
14074         (Target_x86_64::Relocate::relocate): Likewise.
14075         (Target_x86_64::Relocate::relocate_tls): Likewise.
14076
14077 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14078
14079         * yyscript.y: Fix spelling error in comment.
14080
14081 2008-03-24  Ian Lance Taylor  <iant@google.com>
14082
14083         * options.h (class General_options): Define build_id option.
14084         * layout.h (class Layout): Declare write_build_id, create_note,
14085         create_build_id.  Add build_id_note_ member.
14086         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14087         "libiberty.h", "md5.h", "sha1.h".
14088         (Layout::Layout): Initialize eh_frame_data_,
14089         eh_frame_hdr_section_, and build_id_note_.
14090         (Layout::finalize): Call create_build_id.
14091         (Layout::create_note): New function, broken out of
14092         Layout::create_gold_note.
14093         (Layout::create_gold_note): Call create_note.
14094         (Layout::create_build_id): New function.
14095         (Layout::write_build_id): New function.
14096         (Close_task_runner::run): Call write_build_id.
14097
14098         * x86_64.cc: Correct license to GPLv3.
14099
14100 2008-03-23  Ian Lance Taylor  <iant@google.com>
14101
14102         * options.cc: Include "demangle.h".
14103         (parse_optional_string): New function.
14104         (parse_long_option): Handle takes_optional_argument.
14105         (parse_short_option): Update dash_z initializer.  Handle
14106         takes_optional_argument.
14107         (General_options::General_options): Initialize do_demangle_.
14108         (General_options::finalize): Set do_demangle_.  Handle demangling
14109         style.
14110         * options.h (parse_optional_string): Declare.
14111         (struct One_option): Add optional_arg field.  Update constructor.
14112         Update call constructor calls.  Add takes_optional_argument
14113         function.
14114         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14115         (DEFINE_optional_string): Define.
14116         (General_options::demangle): Change from DEFINE_bool to
14117         DEFINE_optional_string.
14118         (General_options::no_demangle): New function.
14119         (General_options::do_demangle): New function.
14120         (General_options::set_do_demangle): New function.
14121         (General_options::execstack_status_): Move definition to end of
14122         class definition.
14123         (General_options::static_): Likewise.
14124         (General_options::do_demangle_): New field.
14125         * object.cc (big_endian>::get_symbol_location_info): Call
14126         Options::do_demangle, not Options::demangle.
14127         * symtab.cc (demangle): Likewise.
14128
14129 2008-03-22  Ian Lance Taylor  <iant@google.com>
14130
14131         * gold.h: Include <cstddef> and <sys/types.h>
14132         * options.h: Include <cstring>.
14133
14134 2008-03-21  Ian Lance Taylor  <iant@google.com>
14135
14136         * Added source code to GNU binutils.