4ccde1692eedbdb472424557a9db4d72aa8ce4b2
[platform/upstream/binutils.git] / gold / ChangeLog
1 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2
3         * testsuite/binary_unittest.cc (Sized_binary_test):
4         Use open_descriptor rather than ::open.
5
6 2012-12-07  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Stub_table::do_write): Delete redundant Address
9         typedef and invalid_address constant.
10         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
11         instantiate constants.
12
13 2012-12-06  Roland McGrath  <mcgrathr@google.com>
14
15         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
16         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
17         * aclocal.m4: Regenerate.
18         * configure: Regenerate.
19         * Makefile.in: Regenerate.
20         * testsuite/Makefile.in: Regenerate.
21
22 2012-12-07  Alan Modra  <amodra@gmail.com>
23
24         * options.h (General_options): Add no_toc_optimize.
25         * powerpc.cc (ok_lo_toc_insn): New function.
26         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
27
28 2012-12-06  Alan Modra  <amodra@gmail.com>
29
30         * options.h (General_options): Add plt_align, plt_static_chain,
31         plt_thread_safe.  Update stub_group_size help text.
32         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
33         for new plt_thread_safe_ var.
34         (use_plt_offset): Correct comments.
35         (Target_powerpc::do_relax): Look for thread creation symbols to
36         determine default plt_thread_safe value.  Clear plt call stubs
37         as well as branch stubs each iteration.
38         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
39         insn constants.
40         (l, hi, ha, write_insn): Move earlier.
41         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
42         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
43         plt stubs too.
44         (Stub_table::update_size): Adjust.
45         (Stub_table::prev_size, set_prev_size): Delete.
46         (Stub_table::stub_align): Let --plt-align affect result.
47         (Stub_table::plt_call_size): Calculate sizes for various stubs.
48         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
49         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
50         (Stub_table::do_write): Support more stub variants.
51
52 2012-12-04  Alan Modra  <amodra@gmail.com>
53
54         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
55         (Target_powerpc::do_define_standard_symbols): New function.
56
57 2012-12-03  Alan Modra  <amodra@gmail.com>
58
59         * output.h: Formatting, whitespace.
60
61 2012-12-03  Alan Modra  <amodra@gmail.com>
62
63         * layout.h (Layout::get_executable_sections): Declare.
64         * layout.cc (Layout::get_executable_sections): New function.
65         * arm.cc (Target_arm::group_sections): Use it.
66         (Arm_output_section::group_sections): Delete now redundant test.
67         * output.cc (Output_reloc::Output_reloc): Add is_relative.
68         param to handle relative relocs.
69         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
70         (Output_data_reloc::add_absolute): Adjust.
71         (Output_data_reloc::add_relative): New function.
72         (Output_data::reset_data_size): New function.
73         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
74         (Output_section::set_addralign): New function.
75         (Output_section::checkpoint_set_addralign): New function.
76         (Output_section::clear_section_offsets_need_adjustment): New function.
77         (Output_section::input_sections): Make public.
78         * powerpc.cc (class Output_data_brlt_powerpc): New.
79         (class Stub_table, class Stub_control): New.
80         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
81         stub_table_, set_stub_table, stub_table): New vectors and accessor
82         functions.
83         (Target_powerpc::do_may_relax, do_relax, push_branch,
84         new_stub_table, stub_tables, brlt_section, group_sections,
85         add_branch_lookup_table, find_branch_lookup_table,
86         write_branch_lookup_table, make_brlt_section): New functions.
87         (Target_powerpc::struct Sort_sections, class Branch_info): New.
88         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
89         branch_info_): New vars.
90         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
91         make call stubs here.
92         (Output_data_glink): Remove all call stub handling from this class.
93         (Target_powerpc::Scan::local, global): Save interesting branch
94         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
95         (Target_powerpc::do_finalize_sections): Only make reg save/restore
96         functions on final link.
97         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
98         Handle long branch destinations too.
99         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
100         do_plt_address_for_local): Adjust lookup of plt call stubs.
101
102 2012-11-30  Alan Modra  <amodra@gmail.com>
103
104         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
105         relocs against protected symbols when building 32-bit shared libs.
106
107 2012-11-30  Alan Modra  <amodra@gmail.com>
108
109         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
110         param.  Call got_section() to make .got.  Update all callers
111         and their callers and so on.
112
113 2012-11-30  Alan Modra  <amodra@gmail.com>
114
115         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
116         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
117         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
118         value if it already exists.
119
120 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
121
122         PR gold/14858
123         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
124
125 2012-11-14  Roland McGrath  <mcgrathr@google.com>
126
127         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
128         than bfc instruction for data sandboxing.
129
130 2012-11-08  Alan Modra  <amodra@gmail.com>
131
132         * po/POTFILES.in: Regenerate.
133
134 2012-11-05  Alan Modra  <amodra@gmail.com>
135
136         * configure.ac: Apply 2012-09-10 change to config.in here.
137         * configure: Regenerate.
138
139 2012-11-05  Alan Modra  <amodra@gmail.com>
140
141         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
142         (struct Opd_ent): Use "Address" rather than "Offset".
143         (Output_data_got_powerpc::got_base_offset): Return Valtype.
144         (Target_powerpc::got_section): Make public.
145         (Target_powerpc::scan_relocs): Move code setting symbols..
146         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
147         Create _SDA_BASE_ only when referenced.
148
149 2012-11-02  Roland McGrath  <mcgrathr@google.com>
150
151         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
152         from last change.
153
154 2012-11-01  Roland McGrath  <mcgrathr@google.com>
155
156         * target.h (Sized_target::relocate_relocs): Use Elf_Off
157         for offset_in_output_section parameter.
158         (Sized_target::relocate_special_relocatable): Likewise.
159         * arm.cc (Target_arm::relocate_relocs): Likewise.
160         (Target_arm::relocate_special_relocatable): Likewise.
161         * i386.cc (Target_i386::relocate_relocs): Likewise.
162         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
163         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
164         * target-reloc.h (relocate_relocs): Likewise.
165         * testsuite/testfile.cc (Target_test): Likewise.
166         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
167         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
168
169         * system.h: Move inclusion of <clocale> to after <libintl.h> in
170         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
171
172         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
173         parameter, which is unused in the [!F_SETFD] case.
174
175         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
176         SYMNDX to off_t before comparing it to this->data_size().
177         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
178         * incremental.cc (Output_section_incremental_inputs::do_write):
179         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
180
181         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
182
183 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
184
185         * gold.cc (Target_arm::do_adjust_elf_header): Add the
186         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
187         in EABI_VER5.
188
189 2012-10-29  Cary Coutant  <ccoutant@google.com>
190
191         * dwp.cc (usage): Add file and exit status parameters;
192         add --help and --version options.
193         (print_version): New function.
194         (main): Add --help and --version options.
195
196 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
197
198         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
199         final_layout_sequence.txt.
200         * testsuite/Makefile.in: Regenerated.
201
202 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
203
204         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
205         COMPILE generated by automake.
206         (LINK1): Likewise.
207         (CXXCOMPILE1): Likewise.
208         (CXXLINK1): Likewise.
209         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
210         (LINK): Likewise.
211         (CXXCOMPILE): Likewise.
212         (CXXLINK): Likewise.
213         * testsuite/Makefile.in: Regenerated.
214
215 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
216
217         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
218         on bad fwrite return.
219
220 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
221
222         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
223         on val.
224
225 2012-10-23  Cary Coutant  <ccoutant@google.com>
226
227         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
228         * testsuite/Makefile.in: Regenerate.
229         * testsuite/dwp_test.h: New source file.
230         * testsuite/dwp_test_1.cc: New source file.
231         * testsuite/dwp_test_1.s: New source file.
232         * testsuite/dwp_test_1.sh: New source file.
233         * testsuite/dwp_test_1b.cc: New source file.
234         * testsuite/dwp_test_1b.s: New source file.
235         * testsuite/dwp_test_2.cc: New source file.
236         * testsuite/dwp_test_2.s: New source file.
237         * testsuite/dwp_test_2.sh: New source file.
238         * testsuite/dwp_test_main.cc: New source file.
239         * testsuite/dwp_test_main.s: New source file.
240
241 2012-10-23  Cary Coutant  <ccoutant@google.com>
242
243         * dwp.h: New header file.
244         * dwp.cc: New source file.
245         * gold.h: Move shared declarations to system.h.
246         * system.h: New header file.
247         * Makefile.am: Add dwp.
248         * Makefile.in: Regenerate.
249
250 2012-10-23  Cary Coutant  <ccoutant@google.com>
251
252         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
253         Dwarf_info_reader::read_from_pointer.
254         (Dwarf_pubnames_table::read_header): Likewise.
255         (Dwarf_pubnames_table::next_name): Likewise.
256         (Dwarf_die::read_attributes): Likewise.
257         (Dwarf_die::skip_attributes): Likewise.
258         (Dwarf_info_reader::read_from_pointer): New function template.
259         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
260         (Dwarf_pubnames_table): Likewise.
261         (Dwarf_info_reader::read_from_pointer): New function template.
262         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
263         Dwarf_pubnames_table ctor.
264
265 2012-10-23  Cary Coutant  <ccoutant@google.com>
266
267         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
268         abbrev_shndx.
269         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
270         abbrev_shndx_.
271         (Dwarf_info_reader::set_abbrev_shndx): New method.
272         (Dwarf_info_reader::abbrev_shndx_): New data member.
273
274 2012-10-23  Cary Coutant  <ccoutant@google.com>
275
276         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
277         from object, not parameters.
278         (Dwarf_info_reader::parse): Likewise.
279         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
280         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
281         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
282         methods.
283
284 2012-10-23  Cary Coutant  <ccoutant@google.com>
285
286         * fileread.cc (Input_file::Input_file): New constructor.
287         * fileread.h (class Input_file): Add new constructor.
288
289 2012-10-18  Alan Modra  <amodra@gmail.com>
290
291         PR gold/14727
292         * object.cc (Relobj::is_section_name_included): Also match
293         .sdata personality section.
294
295 2012-10-18  Alan Modra  <amodra@gmail.com>
296
297         * target-reloc.h (class Default_comdat_behavior): New, package up..
298         (get_comdat_behaviour): ..this.
299         (relocate_section): Add Relocate_comdat_behavior template arg,
300         adjust code to suit.
301         * arm.cc (Target_arm::relocate_section): Adjust to suit.
302         (Target_arm::scan_reloc_section): Likewise.
303         * i386.cc (Target_i386::relocate_section): Likewise.
304         * sparc.cc (Target_sparc::relocate_section): Likewise.
305         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
306         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
307         * powerpc.cc (class Relocate_comdat_behavior): New.
308         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
309         gold::relocate_section with new template arg.
310
311 2012-10-18  Alan Modra  <amodra@gmail.com>
312
313         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
314         dynamic relocs for GOT_TPREL got entries, without symbol if
315         resolving locally.
316         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
317         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
318         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
319
320 2012-10-17  Alan Modra  <amodra@gmail.com>
321
322         PR gold/14726
323         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
324
325 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
326
327         * layout.cc (Layout::include_section): Keep sections marked
328         SHF_EXCLUDE when doing relocatable links.
329
330 2012-10-16  Alan Modra  <amodra@gmail.com>
331
332         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
333         (Target_powerpc::do_finalize_sections): Call it.
334         (Output_data_save_res): New class and supporting functions.
335         (Target_powerpc::symval_for_branch): Only look up .opd entry for
336         normal symbols defined in object files.
337
338 2012-10-12  Alan Modra  <amodra@gmail.com>
339
340         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
341         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
342         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
343         section if scan_opd_relocs not yet called.
344         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
345
346 2012-10-12  Alan Modra  <amodra@gmail.com>
347
348         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
349         add_local_ifunc_entry): Revert last change.
350         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
351
352 2012-10-05  Alan Modra  <amodra@gmail.com>
353
354         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
355         do_plt_address_for_global): New functions.
356         (Output_data_got_powerpc::do_write): Don't segfault when linking
357         statically.
358         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
359         add_local_ifunc_entry): Return true on adding entry..
360         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
361         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
362         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
363         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
364         set up symbols here.
365         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
366         syms here.  Do so even when no .iplt.  Don't segfault when linking
367         statically.
368         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
369         new variants without reloc param.
370         (Glink_sym_ent::Glink_sym_ent): Likewise.
371         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
372         reloc when refs will resolve to plt call stub.
373         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
374         R_PPC_PLTREL24 to resolve locally.
375         (Target_powerpc::Scan::global): Correct ifunc handling.
376         (Target_powerpc::Relocate::relocate): Correct local sym glink
377         lookup.  Don't destroy "value" when we have a plt call stub,
378         and when checking plt call validity.
379         (Target_powerpc::do_dynsym_value): Simplify.
380
381 2012-10-05  Alan Modra  <amodra@gmail.com>
382
383         * i386.cc (Output_data_plt_i386::address_for_global,
384         address_for_local): Add plt offset to returned value.  Adjust uses.
385         * sparc.cc (Output_data_plt_sparc::address_for_global,
386         address_for_local): Likewise.
387         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
388         address_for_local): Likewise.
389         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
390         address_for_local): Likewise.
391         * target.h (Target::plt_address_for_global, plt_address_for_local):
392         Update comment.
393         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
394         (Output_data_got::Got_entry::write): Nor here.
395         * output.h: Comment fix.
396
397 2012-10-02  Jiong Wang  <jiwang@tilera.com>
398
399         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
400         global_offset_table_ value for larget got.
401         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
402
403 2012-09-29  Alan Modra  <amodra@gmail.com>
404
405         * powerpc.cc (Target_powerpc::iplt_): New output section.
406         (Target_powerpc::iplt_section, make_iplt_section,
407         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
408         (Target_powerpc::make_plt_entry): Handle ifunc syms.
409         Target_powerpc::plt_entry_count): Count iplt entries too.
410         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
411         reloc section in constructor.  New params.
412         (Target_powerpc::make_plt_section): Create reloc section here instead.
413         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
414         functions.
415         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
416         (Output_data_glink::add_entry, find_entry): New functions to
417         deal with local syms.
418         (Glink_sym_ent): Add support for local syms.
419         (Output_data_glink::do_write): Handle ifunc plt entries.
420         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
421         (Target_powerpc::Scan::local, global): Handle ifunc syms.
422         (Target_powerpc::Relocate::relocate): Likewise.
423         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
424
425 2012-09-25  Alan Modra  <amodra@gmail.com>
426
427         * object.h (Sized_relobj_file::adjust_local_symbol,
428         do_adjust_local_symbol): New functions.
429         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
430         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
431         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
432         and irregular opd entry spacing.
433         (Powerpc_relobj::do_read_relocs): Add opd size checks.
434         (Global_symbol_visitor_opd): New functor.
435         (Target_powerpc::do_finalize_sections): Omit global symbols defined
436         on deleted opd entries.
437
438 2012-09-15  Jiong Wang  <jiwang@tilera.com>
439
440         * tilegx.cc: New file.
441         * Makefile.am (TARGETSOURCES): Add tilegx.cc
442         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
443         * configure.tgt: Add entries for tilegx*.
444         * configure.ac: Likewise.
445         * Makefile.in: Rebuild.
446         * configure: Likewise.
447         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
448         tilegx.
449
450 2012-09-13  Alan Modra  <amodra@gmail.com>
451
452         * target-reloc.h (scan_relocs): Call scan.local for relocs
453         against symbols in discarded sections.  Pass is_discarded
454         param.
455         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
456         Add is_discarded param.
457         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
458         is_discarded to flag opd entry as discarded.  Don't emit dyn
459         relocs on such entries.
460         (Target_powerpc::Scan::global): Similarly detect and handle
461         such opd entries.
462         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
463         opd_ent_.  Update all uses.
464         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
465         (Target_powerpc::relocate_section): Zero out discarded opd
466         entry relocs.
467
468 2012-09-12  Ian Lance Taylor  <iant@google.com>
469
470         PR gold/14570
471         * output.cc: Rename Output_data_got template parameter from size
472         to got_size for all functions.  Compile all variants of
473         Output_data_got.
474         (Output_data_got::Got_entry::write): Correct use of size for
475         symbol value.  Use local_is_tls rather than casting to
476         Sized_relobj_file.
477         * object.h (class Object): Add local_is_tls and do_local_is_tls.
478         (class Sized_relobj_file): Add do_local_is_tls.
479         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
480
481 2012-09-11  Alan Modra  <amodra@gmail.com>
482
483         PR gold/14566
484         * layout.cc (Layout::set_segment_offsets): When using
485         common-page-size alignment, ensure we are on a new max-page-size
486         page.
487         * output.cc (Output_segment::set_section_addresses): Use
488         abi_pagesize, not common_pagesize for relro boundary.
489         (Output_segment::set_offset): Likewise.
490
491 2012-09-11  Alan Modra  <amodra@gmail.com>
492
493         * output.h (Output_data_got::add_global_tls, add_local_tls,
494         add_local_tls_pair): New functions.
495         (Output_data_got::add_local_pair_with_rel): Remove second
496         reloc param.  Expand comment.
497         (Output_data_got::Got_entry): Rename use_plt_offset_ to
498         use_plt_or_tls_offset_, similarly for constructor param.
499         (Output_data_got::Got_entry::write): Add got_index param.
500         * output.cc (Output_data_got::add_global_tls, add_local_tls,
501         add_local_tls_pair): New functions.
502         (Output_data_got::Got_entry::write): Handle tls symbols
503         with use_plt_or_tls_offset_ set specially.
504         (Output_data_got::add_local_pair_with_rel): Only one reloc.
505         (Output_data_got::do_write): Replace iterator with index, pass
506         index to entry write function.
507         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
508         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
509         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
510         call.
511         * i386.cc (Target_i386::Scan::local): Likewise.
512         * sparc.cc (Target_sparc::Scan::local): Likewise.
513         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
514         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
515         do_tls_offset_for_global): New functions.
516         (Target_powerpc::Scan::local): Correct TLS relocations and got
517         entry values.
518         (Target_powerpc::Scan::global): Don't emit unnecessary
519         dynamic relocations on TLS GOT entries.
520
521 2012-09-10  Matthias Klose  <doko@ubuntu.com>
522
523         * config.in: Disable sanity check for kfreebsd.
524
525 2012-09-10  Sterling Augustine  <saugustine@google.com>
526
527         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
528         (Gdb_index::pubtypes_read): New parameter.
529         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
530         to calls.
531         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
532         pubtypes_object_.
533
534 2012-09-09  Alan Modra  <amodra@gmail.com>
535
536         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
537         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
538         * gc.h (gc_process_relocs): Call target gc_add_reference.
539         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
540         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
541         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
542         unnecessary cast.
543         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
544         to cater for when we don't need code offset.  Update use.
545         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
546         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
547         set_opd_valid): New functions.
548         (Target_powerpc::do_gc_add_reference): New function.
549         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
550         stashed refs.
551         (Target_powerpc::do_gc_mark_symbol): New function.
552
553 2012-09-06  Cary Coutant  <ccoutant@google.com>
554
555         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
556         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
557         (Dwarf_die::skip_attributes): Likewise.
558         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
559         * testsuite/gdb_index_test.cc (inline_func_1): New function.
560         (main): Call it.
561         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
562
563 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
564
565         * testsuite/script_test_3.t: Add .got.plt output section
566         statement.
567         * testsuite/script_test_4.t: Likewise.
568
569 2012-09-05  Alan Modra  <amodra@gmail.com>
570
571         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
572         update all uses and lose "enum" when using type.
573
574 2012-09-05  Alan Modra  <amodra@gmail.com>
575
576         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
577         * configure: Regenerate.
578         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
579         (plugin_final_layout.stdout): Likewise.
580         (memory_test): Set page sizes to 0x1000.
581         * testsuite/Makefile.in: Regenerate.
582         * testsuite/discard_locals_test.sh: Add FIXME comment.
583         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
584         * testsuite/pr14265.t: Add .got output section statement.
585         * testsuite/script_test_2.t: Likewise.
586         * testsuite/script_test_3.t: Likewise.
587         * testsuite/script_test_4.t: Likewise.
588         * testsuite/script_test_5.t: Likewise.
589         * testsuite/script_test_6.t: Likewise.
590         * testsuite/script_test_7.t: Likewise.
591         * testsuite/script_test_9.t: Likewise.
592
593 2012-09-05  Alan Modra  <amodra@gmail.com>
594
595         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
596         (Powerpc_relocate_functions::Status): New typedef.
597         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
598         (Target_powerpc::Scan::local): Handle REL64.
599         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
600         for REL32 and REL64.
601         (Target_powerpc::symval_for_branch): New function, extracted from..
602         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
603         checks.  Report overflow errors.
604
605 2012-09-05  Alan Modra  <amodra@gmail.com>
606
607         * object.h (Sized_relobj_file::emit_relocs): Delete.
608         (Sized_relobj_file::emit_relocs_reltype): Delete.
609         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
610         relocate_relocs for --emit-relocs.
611         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
612         * output.h: Update comment.
613         (Output_segment::first_section): New function.
614         (Output_segment::first_section_load_address): Use first_section.
615         * output.cc (Output_segment::first_section): New function extracted..
616         (Output_segment::first_section_load_address): ..from here.  Delete.
617         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
618         * target.h (Sized_target::relocate_for_relocatable): Likewise.
619         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
620         adjust call to target.h function.
621         * i386.cc (Target_i386): Likewise.
622         * sparc.cc (Target_sparc): Likewise.
623         * x86_64.cc (Target_x86_64): Likewise.
624         * powerpc.cc (Target_powerpc): Likewise.
625         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
626         first tls section has section symbol for optimised local dynamic
627         output relocs.
628         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
629         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
630         optimised tls code.
631         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
632         Rename to relocate_relocs.  Update error message.
633
634 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
635
636         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
637         --just-symbols.
638
639 2012-08-31  Alan Modra  <amodra@gmail.com>
640
641         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
642         (Powerpc_relobj::toc_base_offset): New stub function.
643         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
644         got_mod_index_offset to tlsld_got_offset.  Update all refs.
645         (Target_powerpc::Relocate::enum skip_tls): New.
646         (Target_powerpc::call_tls_get_addr_): New var.
647         (Target_powerpc::is_branch_reloc): Move to file scope.
648         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
649         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
650         New functions.
651         (Target_powerpc::enum Got_type): Delete old values, add new ones.
652         (powerpc_info): Correct common_pagesize for ppc64.
653         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
654         (Powerpc_relocate_functions): Add overflow check enums and functions.
655         Add non-shift version of rela, rela_ua.  Delete all rel public
656         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
657         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
658         addr16_ha3, addr14 functions.
659         (Output_data_got_powerpc::add_constant_pair): New function.
660         (Output_data_got_powerpc::got_base_offset): Likewise.
661         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
662         (instruction constants): Sort, add some more.
663         (Output_data_glink::do_write): Add and use Address typedef.  Use
664         object->toc_base_offset() stub for 64-bit.
665         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
666         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
667         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
668         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
669         Always treat .opd relocs as against locally defined symbol.
670         Correct condition for RELATIVE relocs.
671         (Target_powerpc::do_finalize_sections): Test for NULL sections.
672         (Target_powerpc::Relocate::relocate): Use plt call stub as value
673         for 32-bit syms with a plt entry.  Correct ppc64 toc base
674         calculations.  Handle TLS relocs, and more.  Add overflow
675         checking and adjust for Powerpc_relocate_functions changes.
676         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
677         Reinstate --emit-relocs code with FIXME.
678
679 2012-08-30  Alan Modra  <amodra@gmail.com>
680
681         * layout.cc (Layout::set_segment_offsets): Set p_align to
682         abi_pagesize, not common_pagesize.
683         (Layout::relaxation_loop_body): Similarly use abi_pagesize
684         to determine whether file header can go in segment.
685
686 2012-08-30  Alan Modra  <amodra@gmail.com>
687
688         * output.h (Output_reloc::Output_reloc <output section>): Add
689         is_relative param.  Adjust calls.
690         (Output_reloc::add_output_section_relative): New functions.
691         * output.cc (Output_reloc::Output_reloc <output section>): Handle
692         is_relative.
693         (Output_reloc::symbol_value): Handle SECTION_CODE.
694
695 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
696
697         * gold.cc (queue_middle_tasks): Call layout again when unique
698         segments for sections is desired.
699         * layout.cc (Layout::Layout): Initialize new members.
700         (Layout::get_output_section_flags): New function.
701         (Layout::choose_output_section): Call get_output_section_flags.
702         (Layout::layout): Make output section for mapping to a unique segment.
703         (Layout::insert_section_segment_map): New function.
704         (Layout::attach_allocated_section_to_segment): Make unique segment for
705         output sections marked so.
706         (Layout::segment_precedes): Check for unique segments when sorting.
707         * layout.h (Layout::Unique_segment_info): New struct.
708         (Layout::Section_segment_map): New typedef.
709         (Layout::insert_section_segment_map): New function.
710         (Layout::get_output_section_flags): New function.
711         (Layout::is_unique_segment_for_sections_specified): New function.
712         (Layout::set_unique_segment_for_sections_specified): New function.
713         (Layout::unique_segment_for_sections_specified_): New member.
714         (Layout::section_segment_map_): New member.
715         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
716         Rename is_gc_pass_one to is_pass_one.
717         Rename is_gc_pass_two to is_pass_two.
718         Rename is_gc_or_icf to is_two_pass.
719         Check for which pass based on whether symbols data is present.
720         Make it two pass when unique segments for sections is desired.
721         * output.cc (Output_section::Output_section): Initialize new
722         members.
723         * output.h (Output_section::is_unique_segment): New function.
724         (Output_section::set_is_unique_segment): New function.
725         (Output_section::is_unique_segment_): New member.
726         (Output_section::extra_segment_flags): New function.
727         (Output_section::set_extra_segment_flags): New function.
728         (Output_section::extra_segment_flags_): New member.
729         (Output_section::segment_alignment): New function.
730         (Output_section::set_segment_alignment): New function.
731         (Output_section::segment_alignment_): New member.
732         (Output_segment::Output_segment): Initialize is_unique_segment_.
733         (Output_segment::is_unique_segment): New function.
734         (Output_segment::set_is_unique_segment): New function.
735         (Output_segment::is_unique_segment_): New member.
736         * plugin.cc (allow_unique_segment_for_sections): New function.
737         (unique_segment_for_sections): New function.
738         (Plugin::load): Add new functions to transfer vector.
739         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
740         * Makefile.in: Regenerate.
741         * testsuite/plugin_final_layout.sh: Check if unique segment
742         functionality works.
743         * testsuite/plugin_section_order.c (onload): Check if new interfaces
744         are available.
745         (allow_unique_segment_for_sections): New global.
746         (unique_segment_for_sections): New global.
747         (claim_file_hook): Call allow_unique_segment_for_sections.
748         (all_symbols_read_hook): Call unique_segment_for_sections.
749
750 2012-08-22  Cary Coutant  <ccoutant@google.com>
751
752         * layout.cc (Layout::include_section): Don't assert on GROUP
753         sections with --emit-relocs.
754
755 2012-08-21  Cary Coutant  <ccoutant@google.com>
756
757         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
758         if --export-dynamic-symbol names an undef symbol.
759
760 2012-08-18  Alan Modra  <amodra@gmail.com>
761
762         * powerpc.cc: Formatting and white space.
763         (Powerpc_relobj): Rename got2_section_ to special_.
764         Add opd_ent_shndx_ and opd_ent_off_ vectors.
765         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
766         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
767         (Target_powerpc): Add Address typedef and invalid_address.  Use
768         throughout.
769         (Target_powerpc::is_branch_reloc): New function.
770         (Powerpc_relocate_functions): Add Address typedef, use throughout.
771         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
772         for dst_mask, value and addend.
773         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
774         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
775         (Output_data_glink::do_write): Correct toc base.  Don't try to use
776         uint16_t for 24-bit offset.  Use get_output_section_offset and
777         check return.
778         (Target_powerpc::Scan::local): Handle more relocs.
779         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
780         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
781         Plug in toc restoring insn after plt calls.  Translate branches
782         to function descriptor symbols to corresponding entry point.
783         (Target_powerpc::relocate_for_relocatable): Check return from
784         get_output_section_offset.
785         * symtab.h: Comment typo.
786
787 2012-08-14  Ian Lance Taylor  <iant@google.com>
788
789         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
790         unsupported_relocal_local to call unsupported_reloc_global.
791
792 2012-08-14  Nick Clifton  <nickc@redhat.com>
793
794         PR ld/14265
795         * script-sections.cc (Sections_element::output_section_name): Add
796         keep return parameter.
797         (Output_section_element::match_name): Add keep return parameter.
798         Return the value of the keep_ member.
799         * script-sections.h (class Output_section): Update
800         output_section_name prototype.
801         * layout.cc (Layout::keep_input_section): New public member
802         function.
803         (Layout::choose_output_section): Pass keep parameter to
804         output_section_name.
805         * layout.h (class Layout): Add keep_input_section.
806         * object.cc (Sized_relobj_file::do_layout): Check for kept input
807         sections.
808         * testsuite/Makefile.am: Add a test.
809         * testsuite/Makefile.in: Regenerate.
810         * testsuite/pr14265.c: Source file for the test.
811         * testsuite/pr14265.t: Linker script for the test.
812         * testsuite/pr14265.sh: Shell script for the test.
813
814 2012-08-14  Alan Modra  <amodra@gmail.com>
815
816         * target.h (Target::output_section_name): New function.
817         (Target::do_output_section_name): New function.
818         * layout.cc (Layout::choose_output_section): Call the above.
819         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
820
821 2012-08-14  Alan Modra  <amodra@gmail.com>
822
823         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
824         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
825         for replace_constant call.
826         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
827         (Output_data_glink::do_print_to_mapfile): New function.
828         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
829         (Target_powerpc::Relocate::relocate): Likewise.
830
831 2012-08-14  Alan Modra  <amodra@gmail.com>
832
833         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
834         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
835         (Output_data_glink::add_entry,find_entry): Remove shndx param.
836         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
837         all references to shndx_.  Handle special case for R_PPC_PLTREL24
838         here.
839         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
840         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
841         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
842         here.
843         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
844         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
845
846 2012-08-12  Alan Modra  <amodra@gmail.com>
847
848         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
849         (glink insn constants): Use uint32_t.
850         (Output_data_glink::add_entry): Use insert, not [] operator.
851
852 2012-08-11  Alan Modra  <amodra@gmail.com>
853
854         * object.h (Sized_relobj_file::find_shdr): New function.
855         (Sized_relobj_file::find_special_sections): New function.
856         * object.cc (Sized_relobj_file::find_shdr): New function.
857         (Sized_relobj_file::find_eh_frame): Use find_shdr.
858         (Sized_relobj_file::find_special_sections): New function, split out..
859         (Sized_relobj_file::do_read_symbols): ..from here.
860         * output.h (Output_data_got::replace_constant): New function.
861         (Output_data_got::num_entries): New function.
862         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
863         (Output_data_got::got_offset): Protected rather than private.
864         (Output_data_got::replace_got_entry): New function.
865         * output.cc (Output_data_got::replace_got_entry): New function.
866         * powerpc.cc (class Powerpc_relobj): New.
867         (class Powerpc_relocate_functions): Delete all psymval variants or
868         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
869         Implement _ha functions using corresponding _hi function.
870         (Powerpc_relobj::find_special_sections): New function.
871         (Target_powerpc::do_make_elf_object): New function.
872         (class Output_data_got_powerpc): New.
873         (class Output_data_glink): New.
874         (class Powerpc_scan_relocatable_reloc): New.
875         Many more changes througout file.
876
877 2012-08-09  Nick Clifton  <nickc@redhat.com>
878
879         * po/vi.po: Updated Vietnamese translation.
880
881 2012-08-07  Ian Lance Taylor  <iant@google.com>
882
883         * layout.cc (Layout::add_target_dynamic_tags): If
884         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
885         plt_rel.
886
887 2012-07-30  Nick Clifton  <nickc@redhat.com>
888
889         * po/gold.pot: Updated template.
890         * po/es.po: Updated Spanish translation.
891
892 2012-07-18  Cary Coutant  <ccoutant@google.com>
893
894         PR gold/14344
895         * configure.ac: Add check for -gpubnames support.
896         * configure: Regenerate.
897         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
898         support; force -gno-pubnames.
899         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
900         support.
901         (gdb_index_test_4): New test.
902         * testsuite/Makefile.in: Regenerate.
903         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
904         * testsuite/gdb_index_test_2.sh: Likewise.
905         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
906         * testsuite/gdb_index_test_4.sh: New script.
907         * testsuite/gdb_index_test_comm.sh: New script with common code;
908         don't look for space after colon.
909
910 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
911
912         * gold.cc (queue_middle_tasks): Update function order only after
913         deferred objects due to plugins are processed.
914
915 2012-07-11  Ian Lance Taylor  <iant@google.com>
916
917         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
918         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
919         (Target_arm::scan_reloc_for_stub): Likewise.
920         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
921         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
922         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
923         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
924         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
925
926 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
927             Ian Lance Taylor  <iant@google.com>
928
929         PR gold/14309
930         * configure.ac: Test whether std::tr1::hash<off_t> works.
931         * gold.h: Add a specialization for std::tr1::hash<off_t> if
932         needed.
933         * output.h (class Output_fill): Add virtual destructor.
934         * configure, config.in: Rebuild.
935
936 2012-06-22  Roland McGrath  <mcgrathr@google.com>
937
938         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
939
940 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
941
942         * plugin.cc (Plugin::load): Handle position independent executables.
943
944 2012-06-06  Cary Coutant  <ccoutant@google.com>
945
946         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
947         add .debug_macro.
948         (lines_only_debug_sections): Likewise.
949         (gdb_fast_lookup_sections): New static array.
950         (is_gdb_debug_section): Rename formal parameter.
951         (is_lines_only_debug_section): Likewise.
952         (is_gdb_fast_lookup_section): New function.
953         (Layout::include_section): Check for ".zdebug_" prefix; pass
954         section name suffix to is_gdb_debug_section, et al.; check for
955         fast-lookup sections when building .gdb_index.
956         * options.h (--strip-debug-gdb): Update GDB version number.
957
958 2012-06-06  Cary Coutant  <ccoutant@google.com>
959
960         * configure.ac: Add check for fallocate.
961         * configure: Regenerate.
962         * config.in: Regenerate.
963
964         * options.h (class General_options): Add --mmap-output-file and
965         --posix-fallocate options.
966         * output.cc: (posix_fallocate): Remove; replace with...
967         (gold_fallocate): New function.
968         (Output_file::map_no_anonymous): Call gold_fallocate.
969         (Output_file::map): Check --mmap-output-file option.
970
971 2012-06-05  Jing Yu  <jingyu@google.com>
972
973         * gold.h (textdomain): Add do {} to empty while(0).
974         (bindtextdomain): Likewise.
975
976 2012-06-04  Cary Coutant  <ccoutant@google.com>
977
978         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
979         has_dynsym_index.
980
981 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
982
983         * symtab.cc (Symbol_table::define_special_symbol):
984         Initialize *poldsym to prevent uninitialized variable errors.
985
986 2012-05-23  Cary Coutant  <ccoutant@google.com>
987
988         * layout.cc (Layout::section_name_mapping): Add rules to handle
989         exact match on .data.rel.ro.local or .data.rel.ro.
990         (Layout::output_section_name): Check for exact matches.
991
992 2012-05-23  Cary Coutant  <ccoutant@google.com>
993
994         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
995         more carefully.
996
997 2012-05-22  Cary Coutant  <ccoutant@google.com>
998
999         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1000         object before exporting symbol.
1001
1002 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1003
1004         * testsuite/tls_test.cc: Include "config.h" first.
1005         * testsuite/tls_test_c.c: Likewise.
1006
1007 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1008             Nick Clifton  <nickc@redhat.com>
1009
1010         PR 14072
1011         * configure.in: Add check that sysdep.h has been included before
1012         any system header files.
1013         * configure: Regenerate.
1014         * config.in: Regenerate.
1015
1016 2012-05-14  Cary Coutant  <ccoutant@google.com>
1017
1018         * layout.cc (Layout::make_output_section): Mark .tdata section
1019         as RELRO.
1020         * testsuite/relro_test.cc: Add a TLS variable.
1021
1022 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1023
1024         PR gold/14091
1025         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1026         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1027         R_X86_64_64.
1028
1029 2012-05-08  Cary Coutant  <ccoutant@google.com>
1030
1031         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1032         (lines_only_debug_sections): Likewise.
1033
1034 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1035
1036         * nacl.cc: New file.
1037         * nacl.h: New file.
1038         * Makefile.am (CCFILES, HFILES): Add them.
1039         * Makefile.in: Regenerate.
1040         * i386.cc (Output_data_plt_i386_nacl): New class.
1041         (Output_data_plt_i386_nacl_exec): New class.
1042         (Output_data_plt_i386_nacl_dyn): New class.
1043         (Target_i386_nacl): New class.
1044         (Target_selector_i386_nacl): New class.
1045         (target_selector_i386): Use it instead of Target_selector_i386.
1046         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1047         (Target_x86_64_nacl): New class.
1048         (Target_selector_x86_64_nacl): New class.
1049         (target_selector_x86_64, target_selector_x32): Use it instead of
1050         Target_selector_x86_64.
1051         * arm.cc (Output_data_plt_arm_nacl): New class.
1052         (Target_arm_nacl): New class.
1053         (Target_selector_arm_nacl): New class.
1054         (target_selector_arm, target_selector_armbe): Use it instead of
1055         Target_selector_arm.
1056
1057         * target-select.cc (select_target): Take new Input_file* and off_t
1058         arguments, pass them on to recognize method of selector.
1059         * object.cc (make_elf_sized_object): Update caller.
1060         * parameters.cc (parameters_force_valid_target): Likewise.
1061         * incremental.cc (make_sized_incremental_binary): Likewise.
1062         * target-select.h: Update decl.
1063         (Target_selector::recognize): Take new Input_file* argument,
1064         pass it on to do_recognize.
1065         (Target_selector::do_recognize): Take new Input_file* argument.
1066         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1067         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1068         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1069         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1070
1071         * target.h (Target::Target_info): New members isolate_execinstr
1072         and rosegment_gap.
1073         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1074         * arm.cc (Target_arm::arm_info): Update initializer.
1075         * i386.cc (Target_i386::i386_info): Likewise.
1076         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1077         * sparc.cc (Target_sparc::sparc_info): Likewise.
1078         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1079         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1080         * layout.cc (Layout::attach_allocated_section_to_segment):
1081         Take new const Target* argument.  If target->isolate_execinstr(), act
1082         like --rosegment.
1083         (Layout::find_first_load_seg): Take new const Target* argument;
1084         if target->isolate_execinstr(), reject PF_X segments.
1085         (Layout::relaxation_loop_body): Update caller.
1086         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1087         reset file offset to zero when we hit LOAD_SEG, and then do a second
1088         loop over the segments before LOAD_SEG to reassign offsets after
1089         addresses have been determined.  Handle target->rosegment_gap().
1090         (Layout::attach_section_to_segment): Take new const Target* argument;
1091         pass it to attach_allocated_section_to_segment.
1092         (Layout::make_output_section): Update caller.
1093         (Layout::attach_sections_to_segments): Take new const Target* argument;
1094         pass it to attach_section_to_segment.
1095         * gold.cc (queue_middle_tasks): Update caller.
1096         * layout.h (Layout): Update method decls with new arguments.
1097
1098         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1099         Target_info pointer to use.
1100         (Target_arm::do_make_data_plt): New virtual method.
1101         (Target_arm::make_data_plt): New method that calls it.
1102         (Target_arm::make_plt_entry): Use it.
1103         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1104         for the section alignment.
1105         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1106         method.
1107         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1108         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1109         method.
1110         (Output_data_plt_arm::get_plt_entry_size): Call it.
1111         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1112         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1113         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1114         method.
1115         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1116         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1117         method instead of sizeof(plt_entry).
1118         (Output_data_plt_arm::add_entry): Likewise.
1119         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1120         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1121         than static method.
1122         (Target_arm::plt_entry_size): Likewise.
1123         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1124         Move to ...
1125         (Output_data_plt_arm_standard): ... here, new class.
1126         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1127         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1128         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1129
1130         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1131         Take additional argument for the PLT entry size.
1132         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1133         Use get_plt_entry_size method rather than plt_entry_size variable.
1134         (Output_data_plt_x86_64::reserve_slot): Likewise.
1135         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1136         (Output_data_plt_x86_64::add_entry): Likewise.
1137         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1138         (Output_data_plt_x86_64::address_for_global): Likewise.
1139         (Output_data_plt_x86_64::address_for_local): Likewise.
1140         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1141         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1142         Make method non-static.
1143         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1144         method.
1145         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1146         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1147         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1148         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1149         virtual method.
1150         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1151         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1152         virtual method.
1153         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1154         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1155         virtual method.
1156         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1157         (Output_data_plt_x86_64::plt_entry_size)
1158         (Output_data_plt_x86_64::first_plt_entry)
1159         (Output_data_plt_x86_64::plt_entry)
1160         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1161         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1162         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1163         (Output_data_plt_x86_64_standard): ... here, new class.
1164         (Target_x86_64::Target_x86_64): Take optional argument for the
1165         Target_info pointer to use.
1166         (Target_x86_64::do_make_data_plt): New virtual method.
1167         (Target_x86_64::make_data_plt): New method to call it.
1168         (Target_x86_64::init_got_plt_for_update): Use that.
1169         Call this->plt_->add_eh_frame method here.
1170         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1171         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1172         rather than static method.
1173         (Target_x86_64::plt_entry_size): Likewise.
1174         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1175         rather than plt_entry_size variable.  Move guts of PLT filling to...
1176         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1177         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1178         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1179
1180         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1181         additional argument for the section alignment.
1182         Don't do add_eh_frame_for_plt here.
1183         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1184         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1185         variable.
1186         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1187         method.
1188         (Output_data_plt_i386::get_plt_entry_size): Call it.
1189         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1190         (Output_data_plt_i386::add_eh_frame): New method to call it.
1191         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1192         method.
1193         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1194         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1195         method.
1196         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1197         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1198         method instead of plt_entry_size.
1199         (Output_data_plt_i386::plt_entry_size)
1200         (Output_data_plt_i386::plt_eh_frame_fde_size)
1201         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1202         (Output_data_plt_i386_standard): ... here, new class.
1203         (Output_data_plt_i386_exec): New class.
1204         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1205         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1206         (Output_data_plt_i386::exec_plt_entry): Move to ...
1207         (Output_data_plt_i386_exec::plt_entry): ... here.
1208         (Output_data_plt_i386_dyn): New class.
1209         (Output_data_plt_i386::first_plt_entry): Move to ...
1210         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1211         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1212         (Output_data_plt_i386_dyn::plt_entry): ... here.
1213         (Target_i386::Target_i386): Take optional argument for the Target_info
1214         pointer to use.
1215         (Target_i386::do_make_data_plt): New virtual method.
1216         (Target_i386::make_data_plt): New method to call it.
1217         (Target_i386::make_plt_section): Use that.
1218         Call this->plt_->add_eh_frame method here.
1219         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1220         rather than plt_entry_size variable.
1221         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1222         (Output_data_plt_i386::address_for_local): Likewise.
1223         (Output_data_plt_i386::do_write): Likewise.
1224         Move guts of PLT filling to...
1225         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1226         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1227         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1228         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1229
1230 2012-05-01  Cary Coutant  <ccoutant@google.com>
1231
1232         * dwarf_reader.cc (Dwarf_die::read_attributes)
1233         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1234         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1235         * reduced_debug_output.cc
1236         (Output_reduced_debug_info_section::get_die_end): Remove
1237         DW_FORM_GNU_ref_index.  Add default case.
1238
1239 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1240
1241         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1242         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1243         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1244         DW_AT_high_pc as offset from DW_AT_low_pc.
1245
1246         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1247         * testsuite/Makefile.in: Regenerate.
1248         * testsuite/gdb_index_test_3.c: New test source file.
1249         * testsuite/gdb_index_test_3.sh: New test source file.
1250
1251 2012-04-25  Ian Lance Taylor  <iant@google.com>
1252
1253         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1254         pointer.
1255         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1256         as a class, not a struct.
1257         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1258         (Target_arm::apply_cortex_a8_workaround): Likewise.
1259         * gc.h: Declare Reloc_types as a struct, not a class.
1260         * object.h: Declare Symbols_data as a struct.
1261         * reloc.h: Declare Read_relocs_data as a struct.
1262         * target.h: Declare Relocate_info as a struct.
1263
1264 2012-04-24  David S. Miller  <davem@davemloft.net>
1265
1266         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1267         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1268         and R_SPARC_WPLT30.
1269
1270 2012-04-24  Cary Coutant  <ccoutant@google.com>
1271
1272         * incremental-dump.cc (find_input_containing_global): Replace
1273         magic number with symbolic constant.
1274         (dump_incremental_inputs): Update version number.
1275         * incremental.cc (Output_section_incremental_inputs): Update version
1276         number; import symbolic constants from Incremental_inputs_reader.
1277         (Incremental_inputs::create_data_sections): Align relocations
1278         section correctly for 64-bit targets.
1279         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1280         constants; add padding.
1281         (Output_section_incremental_inputs::write_header): Add assert for
1282         header_size.
1283         (Output_section_incremental_inputs::write_input_files): Add assert
1284         for input_entry_size.
1285         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1286         add assert for object_info_size, input_section_entry_size,
1287         global_sym_entry_size.
1288         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1289         for data structure sizes; use them.
1290         (Incremental_input_entry_reader): Import symbolic constants from
1291         Incremental_inputs_reader; use them.
1292
1293 2012-04-23  David S. Miller  <davem@davemloft.net>
1294
1295         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1296         and elf_flags_set_.
1297         (Target_sparc::Target_sparc): Initialize new fields.
1298         (Target_sparc::do_make_elf_object): New function.
1299         (Target_sparc::do_adjust_elf_header): New function.
1300
1301 2012-04-23  Cary Coutant  <ccoutant@google.com>
1302
1303         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1304         CU range table of gdb index.
1305
1306 2012-04-20  David S. Miller  <davem@davemloft.net>
1307
1308         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1309         instead of false.
1310
1311 2012-04-16  David S. Miller  <davem@davemloft.net>
1312
1313         * sparc.cc (Target_sparc::got_address): New function.
1314         (Sparc_relocate_functions::gdop_hix22): New function.
1315         (Sparc_relocate_functions::gdop_lox10): New function.
1316         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1317         relocs.
1318         (Target_sparc::Scan::local): Likewise if the global symbol is not
1319         preemptible and is not IFUNC.
1320         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1321         transformations for local and non-preemptible non-IFUNC global
1322         symbols.
1323
1324         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1325         writing out 64-bit part of ranges.
1326
1327         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1328         -fpic and -fpie respectively.
1329         * Makefile.in: Regenerate.
1330
1331         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1332         (Target_sparc::Target_sparc): Initialize new field.
1333         (Target_sparc::do_plt_section_for_global): New function.
1334         (Target_sparc::do_plt_section_for_local): New function.
1335         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1336         (Target_sparc::make_plt_section): New function, broken out of
1337         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1338         (Target_sparc::make_plt_entry): Call make_plt_section.
1339         (Target_sparc::make_local_ifunc_plt_entry): New function.
1340         (Target_sparc::rela_ifunc_section): New function.
1341         (Target_sparc::plt_section): Remove const.
1342         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1343         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1344         and ifunc_count_ fields.
1345         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1346         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1347         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1348         (Output_data_plt_sparc::rela_ifunc): New function.
1349         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1350         (Output_data_plt_sparc::has_ifunc_section): New function.
1351         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1352         (Output_data_plt_sparc::address_for_global): New function.
1353         (Output_data_plt_sparc::address_for_local): New function.
1354         (Output_data_plt_sparc::plt_index_to_offset): New function.
1355         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1356         and entry_count.
1357         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1358         entry_count.
1359         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1360         R_SPARC_JMP_IREL to switch.
1361         (Target_sparc::Scan::check_non_pic): Likewise.
1362         (Target_sparc::Scan::local): Handle IFUNC symbols.
1363         (Target_sparc::Scan::local): Likewise.
1364         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1365         and plt_address_for_local.
1366         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1367         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1368
1369         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1370         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1371         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1372         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1373         global relocs too.
1374         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1375         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1376         calls.
1377         * sparc.cc (Target_sparc::Scan::global): Likewise.
1378         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1379
1380 2012-04-16  Cary Coutant  <ccoutant@google.com>
1381
1382         * archive.cc (Library_base::should_include_member): Check for
1383         --export-dynamic-symbol.
1384         * options.h (class General_options): Add --export-dynamic-symbol.
1385         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1386         --export-dynamic-symbol.
1387         (Symbol_table::gc_mark_undef_symbols): Likewise.
1388         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1389
1390 2012-04-12  David S. Miller  <davem@davemloft.net>
1391
1392         * sparc.cc (Reloc::wdisp10): New relocation method.
1393         (Reloc::h34): Likewise.
1394         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1395         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1396         R_SPARC_WDISP10.
1397         (Target_sparc::Scan::local): Likewise.
1398         (Target_sparc::Scan::global): Likewise.
1399         (Target_sparc::Relocate::relocate): Likewise.
1400
1401 2012-04-09  Cary Coutant  <ccoutant@google.com>
1402
1403         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1404         low_pc == 0.
1405
1406 2012-04-06  Ian Lance Taylor  <iant@google.com>
1407
1408         * timer.cc: #include <unistd.h>.
1409
1410 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1411
1412         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1413         * config.in: Regenerate.
1414         * configure: Regenerate.
1415
1416 2012-04-05  Nick Clifton  <nickc@redhat.com>
1417
1418         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1419         (AM_LC_MESSAGES): Add.
1420         * aclocal.m4: Regenerate.
1421         * config.in: Regenerate.
1422         * configure: Regenerate.
1423
1424 2012-03-21  Cary Coutant  <ccoutant@google.com>
1425
1426         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1427         * Makefile.in: Regenerate.
1428         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1429         (Sized_elf_reloc_mapper::symbol_section): New function.
1430         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1431         (make_elf_reloc_mapper): New function.
1432         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1433         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1434         (Dwarf_abbrev_table::do_get_abbrev): New function.
1435         (Dwarf_ranges_table::read_ranges_table): New function.
1436         (Dwarf_ranges_table::read_range_list): New function.
1437         (Dwarf_pubnames_table::read_section): New function.
1438         (Dwarf_pubnames_table::read_header): New function.
1439         (Dwarf_pubnames_table::next_name): New function.
1440         (Dwarf_die::Dwarf_die): New function.
1441         (Dwarf_die::read_attributes): New function.
1442         (Dwarf_die::skip_attributes): New function.
1443         (Dwarf_die::set_name): New function.
1444         (Dwarf_die::set_linkage_name): New function.
1445         (Dwarf_die::attribute): New function.
1446         (Dwarf_die::string_attribute): New function.
1447         (Dwarf_die::int_attribute): New function.
1448         (Dwarf_die::uint_attribute): New function.
1449         (Dwarf_die::ref_attribute): New function.
1450         (Dwarf_die::child_offset): New function.
1451         (Dwarf_die::sibling_offset): New function.
1452         (Dwarf_info_reader::check_buffer): New function.
1453         (Dwarf_info_reader::parse): New function.
1454         (Dwarf_info_reader::do_parse): New function.
1455         (Dwarf_info_reader::do_read_string_table): New function.
1456         (Dwarf_info_reader::lookup_reloc): New function.
1457         (Dwarf_info_reader::get_string): New function.
1458         (Dwarf_info_reader::visit_compilation_unit): New function.
1459         (Dwarf_info_reader::visit_type_unit): New function.
1460         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1461         Sized_elf_reloc_mapper.
1462         (Sized_dwarf_line_info::symbol_section): Remove function.
1463         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1464         (Sized_dwarf_line_info::read_line_mappings): Remove object
1465         parameter, adjust callers.
1466         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1467         * dwarf_reader.h: Include <sys/types.h>.
1468         (class Track_relocs): Remove forward declaration.
1469         (class Elf_reloc_mapper): New class.
1470         (class Sized_elf_reloc_mapper): New class.
1471         (class Dwarf_abbrev_table): New class.
1472         (class Dwarf_range_list): New class.
1473         (class Dwarf_ranges_table): New class.
1474         (class Dwarf_pubnames_table): New class.
1475         (class Dwarf_die): New class.
1476         (class Dwarf_info_reader): New class.
1477         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1478         (Sized_dwarf_line_info::symbol_section): Remove member function.
1479         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1480         base class.
1481         * gdb-index.cc: New source file.
1482         * gdb-index.h: New source file.
1483         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1484         and .debug_types sections, call Layout::add_to_gdb_index.
1485         (Sized_relobj_incr::do_section_name): Implement.
1486         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1487         return type; Implement.
1488         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1489         return type.
1490         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1491         parameter list and return type.
1492         (Sized_incr_dynobj::do_section_contents): Likewise.
1493         * layout.cc: Include gdb-index.h.
1494         (Layout::Layout): Initialize gdb_index_data_.
1495         (Layout::init_fixed_output_section): Check for .gdb_index section.
1496         (Layout::add_to_gdb_index): New function. Instantiate.
1497         * layout.h: Add forward declaration for class Gdb_index.
1498         (Layout::add_to_gdb_index): New member function.
1499         (Layout::gdb_index_data_): New data member.
1500         * main.cc: Include gdb-index.h.
1501         (main): Print statistics for gdb index.
1502         * object.cc (Object::section_contents): Move code into
1503         do_section_contents.
1504         (need_decompressed_section): Check for sections needed when building
1505         gdb index.
1506         (build_compressed_section_map): Likewise.
1507         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1508         gdb index.
1509         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1510         sections; call Layout::add_to_gdb_index.
1511         (Sized_relobj_file::do_decompressed_section_contents): Call
1512         do_section_contents directly.
1513         * object.h (Object::do_section_contents): Adjust parameter list and
1514         return type.
1515         (Object::do_decompressed_section_contents): Call do_section_contents
1516         directly.
1517         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1518         return type.
1519         * options.h (class General_options): Add --gdb-index option.
1520         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1521         list and return type.
1522         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1523         * reloc.h (Track_relocs::checkpoint): New function.
1524         (Track_relocs::reset): New function.
1525
1526         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1527         New test cases.
1528         * testsuite/Makefile.in: Regenerate.
1529         * testsuite/gdb_index_test.cc: New test source file.
1530         * testsuite/gdb_index_test_1.sh: New test source file.
1531         * testsuite/gdb_index_test_2.sh: New test source file.
1532
1533 2012-03-19  Doug Kwan  <dougkwan@google.com>
1534
1535         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1536         (Target_arm::do_finalize_sections): Remove code which defines
1537         __exidx_start and __exidx_end.  Make symbol table parameter
1538         anonymous as it is not used.
1539         * gold.cc (queue_middle_tasks): Call target hook to define any
1540         target-specific symbols.
1541         * target.h (Target::define_standard_symbols): New method.
1542         (Target::do_define_standard_symbols): Same.
1543         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1544         * testsuite/Makefile.in: Regenerate.
1545         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1546         and __exidx_end.
1547         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1548         relocations are generated for __exidx_start and __exidx_end.
1549
1550 2012-03-16  Doug Kwan  <dougkwan@google.com>
1551
1552         * testsuite/Makefile.am: Disable test initpri3b.
1553         * testsuite/Makefile.in: Regenerate.
1554
1555 2012-03-15  Doug Kwan  <dougkwan@google.com>
1556
1557         * arm.cc (Target_arm::got_section): Make .got section read-only
1558         if -z now is given.
1559
1560 2012-03-15  Ian Lance Taylor  <iant@google.com>
1561
1562         PR gold/13850
1563         * layout.cc (Layout::make_output_section): Correctly mark
1564         SHT_INIT_ARRAY, et. al., as relro.
1565
1566 2012-03-14  Doug Kwan  <dougkwan@google.com>
1567
1568         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1569         dynamic relocations for protected symbols in shared objects.
1570
1571 2012-03-13  Ian Lance Taylor  <iant@google.com>
1572
1573         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1574         keep the larger alignment.
1575
1576 2012-03-12  Cary Coutant  <ccoutant@google.com>
1577
1578         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1579         handling of DW_LNE_define_file.
1580
1581 2012-03-12  Cary Coutant  <ccoutant@google.com>
1582
1583         * reduced_debug_output.cc
1584         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1585         codes to switch.
1586
1587 2012-02-29  Cary Coutant  <ccoutant@google.com>
1588
1589         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1590
1591 2012-02-29  Cary Coutant  <ccoutant@google.com>
1592
1593         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1594         Call Object::decompressed_section_contents.
1595         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1596         New dtor.
1597         (Sized_dwarf_line_info::buffer_start_): New data member.
1598         * merge.cc (Output_merge_data::do_add_input_section): Call
1599         Object::decompressed_section_contents.
1600         (Output_merge_string::do_add_input_section): Likewise.
1601         * object.cc (need_decompressed_section): New function.
1602         (build_compressed_section_map): Decompress sections needed later.
1603         (Sized_relobj_file::do_decompressed_section_contents): New function.
1604         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1605         * object.h (Object::decompressed_section_contents): New function.
1606         (Object::discard_decompressed_sections): New function.
1607         (Object::do_decompressed_section_contents): New function.
1608         (Object::do_discard_decompressed_sections): New function.
1609         (Compressed_section_info): New type.
1610         (Compressed_section_map): Include decompressed section contents.
1611         (Sized_relobj_file::do_decompressed_section_contents): New function.
1612         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1613
1614 2012-02-16  Cary Coutant  <ccoutant@google.com>
1615
1616         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1617         * testsuite/Makefile.in: Regenerate.
1618
1619 2012-02-14  Cary Coutant  <ccoutant@google.com>
1620
1621         * options.cc (General_options::finalize): Disallow -pie and -static.
1622
1623 2012-02-03  Doug Kwan  <dougkwan@google.com>
1624
1625         * arm.cc (Arm_relocate_functions::abs8,
1626         Arm_relocate_functions::abs16): Use
1627         Bits::has_signed_unsigned_overflow32.
1628         (Arm_relocate_functions::thm_abs8): Correct range of
1629         overflow check.
1630         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1631         in assertions.
1632
1633 2012-02-02  Doug Kwan  <dougkwan@google.com>
1634
1635         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1636         position independent outputs, not just shared objects.
1637
1638 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1639
1640         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1641         * configure: Regenerated.
1642
1643 2012-01-27  Ian Lance Taylor  <iant@google.com>
1644
1645         * reloc.h (Bits): New class with static functions, copied from
1646         namespace utils in arm.cc.
1647         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1648         instead.
1649
1650 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1651
1652         * incremental.cc (write_info_blocks): Correct relocation offset.
1653
1654 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1655
1656         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1657         (Relocate::tls_gd_to_le): Likewise.
1658
1659 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1660
1661         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1662
1663 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1664
1665         * configure.ac: Check if -mcmodel=medium works.
1666         * configure: Regenerated.
1667
1668 2012-01-24  Cary Coutant  <ccoutant@google.com>
1669
1670         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1671         definition and ...
1672         (read_unsigned_LEB_128_x): ... this new function.
1673         (read_signed_LEB_128): Replaced with inline definition and ...
1674         (read_signed_LEB_128_x): ... this new function.
1675         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1676         (read_unsigned_LEB_128): Add inline definition.
1677         (read_signed_LEB_128_x): New function.
1678         (read_signed_LEB_128): Add inline definition.
1679         * testsuite/Makefile.am (leb128_unittest): New unit test.
1680         * testsuite/Makefile.in: Regenerate.
1681         * testsuite/leb128_unittest.cc: New unit test.
1682
1683 2012-01-23  Ian Lance Taylor  <iant@google.com>
1684
1685         PR gold/13617
1686         * i386.cc (Target_i386::do_code_fill): When using a jmp
1687         instruction, pad with nop instructions.
1688         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1689
1690 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1691
1692         * x86_64.cc (gc_process_relocs): Add typename on types used in
1693         template.
1694         (scan_relocs): Likewise.
1695         (relocate_section): Likewise.
1696         (apply_relocation): Likewise.
1697
1698 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1699
1700         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1701         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1702         under x32.
1703
1704 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1705
1706         * x86_64.cc: Initial support for x32.
1707
1708 2012-01-03  Cary Coutant  <ccoutant@google.com>
1709
1710         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1711         Use abstract base class for GOT.
1712         * gold/output.h (class Output_data_got_base): New abstract base class.
1713         (class Output_data_got): Derive from new base class, adjust ctors.
1714         (Output_data_got::reserve_slot): Make virtual; rename to
1715         do_reserve_slot; Adjust callers.
1716         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1717         pointer to abstract base class.
1718         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1719
1720 2011-12-18  Ian Lance Taylor  <iant@google.com>
1721
1722         * object.h (Relobj::local_symbol_value): New function.
1723         (Relobj::local_plt_offset): New function.
1724         (Relobj::local_has_got_offset): New function.
1725         (Relobj::local_got_offset): New function.
1726         (Relobj::set_local_got_offset): New function.
1727         (Relobj::do_local_symbol_value): New pure virtual function.
1728         (Relobj::do_local_plt_offset): Likewise.
1729         (Relobj::do_local_has_got_offset): Likewise.
1730         (Relobj::do_local_got_offset): Likewise.
1731         (Relobj::do_set_local_got_offset): Likewise.
1732         (Sized_relobj::do_local_has_got_offset): Rename from
1733         local_has_got_offset.
1734         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1735         (Sized_relobj::do_set_local_got_offset): Rename from
1736         set_local_got_offset.
1737         (Sized_relobj_file::do_local_plt_offset): Rename from
1738         local_plt_offset.
1739         (Sized_relobj_file::do_local_symbol_value): New function.
1740         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1741         local_plt_offset.
1742         * output.cc (Output_data_got::Got_entry::write): Change object to
1743         Relobj.  Use local_symbol_value.
1744         (Output_data_got::add_global_with_rel): Change rel_dyn to
1745         Output_data_reloc_generic*.  Use add_global_generic.
1746         (Output_data_got::add_global_with_rela): Remove.  Change all
1747         callers to use add_global_with_rel.
1748         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1749         Output_data_reloc_generic*.  Use add_global_generic.
1750         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1751         callers to use add_global_pair_with_rel.
1752         (Output_data_got::add_local): Change object to Relobj*.
1753         (Output_data_got::add_local_plt): Likewise.
1754         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1755         change rel_dyn to Output_data_reloc_generic*.  Use
1756         add_local_generic.
1757         (Output_data_got::add_local_with_rela): Remove.  Change all
1758         callers to use all_local_with_rel.
1759         (Output_data_got::add_local_pair_with_rel): Change object to
1760         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1761         add_output_section_generic.
1762         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1763         callers to use add_local_pair_with_rel.
1764         (Output_data_got::reserve_local): Change object to Relobj*.
1765         * output.h: (class Output_data_reloc_generic): Add pure virtual
1766         declarations for add_global_generic, add_local_generic,
1767         add_output_section_generic.
1768         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1769         functions for Output_data_reloc_generic.  Update declarations for
1770         changes listed in output.cc.
1771         (class Output_data_got): Change template parameter to got_size.
1772         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1773         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1774         function.
1775         (Sized_relobj_incr::do_local_plt_offset): New function.
1776         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1777         add_global_generic.
1778
1779 2011-12-17  Cary Coutant  <ccoutant@google.com>
1780
1781         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1782         * resolve.cc (Symbol_table::resolve): Likewise.
1783         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1784         arrays.
1785         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1786
1787 2011-12-16  Ian Lance Taylor  <iant@google.com>
1788
1789         * output.h (Output_data_reloc_generic::add): Only call
1790         add_dynamic_reloc if this is a dynamic reloc section.
1791
1792 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1793
1794         PR gold/13505
1795         * target-reloc.h (apply_relocation): Replace <64, false> with
1796         <size, big_endian>.
1797
1798 2011-11-25  Nick Clifton  <nickc@redhat.com>
1799
1800         * po/it.po: New Italian translation.
1801
1802 2011-11-17  Sterling Augustine  <saugustine@google.com>
1803
1804         * script.cc (script_include_directive): Implement.
1805         (read_script_file): New local variables name and search_path. Update
1806         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1807         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1808         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1809
1810 2011-11-11  Sterling Augustine  <saugustine@google.com>
1811
1812         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1813         (file_or_sections_cmd): Likewise.
1814
1815 2011-11-11  Doug Kwan  <dougkwan@google.com>
1816
1817         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1818         if --just-symbols is given.
1819
1820 2011-11-10  Doug Kwan  <dougkwan@google.com>
1821
1822         PR gold/13362
1823         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1824         when processing data relocs.
1825         * reloc.h (Relocate_functions::rel_unaligned): New method.
1826         (Relocate_functions::pcrel_unaligned): Ditto.
1827         (Relocate_functions::rel32_unaligned): Ditto.
1828         (Relocate_functions::pcrel32_unaligned): Ditto.
1829
1830 2011-11-09  Doug Kwan  <dougkwan@google.com>
1831
1832         PR gold/13362
1833         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1834         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1835         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1836         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1837         (Relocate_functions::rel_unaligned): New.
1838         (Relocate_functions::rel32_unaligned): New.
1839         * target-reloc.h (relocate_for_relocatable): Add code to handle
1840         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1841         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1842         arm_unaligned_reloc_r): New targets.
1843         * testsuite/Makefile.in: Regenerate.
1844         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1845         linking.
1846
1847 2011-11-02  Ian Lance Taylor  <iant@google.com>
1848
1849         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1850         NATIVE_LINKER.
1851         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1852         * options.cc (General_options::finalize): Use library search path
1853         from configure script if specified.  If not native and no sysroot,
1854         only search TOOLLIBDIR.
1855         * options.h (Search_directory::Search_directory): Change name to
1856         const std::string&.
1857         (General_options::add_to_library_path_with_sysroot): Change arg to
1858         const std::string&.
1859         * configure, Makefile.in, config.in: Rebuild.
1860
1861 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1862
1863         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1864         we are working around the ARM1176 Erratum.
1865         * options.h (General_options::fix_arm1176): Add option.
1866         * testsuite/Makefile.am: Add testcases, and keep current ones
1867         working.
1868         * testsuite/Makefile.in: Regenerate.
1869         * testsuite/arm_fix_1176.s: New file.
1870         * testsuite/arm_fix_1176.sh: Likewise.
1871
1872 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1873
1874         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1875         may_use_blx_.
1876         (Target_arm::may_use_blx): Remove method.
1877         (Target_arm::set_may_use_blx): Likewise.
1878         (Target_arm::may_use_v4t_interworking): New method.
1879         (Target_arm::may_use_v5t_interworking): Likewise.
1880         (Target_arm::may_use_blx_): Remove member variable.
1881         (Arm_relocate_functions::arm_branch_common): Check for v5T
1882         interworking.
1883         (Arm_relocate_functions::thumb_branch_common): Likewise.
1884         (Reloc_stub::stub_type_for_reloc): Likewise.
1885         (Target_arm::do_finalize_sections): Correct interworking checks.
1886         * testsuite/Makefile.am: Add new tests.
1887         * testsuite/Makefile.in: Regenerate.
1888         * testsuite/arm_farcall_arm_arm.s: New test.
1889         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1890         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1891         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1892         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1893         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1894         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1895         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1896
1897 2011-10-31  Cary Coutant  <ccoutant@google.com>
1898
1899         PR gold/13023
1900         * expression.cc (Expression::eval_with_dot): Add
1901         is_section_dot_assignment parameter.
1902         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1903         absolute and assigning to dot within a section.
1904         * script-sections.cc
1905         (Output_section_element_assignment::set_section_addresses): Pass
1906         dot_section to set_if_absolute.
1907         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1908         as is_section_dot_assignment flag to eval_with_dot.
1909         (Output_section_element_dot_assignment::set_section_addresses):
1910         Likewise.
1911         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1912         parameter.  Also set value if relative to dot_section; set the
1913         symbol's output_section.
1914         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1915         parameter.  Adjust all callers.
1916         (Expression::eval_maybe_dot): Likewise.
1917         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1918         Adjust all callers.
1919         * testsuite/script_test_2.t: Test assignment of an absolute value
1920         to dot within an output section element.
1921
1922 2011-10-31  Cary Coutant  <ccoutant@google.com>
1923
1924         * options.h (class General_options): Add --[no-]gnu-unique options.
1925         * symtab.cc (Symbol_table::sized_write_globals): Convert
1926         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1927
1928 2011-10-31  Cary Coutant  <ccoutant@google.com>
1929
1930         PR gold/13359
1931         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1932         unnecessary assertion.
1933         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1934
1935 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1936
1937         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1938         gc_mark_symbol.
1939         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1940         gc_mark_symbol.
1941         Change to just keep the section associated with symbol.
1942         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1943         they are externally visible and --export-dynamic is turned on.
1944         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1945
1946 2011-10-19  Ian Lance Taylor  <iant@google.com>
1947
1948         PR gold/13163
1949         * script-sections.cc
1950         (Output_section_element_dot_assignment::needs_output_section): New
1951         function.
1952
1953 2011-10-19  Ian Lance Taylor  <iant@google.com>
1954
1955         PR gold/13204
1956         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1957         --section-start option was seen.
1958         * options.h (General_options::any_section_start): New function.
1959
1960 2011-10-18  David S. Miller  <davem@davemloft.net>
1961
1962         PR binutils/13301
1963         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1964         member to track relocation locations that have moved during TLS
1965         reloc optimizations.
1966         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1967         (Target_sparc::Relocate::relocate): Adjust view down by 4
1968         bytes if it matches reloc_adjust_addr_.
1969         (Target_sparc::Relocate::relocate_tls): Always move the
1970         __tls_get_addr call delay slot instruction forward 4 bytes when
1971         performing relaxation.
1972
1973 2011-10-18  Cary Coutant  <ccoutant@google.com>
1974
1975         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1976         (Output_file::map_no_anonymous): Check for non-zero
1977         return code from posix_fallocate.
1978
1979 2011-10-17  Cary Coutant  <ccoutant@google.com>
1980
1981         PR gold/13245
1982         * plugin.cc (is_visible_from_outside): Check for symbols
1983         referenced from dynamic objects.
1984         * resolve.cc (Symbol_table::resolve): Don't count references
1985         from dynamic objects as references from real ELF files.
1986         * testsuite/plugin_test_2.sh: Adjust expected result.
1987
1988 2011-10-17  Cary Coutant  <ccoutant@google.com>
1989
1990         * gold.cc: Include timer.h.
1991         (queue_middle_tasks): Stamp time.
1992         (queue_final_tasks): Likewise.
1993         * main.cc (main): Store timer in parameters.  Print timers
1994         for each pass.
1995         * parameters.cc (Parameters::Parameters): Initialize timer_.
1996         (Parameters::set_timer): New function.
1997         (set_parameters_timer): New function.
1998         * parameters.h (Parameters::set_timer): New function.
1999         (Parameters::timer): New function.
2000         (Parameters::timer_): New data member.
2001         (set_parameters_timer): New function.
2002         * timer.cc (Timer::stamp): New function.
2003         (Timer::get_pass_time): New function.
2004         * timer.h (Timer::stamp): New function.
2005         (Timer::get_pass_time): New function.
2006         (Timer::pass_times_): New data member.
2007
2008 2011-10-17  Cary Coutant  <ccoutant@google.com>
2009
2010         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2011         task for members of lib groups.
2012
2013 2011-10-17  Cary Coutant  <ccoutant@google.com>
2014
2015         PR gold/13288
2016         * fileread.cc (File_read::find_view): Add assert.
2017         (File_read::make_view): Move bounds check (replace with assert)...
2018         (File_read::find_or_make_view): ... to here.
2019
2020 2011-10-12  Cary Coutant  <ccoutant@google.com>
2021
2022         * output.cc (Output_file::open_base_file): Handle case where
2023         ::read returns less than requested size.
2024
2025 2011-10-10  Cary Coutant  <ccoutant@google.com>
2026
2027         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2028         Initialize defined_count_.
2029         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2030         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2031         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2032         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2033         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2034         * incremental.h (Sized_relobj_incr::defined_count_): New data
2035         member.
2036         (Sized_incr_dynobj::defined_count_): New data member.
2037         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2038         Return zeroes instead of internal error.
2039
2040 2011-10-10  Cary Coutant  <ccoutant@google.com>
2041
2042         PR gold/13249
2043         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2044         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2045         * output.h (class Output_reloc): Add use_plt_offset flag.
2046         (Output_reloc::type_): Adjust size of bit field.
2047         (Output_reloc::use_plt_offset_): New bit field.
2048         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2049         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2050         flag.  Adjust all callers.
2051         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2052         creating RELATIVE relocations.
2053
2054 2011-10-10  Nick Clifton  <nickc@redhat.com>
2055
2056         * po/es.po: Updated Spanish translation.
2057         * po/fi.po: Updated Finnish translation.
2058
2059 2011-10-03   Diego Novillo  <dnovillo@google.com>
2060
2061         * options.cc (parse_uint): Fix dereference of RETVAL.
2062
2063 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2064
2065         * layout.h (section_order_map_): New member.
2066         (get_section_order_map): New member function.
2067         * output.cc (Output_section::add_input_section): Check for patterns
2068         only when --section-ordering-file is specified.
2069         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2070         output_sections have been formed.
2071         * layout.cc (Layout_Layout): Initialize section_order_map_.
2072         * plugin.cc (update_section_order): Store order in order_map. Do not
2073         update the order.
2074         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2075         * testsuite/Makefile.in: Regenerate.
2076         * testsuite/plugin_section_order.c: New file.
2077         * testsuite/plugin_final_layout.cc: New file.
2078         * testsuite/plugin_final_layout.sh: New file.
2079
2080 2011-09-29  Cary Coutant  <ccoutant@google.com>
2081
2082         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2083         Check for NULL.
2084         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2085         symbols during incremental update.
2086         (Symbol_table::add_from_dynobj): Likewise.
2087
2088 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2089             Ian Lance Taylor  <iant@google.com>
2090
2091         * symtab.cc (Symbol_table::define_special_symbol): Always
2092         canonicalize version string.
2093
2094 2011-09-26  Cary Coutant  <ccoutant@google.com>
2095
2096         * gold.cc (queue_initial_tasks): Move option checks ...
2097         * options.cc (General_options::finalize): ... to here. Disable
2098         some options; make others fatal.
2099
2100 2011-09-26  Cary Coutant  <ccoutant@google.com>
2101
2102         gcc PR lto/47247
2103         * plugin.cc (get_symbols_v2): New function.
2104         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2105         (is_referenced_from_outside): New function.
2106         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2107         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2108         (get_symbols): Pass version parameter.
2109         (get_symbols_v2): New function.
2110         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2111         parameter.
2112         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2113         (onload): Add LDPT_GET_SYMBOLS_V2.
2114         (all_symbols_read_hook): Use get_symbols_v2; check for
2115         LDPR_PREVAILING_DEF_IRONLY_EXP.
2116         * testsuite/plugin_test_3.sh: Update expected results.
2117
2118 2011-09-23  Simon Baldwin  <simonb@google.com>
2119
2120         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2121         configuration options.
2122         * configure: Regenerate.
2123         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2124         * Makefile.in: Regenerate.
2125         * testsuite/Makefile.in: Regenerate.
2126
2127 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2128
2129         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2130
2131 2011-09-19  Cary Coutant  <ccoutant@google.com>
2132
2133         * incremental.cc (can_incremental_update): Fix typo in comment.
2134         * incremental.h (can_incremental_update): Likewise.
2135
2136 2011-09-18  Cary Coutant  <ccoutant@google.com>
2137
2138         * incremental.cc (can_incremental_update): New function.
2139         * incremental.h (can_incremental_update): New function.
2140         * layout.cc (Layout::init_fixed_output_section): Call it.
2141         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2142         * object.cc (Sized_relobj_file::do_layout): Call
2143         can_incremental_update.
2144
2145 2011-09-13  Cary Coutant  <ccoutant@google.com>
2146
2147         * configure.ac: Check for glibc support for gnu_indirect_function
2148         support with static linking, setting automake conditional
2149         IFUNC_STATIC.
2150         * Makefile.in: Regenerate.
2151         * configure: Regenerate.
2152
2153         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2154         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2155         for IFUNC_STATIC.
2156         * testsuite/Makefile.in: Regenerate.
2157
2158 2011-09-13  Cary Coutant  <ccoutant@google.com>
2159
2160         * incremental.cc (Sized_relobj_incr::do_layout): Call
2161         report_comdat_group for kept comdat sections.
2162         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2163         * testsuite/Makefile.in: Regenerate.
2164         * testsuite/incr_comdat_test_1.cc: New source file.
2165         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2166         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2167         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2168
2169 2011-09-13  Ian Lance Taylor  <iant@google.com>
2170
2171         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2172         variable external_symbols_offset.
2173
2174 2011-09-12  Ian Lance Taylor  <iant@google.com>
2175
2176         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2177         triggered if object has no symbols.
2178
2179 2011-09-09  David S. Miller  <davem@davemloft.net>
2180
2181         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2182         (Output_fill_debug_line::do_write): Likewise.
2183
2184 2011-08-29  Cary Coutant  <ccoutant@google.com>
2185
2186         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2187         casts to match formatting specs.
2188         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2189
2190 2011-08-26  Cary Coutant  <ccoutant@google.com>
2191
2192         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2193         remaining hole size when allocating.
2194         (Layout::make_output_section): Set fill methods for debug sections.
2195         * layout.h (Free_list::Free_list_node): Move from private to
2196         public.
2197         (Free_list::set_min_hole_size): New function.
2198         (Free_list::begin, Free_list::end): New functions.
2199         (Free_list::min_hole_): New data member.
2200         * output.cc: Include dwarf.h.
2201         (Output_fill_debug_info::do_minimum_hole_size): New function.
2202         (Output_fill_debug_info::do_write): New function.
2203         (Output_fill_debug_line::do_minimum_hole_size): New function.
2204         (Output_fill_debug_line::do_write): New function.
2205         (Output_section::Output_section): Initialize new data member.
2206         (Output_section::set_final_data_size): Ensure patch space is larger
2207         than minimum hole size.
2208         (Output_section::do_write): Fill holes in debug sections.
2209         * output.h (Output_fill): New class.
2210         (Output_fill_debug_info): New class.
2211         (Output_fill_debug_line): New class.
2212         (Output_section::set_free_space_fill): New function.
2213         (Output_section::free_space_fill_): New data member.
2214         * testsuite/Makefile.am (incremental_test_3): Add
2215         --incremental-patch option.
2216         (incremental_test_4): Likewise.
2217         (incremental_test_5): Likewise.
2218         (incremental_test_6): Likewise.
2219         (incremental_copy_test): Likewise.
2220         (incremental_common_test_1): Likewise.
2221         * testsuite/Makefile.in: Regenerate.
2222
2223 2011-08-26  Nick Clifton  <nickc@redhat.com>
2224
2225         * po/es.po: Updated Spanish translation.
2226
2227 2011-08-01  Cary Coutant  <ccoutant@google.com>
2228
2229         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2230         * gold/testsuite/Makefile.in: Regenerate.
2231         * gold/testsuite/justsyms_exec.c: New source file.
2232         * gold/testsuite/justsyms_lib.c: New source file.
2233
2234 2011-08-01  Cary Coutant  <ccoutant@google.com>
2235
2236         * layout.cc (Layout::set_segment_offsets): Don't realign text
2237         segment if -Ttext was specified.
2238         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2239         file type.
2240         * object.h (Sized_relobj_file::e_type): New function.
2241         (Sized_relobj_file::e_type_): New data member.
2242         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2243         base address for ET_EXEC files.
2244         * target.cc (Target::do_make_elf_object_implementation): Allow
2245         ET_EXEC files with --just-symbols option.
2246
2247 2011-07-28  Cary Coutant  <ccoutant@google.com>
2248
2249         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2250         Add thread_number parameter.
2251         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2252         * workqueue-threads.cc
2253         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2254         current thread if its thread number is greater than desired thread
2255         count.
2256         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2257         Add thread_number parameter.
2258         (Workqueue::should_cancel_thread): Likewise.
2259         (Workqueue::find_runnable_or_wait): Pass thread_number to
2260         should_cancel_thread.
2261         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2262         parameter.
2263
2264 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2265
2266         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2267         only after checking if it cannot be forced local.
2268         * symtab.h (is_externally_visible): Check if the symbol is not forced
2269         local.
2270
2271 2011-07-15  Ian Lance Taylor  <iant@google.com>
2272
2273         * options.h (class General_options): Add --print-output-format.
2274         Move -EL next to -EB, for  better --help output.
2275         * target-select.cc: Include <cstdio>, "options.h", and
2276         "parameters.h".
2277         (Target_selector::do_target_bfd_name): New function.
2278         (print_output_format): New function.
2279         * target-select.h (class Target_selector): Update declarations.
2280         (Target_selector::target_bfd_name): New function.
2281         (print_output_format): Declare.
2282         * main.cc: Include "target-select.h".
2283         (main): Handle --print-output-format.
2284         * gold.cc: Include "target-select.h".
2285         (queue_initial_tasks): Handle --print-output-format when there are
2286         no input files.
2287         * parameters.cc (parameters_force_valid_target): Give a better
2288         error message if -EB/-EL does not match target.
2289         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2290         function.
2291
2292 2011-07-15  Ian Lance Taylor  <iant@google.com>
2293
2294         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2295         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2296         (Output_data_plt_i386::do_write): Write address of .dynamic
2297         section to first entry in .got.plt section.
2298         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2299         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2300         Initialize layout_.
2301         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2302         section to first entry in .got.plt section.
2303         * layout.h (Layout::dynamic_section): New function.
2304
2305 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2306
2307         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2308         to claim_file call.
2309         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2310         input_section_position_, and input_section_glob_.
2311         (read_layout_from_file): Call function section_ordering_specified.
2312         * layout.h (is_section_ordering_specified): New function.
2313         (section_ordering_specified): New function.
2314         (section_ordering_specified_): New boolean member.
2315         * main.cc(main): Call load_plugins after layout object is defined.
2316         * output.cc (Output_section::add_input_section): Use
2317         function section_ordering_specified to check if section ordering is
2318         needed.
2319         * output.cc (Output_section::add_relaxed_input_section): Use
2320         function section_ordering_specified to check if section ordering is
2321         needed.
2322         (Output_section::update_section_layout): New function.
2323         (Output_section::sort_attached_input_sections): Check if input section
2324         must be reordered.
2325         * output.h (Output_section::update_section_layout): New function.
2326         * plugin.cc (get_section_count): New function.
2327         (get_section_type): New function.
2328         (get_section_name): New function.
2329         (get_section_contents): New function.
2330         (update_section_order): New function.
2331         (allow_section_ordering): New function.
2332         (Plugin::load): Add the new interfaces to the transfer vector.
2333         (Plugin_manager::load_plugins): New parameter.
2334         (Plugin_manager::all_symbols_read): New parameter.
2335         (Plugin_manager::claim_file): New parameter. Save the elf object for
2336         unclaimed objects.
2337         (Plugin_manager::get_elf_object): New function.
2338         (Plugin_manager::get_view): Change to directly use the bool to check
2339         if get_view is called from claim_file_hook.
2340         * plugin.h (input_objects): New function
2341         (Plugin__manager::load_plugins): New parameter.
2342         (Plugin_manager::claim_file): New parameter.
2343         (Plugin_manager::get_elf_object): New function.
2344         (Plugin_manager::in_claim_file_handler): New function.
2345         (Plugin_manager::in_claim_file_handler_): New member.
2346         (layout): New function.
2347         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2348         handler with an extra parameter. Make the elf object before calling
2349         claim_file handler.
2350         * testsuite/plugin_test.c (get_section_count): New function pointer.
2351         (get_section_type): New function pointer.
2352         (get_section_name): New function pointer.
2353         (get_section_contents): New function pointer.
2354         (update_section_order): New function pointer.
2355         (allow_section_ordering): New function pointer.
2356         (onload): Check if the new interfaces exist.
2357
2358 2011-07-13  Ian Lance Taylor  <iant@google.com>
2359
2360         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2361         relro section.
2362         * x86_64.cc (Target_x86_64::got_section): Likewise.
2363         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2364         (relro_now_test_SOURCES): New variable.
2365         (relro_now_test_DEPENDENCIES): New variable.
2366         (relro_now_test_LDFLAGS): New variable.
2367         (relro_now_test_LDADD): New variable.
2368         (relro_now_test.so): New target.
2369         * testsuite/Makefile.in: Rebuild.
2370
2371 2011-07-12  Ian Lance Taylor  <iant@google.com>
2372
2373         PR gold/12980
2374         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2375         GLOB_DAT relocation rather than a RELATIVE relocation for a
2376         protected symbol when creating a shared library.
2377         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2378         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2379         * testsuite/protected_main_1.cc (main): Test that protected
2380         function has same address.
2381
2382 2011-07-11  Ian Lance Taylor  <iant@google.com>
2383
2384         PR gold/12979
2385         * options.h (class General_options): Add -Bgroup.
2386         * options.cc (General_options::finalize): If -Bgroup is set,
2387         default to --unresolved-symbols=report-all.
2388         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2389         * target-reloc.h (issue_undefined_symbol_error): Handle
2390         --unresolved-symbols=report-all.
2391
2392 2011-07-08  Ian Lance Taylor  <iant@google.com>
2393
2394         PR gold/11985
2395         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2396         if linker script discards key sections.
2397         (Layout::create_dynamic_symtab): Likewise.
2398         (Layout::assign_local_dynsym_offsets): Likewise.
2399         (Layout::sized_create_version_sections): Likewise.
2400         (Layout::create_interp): Likewise.
2401         (Layout::finish_dynamic_section): Likewise.
2402         (Layout::set_dynamic_symbol_size): Likewise.
2403
2404 2011-07-08  Ian Lance Taylor  <iant@google.com>
2405
2406         PR gold/12386
2407         * options.h (class General_options): Add --unresolved-symbols.
2408         * target-reloc.h (issue_undefined_symbol_error): Check
2409         --unresolved-symbols.  Add comments.
2410
2411 2011-07-08  Ian Lance Taylor  <iant@google.com>
2412
2413         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2414         expression more complex.
2415
2416 2011-07-08  Ian Lance Taylor  <iant@google.com>
2417
2418         PR gold/11317
2419         * target-reloc.h (issue_undefined_symbol_error): New inline
2420         function, broken out of relocate_section.
2421         (relocate_section): Call issue_undefined_symbol_error.
2422         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2423         there is no TLS segment if we are about to issue an undefined
2424         symbol error.
2425         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2426
2427 2011-07-08  Ian Lance Taylor  <iant@google.com>
2428
2429         PR gold/12279
2430         * resolve.cc (Symbol_table::should_override): Add fromtype
2431         parameter.  Change all callers.  Give error when linking together
2432         TLS and non-TLS symbol.
2433         (Symbol_table::should_override_with_special): Add fromtype
2434         parameter.  Change all callers.
2435         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2436         there is no TLS segment if we have reported some errors.
2437         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2438
2439 2011-07-08  Ian Lance Taylor  <iant@google.com>
2440
2441         PR gold/12372
2442         * target.h (Target::plt_address_for_global): New function.
2443         (Target::plt_address_for_local): New function.
2444         (Target::plt_section_for_global): Remove.
2445         (Target::plt_section_for_local): Remove.
2446         (Target::do_plt_address_for_global): New virtual function.
2447         (Target::do_plt_address_for_local): New virtual function.
2448         (Target::do_plt_section_for_global): Remove.
2449         (Target::do_plt_section_for_local): Remove.
2450         (Target::register_global_plt_entry): Add Symbol_table and Layout
2451         parameters.
2452         * output.cc (Output_data_got::Got_entry::write): Use
2453         plt_address_for_global and plt_address_for_local.
2454         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2455         address of output section.
2456         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2457         got_irelative_, and irelative_count_ fields.  Update
2458         declarations.
2459         (Output_data_plt_i386::has_irelative_section): New function.
2460         (Output_data_plt_i386::entry_count): Add irelative_count_.
2461         (Output_data_plt_i386::set_final_data_size): Likewise.
2462         (class Target_i386): Add got_irelative_ and rel_irelative_
2463         fields.  Update declarations.
2464         (Target_i386::Target_i386): Initialize new fields.
2465         (Target_i386::do_plt_address_for_global): New function replacing
2466         do_plt_section_for_global.
2467         (Target_i386::do_plt_address_for_local): New function replacing
2468         do_plt_section_for_local.
2469         (Target_i386::got_section): Create got_irelative_.
2470         (Target_i386::rel_irelative_section): New function.
2471         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2472         fields.  Don't define __rel_iplt_{start,end}.
2473         (Output_data_plt_i386::add_entry): Add symtab and layout
2474         parameters.  Change all callers.  Use different PLT and GOT for
2475         IFUNC symbols.
2476         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2477         layout parameters.  Change all callers.  Use different PLT and
2478         GOT.
2479         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2480         (Output_data_plt_i386::rel_irelative): New function.
2481         (Output_data_plt_i386::address_for_global): New function.
2482         (Output_data_plt_i386::address_for_local): New function.
2483         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2484         IRELATIVE GOT when changing IFUNC GOT entries.
2485         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2486         reloc.
2487         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2488         if we didn't create an IRELATIVE GOT.
2489         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2490         plt_address_for_local.
2491         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2492         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2493         got_irelative_, and irelative_count_ fields.  Update
2494         declarations.
2495         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2496         Initialize new fields.  Remove symtab parameter.  Change all
2497         callers.
2498         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2499         irelative_count_.
2500         (Output_data_plt_x86_64::has_irelative_section): New function.
2501         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2502         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2503         fields.  Update declarations.
2504         (Target_x86_64::Target_x86_64): Initialize new fields.
2505         (Target_x86_64::do_plt_address_for_global): New function replacing
2506         do_plt_section_for_global.
2507         (Target_x86_64::do_plt_address_for_local): New function replacing
2508         do_plt_section_for_local.
2509         (Target_x86_64::got_section): Create got_irelative_.
2510         (Target_x86_64::rela_irelative_section): New function.
2511         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2512         all callers.  Don't create __rel_iplt_{start,end}.
2513         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2514         parameters.  Change all callers.  Use different PLT and GOT for
2515         IFUNC symbols.
2516         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2517         layout parameters.  Change all callers.  Use different PLT and
2518         GOT.
2519         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2520         parameters.  Change all callers.  Use different PLT and GOT for
2521         IFUNC symbols.
2522         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2523         (Output_data_plt_x86_64::rela_irelative): New function.
2524         (Output_data_plt_x86_64::address_for_global): New function.
2525         (Output_data_plt_x86_64::address_for_local): New function.
2526         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2527         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2528         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2529         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2530         parameters.
2531         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2532         reloc.
2533         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2534         symbols if we didn't create an IRELATIVE GOT.
2535         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2536         plt_address_for_local.
2537         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2538         * testsuite/ifuncvar1.c: New test file.
2539         * testsuite/ifuncvar2.c: New test file.
2540         * testsuite/ifuncvar3.c: New test file.
2541         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2542         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2543         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2544         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2545         * testsuite/Makefile.in: Rebuild.
2546
2547 2011-07-07  Cary Coutant  <ccoutant@google.com>
2548
2549         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2550         (two_file_test_1_ndebug.o): Likewise.
2551         (two_file_test_1b_ndebug.o): Likewise.
2552         (two_file_test_2_ndebug.o): Likewise.
2553         (two_file_test_main_ndebug.o): Likewise.
2554         (incremental_test_2): Link with no-debug versions.
2555
2556 2011-07-06  Cary Coutant  <ccoutant@google.com>
2557
2558         * gold/incremental.cc
2559         (Output_section_incremental_inputs::write_info_blocks): Check for
2560         hidden and internal symbols.
2561
2562 2011-07-06  Cary Coutant  <ccoutant@google.com>
2563
2564         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2565         Check disposition for startup file.
2566         (Incremental_inputs::report_command_line): Ignore
2567         --incremental-startup-unchanged option.
2568         * options.cc (General_options::parse_incremental_startup_unchanged):
2569         New function.
2570         (General_options::General_options): Initialize new data member.
2571         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2572         (General_options): Add --incremental-startup-unchanged option.
2573         (General_options::incremental_startup_disposition): New function.
2574         (General_options::incremental_startup_disposition_): New data member.
2575
2576 2011-07-06  Cary Coutant  <ccoutant@google.com>
2577
2578         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2579         input file index to Script_info ctor.
2580         (Sized_incremental_binary::do_file_has_changed): Find the
2581         command-line argument for files named in scripts.
2582         * incremental.h (Script_info::Script_info): New ctor
2583         with input file index.
2584         (Script_info::input_file_index): New function.
2585         (Script_info::input_file_index_): New data member.
2586         (Incremental_binary::get_library): Add const.
2587         (Incremental_binary::get_script_info): Add const.
2588         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2589         * testsuite/Makefile.am (incremental_test_5): New test case.
2590         (incremental_test_6): New test case.
2591         * testsuite/Makefile.in: Regenerate.
2592
2593 2011-07-06  Cary Coutant  <ccoutant@google.com>
2594
2595         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2596         debug output when command lines differ.
2597
2598 2011-07-06  Cary Coutant  <ccoutant@google.com>
2599
2600         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2601         --incremental-patch option.
2602         * layout.cc (Free_list::allocate): Extend allocation beyond original
2603         end if enabled.
2604         (Layout::make_output_section): Mark sections that should get
2605         patch space.
2606         * options.cc (parse_percent): New function.
2607         * options.h (parse_percent): New function.
2608         (DEFINE_percent): New macro.
2609         (General_options): Add --incremental-patch option.
2610         * output.cc (Output_section::Output_section): Initialize new data
2611         members.
2612         (Output_section::add_input_section): Print section name when out
2613         of patch space.
2614         (Output_section::add_output_section_data): Likewise.
2615         (Output_section::set_final_data_size): Add patch space when
2616         doing --incremental-full.
2617         (Output_section::do_reset_address_and_file_offset): Remove patch
2618         space.
2619         (Output_segment::set_section_list_addresses): Print debug output
2620         only if --incremental-update.
2621         * output.h (Output_section::set_is_patch_space_allowed): New function.
2622         (Output_section::is_patch_space_allowed_): New data member.
2623         (Output_section::patch_space_): New data member.
2624         * parameters.cc (Parameters::incremental_full): New function.
2625         * parameters.h (Parameters::incremental_full): New function
2626         * testsuite/Makefile.am (incremental_test_2): Add test for
2627         --incremental-patch option.
2628         * testsuite/Makefile.in: Regenerate.
2629         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2630         (t18): Remove function body.
2631
2632 2011-07-05  Doug Kwan  <dougkwan@google.com>
2633
2634         PR gold/12771
2635         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2636         Arm_Address type for relocation result.
2637         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2638         overflow check.
2639         (Arm_relocate_functions::abs32): Use unaligned access.
2640         (Arm_relocate_functions::rel32): Ditto.
2641         (Arm_relocate_functions::prel31): Ditto.
2642         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2643         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2644         static data relocations.
2645         * testsuite/Makefile.in: Regnerate.
2646         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2647
2648 2011-07-05  Ian Lance Taylor  <iant@google.com>
2649
2650         PR gold/12392
2651         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2652         symbols if necessary.
2653         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2654
2655 2011-07-05  Ian Lance Taylor  <iant@google.com>
2656
2657         PR gold/12952
2658         * resolve.cc (Symbol::override_base_with_special): Simply override
2659         version with special symbol version, ignoring previous version.
2660
2661 2011-07-05  Ian Lance Taylor  <iant@google.com>
2662
2663         * object.cc (Sized_relobj_file::include_section_group): Add
2664         information to comment about signature location.
2665
2666 2011-07-02  Ian Lance Taylor  <iant@google.com>
2667
2668         PR gold/12957
2669         * options.h (class General_options): Add -f and -F.
2670         * options.cc (General_options::finalize): Fatal error if -f/-F
2671         are used without -shared.
2672         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2673
2674 2011-07-02  Ian Lance Taylor  <iant@google.com>
2675
2676         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2677
2678 2011-07-01  Ian Lance Taylor  <iant@google.com>
2679
2680         PR gold/12525
2681         PR gold/12952
2682         * resolve.cc (Symbol::override_base_with_special): Don't override
2683         the version if the overriding symbol has a different name.
2684         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2685         all callers.  If we give an error about an undefined version,
2686         define the base version if necessary.
2687         * dynobj.h (class Versions): Update declaration.
2688         * testsuite/weak_alias_test_5.cc: New file.
2689         * testsuite/weak_alias_test.script: New file.
2690         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2691         and versioned_alias have the right value, and call t2.
2692         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2693         weak_alias_test_5.so.
2694         (weak_alias_test_LDADD): Likewise.
2695         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2696         * testsuite/Makefile.in: Rebuild.
2697
2698 2011-07-01  Ian Lance Taylor  <iant@google.com>
2699
2700         PR gold/12525
2701         * options.h (class General_options): Support -z notext.
2702         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2703         -Wl,-z,notext.
2704         (two_file_shared_nonpic.so): Likewise.
2705         (two_file_shared_mixed.so): Likewise.
2706         (two_file_shared_mixed_1.so): Likewise.
2707         (weak_undef_lib_nonpic.so): Likewise.
2708         (alt/weak_undef_lib_nonpic.so): Likewise.
2709         (tls_test_shared_nonpic.so): Likewise.
2710         * testsuite/Makefile.in: Rebuild.
2711
2712 2011-07-01  Ian Lance Taylor  <iant@google.com>
2713
2714         PR gold/12525
2715         * configure.ac: Test whether static linking works, setting
2716         the automake conditional HAVE_STATIC.
2717         * testsuite/Makefile.am: Disable tests using -static if
2718         HAVE_STATIC is not true.
2719         * configure, testsuite/Makefile.in: Rebuild.
2720
2721 2011-07-01  Ian Lance Taylor  <iant@google.com>
2722
2723         PR gold/12525
2724         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2725         Assert if we see DW_EH_PE_indirect.
2726         * target.h (Target::ehframe_datarel_base): New function.
2727         (Target::do_ehframe_datarel_base): New target function.
2728         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2729         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2730         function.
2731
2732 2011-07-01  Ian Lance Taylor  <iant@google.com>
2733
2734         PR gold/12571
2735         * options.h (class General_options): Add
2736         --ld-generated-unwind-info.
2737         * ehframe.cc (Fde::write): Add address parameter.  Change all
2738         callers.  If associated with PLT, fill in address and size.
2739         (Cie::set_output_offset): Only add merge mapping if there is an
2740         object.
2741         (Cie::write): Add address parameter.  Change all callers.
2742         (Eh_frame::add_ehframe_for_plt): New function.
2743         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2744         input_offset_ fields into union u_, with new plt field.
2745         (Fde::Fde): Adjust for new union field.
2746         (Fde::Fde) [Output_data version]: New constructor.
2747         (Fde::add_mapping): Only add merge mapping if there is an object.
2748         (class Cie): Update declarations.
2749         (class Eh_frame): Declare add_ehframe_for_plt.
2750         * layout.cc (Layout::layout_eh_frame): Break out code into
2751         make_eh_frame_section, and call it.
2752         (Layout::make_eh_frame_section): New function.
2753         (Layout::add_eh_frame_for_plt): New function.
2754         * layout.h (class Layout): Update declarations.
2755         * merge.cc (Merge_map::add_mapping): Add assertion.
2756         * i386.cc: Include "dwarf.h".
2757         (class Output_data_plt_i386): Make first_plt_entry,
2758         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2759         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2760         and plt_eh_frame_fde.
2761         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2762         boundary.  Call add_eh_frame_for_plt if appropriate.
2763         * x86_64.cc: Include "dwarf.h".
2764         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2765         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2766         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2767         and plt_eh_frame_fde.
2768         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2769         appropriate.
2770
2771 2011-06-29  Ian Lance Taylor  <iant@google.com>
2772
2773         PR gold/12629
2774         * object.cc (Sized_relobj_file::layout_section): Change shdr
2775         parameter to be const.
2776         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2777         out of do_layout.
2778         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2779         appropriate.  Call layout_eh_frame_section.
2780         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2781         sections.
2782         * object.h (class Sized_relobj_file): Update declarations.
2783
2784 2011-06-29  Ian Lance Taylor  <iant@google.com>
2785
2786         PR gold/12652
2787         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2788         modifier.
2789         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2790
2791 2011-06-29  Ian Lance Taylor  <iant@google.com>
2792
2793         PR gold/12675
2794         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2795         SHT_X86_64_UNWIND.
2796         * layout.cc (Layout::layout_eh_frame): Likewise.
2797
2798 2011-06-29  Ian Lance Taylor  <iant@google.com>
2799
2800         PR gold/12695
2801         * layout.cc (Layout::symtab_section_shndx): New function.
2802         * layout.h (class Layout): Declare symtab_section_shndx.
2803         * output.cc (Output_section::write_header): Call it.
2804
2805 2011-06-29  Ian Lance Taylor  <iant@google.com>
2806
2807         PR gold/12818
2808         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2809         symbols which are not used in a relocation.
2810
2811 2011-06-28  Ian Lance Taylor  <iant@google.com>
2812
2813         PR gold/12898
2814         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2815         script create indistinguishable segments.
2816         (Layout::set_segment_offsets): Use stable_sort when sorting
2817         segments.  Pass this to Compare_segments constructor.
2818         * layout.h (class Layout): Make segment_precedes non-static.
2819         (class Compare_segments): Change from struct to class.  Add
2820         layout_ field.  Add constructor.
2821         * script-sections.cc
2822         (Script_sections::attach_sections_using_phdrs_clause): Rename
2823         local orphan to is_orphan.  Don't report failure to put empty
2824         section in segment.  On attachment failure, report name of
2825         section, and attach to first PT_LOAD segment.
2826
2827 2011-06-28  Ian Lance Taylor  <iant@google.com>
2828
2829         PR gold/12934
2830         * target-select.cc (Target_selector::Target_selector): Add
2831         emulation parameter.  Change all callers.
2832         (select_target_by_bfd_name): Rename from select_target_by_name.
2833         Change all callers.
2834         (select_target_by_emulation): New function.
2835         (supported_emulation_names): New function.
2836         * target-select.h (class Target_selector): Add emulation_ field.
2837         Update declarations.
2838         (Target_selector::recognize_by_bfd_name): Rename from
2839         recognize_by_name.  Change all callers.
2840         (Target_selector::supported_bfd_names): Rename from
2841         supported_names.  Change all callers.
2842         (Target_selector::recognize_by_emulation): New function.
2843         (Target_selector::supported_emulations): New function.
2844         (Target_selector::emulation): New function.
2845         (Target_selector::do_recognize_by_bfd_name): Rename from
2846         do_recognize_by_name.  Change all callers.
2847         (Target_selector::do_supported_bfd_names): Rename from
2848         do_supported_names.  Change all callers.
2849         (Target_selector::do_recognize_by_emulation): New function.
2850         (Target_selector::do_supported_emulations): New function.
2851         (select_target_by_bfd_name): Change name in declaration.
2852         (select_target_by_emulation): Declare.
2853         (supported_emulation_names): Declare.
2854         * parameters.cc (parameters_force_valid_target): Try to find
2855         target based on emulation from -m option.
2856         * options.h (class General_options): Change doc string for -m.
2857         * options.cc (help): Print emulations.
2858         (General_options::parse_V): Likewise.
2859         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2860         Add emulation parameter.  Change all callers.
2861
2862 2011-06-28  Ian Lance Taylor  <iant@google.com>
2863
2864         * target.h (class Target): Add osabi_ field.
2865         (Target::osabi): New function.
2866         (Target::set_osabi): New function.
2867         (Target::Target): Initialize osabi_.
2868         (Target::do_adjust_elf_header): Make pure virtual.
2869         (Sized_target::do_adjust_elf_header): Declare.
2870         * target.cc (Sized_target::do_adjust_elf_header): New function.
2871         (class Sized_target): Instantiate all versions.
2872         * freebsd.h (class Target_freebsd): Remove.
2873         (Target_selector_freebsd::do_recognize): Call set_osabi on
2874         Target.
2875         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2876         (Target_selector_freebsd::set_osabi): Remove.
2877         * i386.cc (class Target_i386): Inherit from Sized_target rather
2878         than Target_freebsd.
2879         * x86_64.cc (class Target_x86_64): Likewise.
2880
2881 2011-06-28  Ian Lance Taylor  <iant@google.com>
2882
2883         * target.h (Target::can_check_for_function_pointers): Rewrite.
2884         Make non-virtual.
2885         (Target::can_icf_inline_merge_sections): Likewise.
2886         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2887         (Target::Target_info): Add can_icf_inline_merge_sections field.
2888         (Target::do_can_check_for_function_pointers): New virtual
2889         function.
2890         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2891         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2892         from can_check_for_function_pointers, move in file.
2893         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2894         section_may_have_icf_unsafe_poineters, move in file.
2895         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2896         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2897         Rename from can_check_for_function_pointers, move in file.
2898         (Target_i386::can_icf_inline_merge_sections): Remove.
2899         (Target_i386::i386_info): Initialize
2900         can_icf_inline_merge_sections.
2901         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2902         Initialize can_icf_inline_merge_sections.
2903         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2904         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2905         Rename from can_check_for_function_pointers, move in file.
2906         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2907         (Target_x86_64::x86_64_info): Initialize
2908         can_icf_inline_merge_sections.
2909         * testsuite/testfile.cc (Target_test::test_target_info):
2910         Likewise.
2911         * icf.cc (get_section_contents): Correct formatting.
2912
2913 2011-06-27  Ian Lance Taylor  <iant@google.com>
2914
2915         * symtab.cc (Symbol::versioned_name): New function.
2916         (Symbol_table::add_to_final_symtab): Use versioned_name when
2917         appropriate.
2918         (Symbol_table::sized_write_symbol): Likewise.
2919         * symtab.h (class Symbol): Declare versioned_name.
2920         * stringpool.h (class Stringpool_template): Add variant of add
2921         which takes a std::basic_string.
2922         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2923         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2924         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2925         (ver_test_12.o): New target.
2926         * testsuite/Makefile.in: Rebuild.
2927
2928 2011-06-27  Doug Kwan  <dougkwan@google.com>
2929
2930         * arm.cc (Arm_relocate_functions::thm_jump8,
2931         Arm_relocate_functions::thm_jump11): Use a wider signed
2932         type to compute offset.
2933         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2934         arm_thm_jump8.
2935         * testsuite/Makefile.in: Regenerate.
2936         * testsuite/arm_branch_in_range.sh: Check test results of
2937         arm_thm_jump11 and arm_thm_jump8.
2938         * testsuite/arm_thm_jump11.s: New test source file.
2939         * testsuite/arm_thm_jump11.t: New linker script.
2940         * testsuite/arm_thm_jump8.s: New test source file.
2941         * testsuite/arm_thm_jump8.t: New linker script.
2942
2943 2011-06-24  Ian Lance Taylor  <iant@google.com>
2944
2945         * layout.cc: Include "object.h".
2946         (ctors_sections_in_init_array): New static variable.
2947         (Layout::is_ctors_in_init_array): New function.
2948         (Layout::layout): Add entry to ctors_sections_in_init_array if
2949         appropriate.
2950         * layout.h (class Layout): Declare is_ctors_in_init_array.
2951         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2952         is_ctors_reverse_view is set.
2953         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2954         all callers.  Set is_ctors_reverse_view field of View_size.
2955         (Sized_relobj_file::reverse_words): New function.
2956         * object.h (Sized_relobj_file::View_size): Add
2957         is_ctors_reverse_view field.
2958         (class Sized_relobj_file): Update declarations.
2959         * testsuite/initpri3.c: New test.
2960         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2961         initpri3b.
2962         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2963         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2964         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2965         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2966         * testsuite/Makefile.in: Rebuild.
2967
2968 2011-06-24  Cary Coutant  <ccoutant@google.com>
2969
2970         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2971         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2972         (debug_msg_cdebug.err): New targets.
2973         * testsuite/Makefile.in: Regenerate.
2974         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2975         Fix checks for link with shared library.
2976
2977 2011-06-24  Doug Kwan  <dougkwan@google.com>
2978
2979         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2980         skip empty text sections.
2981         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
2982
2983 2011-06-22  Ian Lance Taylor  <iant@google.com>
2984
2985         PR gold/12910
2986         * options.h (class General_options): Add --ctors-in-init-array.
2987         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
2988         friends as SHT_PROGBITS for merging sections.
2989         (Layout::layout): Remove special handling of .init_array and
2990         friends.  Don't sort if doing relocatable link.  Sort for .ctors
2991         and .dtors if ctors_in_init_array.
2992         (Layout::make_output_section): Force correct section types for
2993         .init_array and friends.  Don't sort if doing relocatable link,
2994         Don't sort .ctors and .dtors if ctors_in_init_array.
2995         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
2996         (Layout::output_section_name): Add relobj parameter.  Change all
2997         callers.  Handle .ctors. and .dtors. in code rather than table.
2998         Handle .ctors and .dtors if ctors_in_init_array.
2999         (Layout::match_file_name): New function, moved from output.cc.
3000         * layout.h (class Layout): Update declarations.
3001         * output.cc: Include "layout.h".
3002         (Input_section_sort_entry::get_priority): New function.
3003         (Input_section_sort_entry::match_file_name): Just call
3004         Layout::match_file_name.
3005         (Output_section::Input_section_sort_init_fini_compare::operator()):
3006         Handle .ctors and .dtors.  Sort by explicit priority rather than
3007         by name.
3008         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3009         * testsuite/initpri2.c: New test.
3010         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3011         (check_PROGRAMS): Add initpri2.
3012         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3013         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3014         * configure, testsuite/Makefile.in: Rebuild.
3015
3016 2011-06-19  Ian Lance Taylor  <iant@google.com>
3017
3018         PR gold/12880
3019         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3020         .interp section to a PT_INTERP segment even if we have seen a
3021         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3022         clause in a linker script.
3023         (Layout::finalize): Don't create a .interp section if we've
3024         already create a PT_INTERP segment.
3025         (Layout::create_interp): Always call choose_output_section (revert
3026         patch of 2011-06-17).  Don't create PT_INTERP segment.
3027         * script-sections.cc
3028         (Script_sections::create_note_and_tls_segments): Add a .interp
3029         section to a PT_INTERP segment even if we have seen a
3030         --dynamic-linker option.
3031
3032 2011-06-18  Ian Lance Taylor  <iant@google.com>
3033
3034         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3035         merely because a non-PT_LOAD segment has a dynamic reloc.
3036
3037 2011-06-18  Ian Lance Taylor  <iant@google.com>
3038
3039         * layout.cc (Layout::finish_dynamic_section): Don't create
3040         DT_FLAGS entry if not needed.
3041
3042 2011-06-18  Ian Lance Taylor  <iant@google.com>
3043
3044         PR gold/12745
3045         * layout.cc (Layout::layout_eh_frame): Correct handling of
3046         writable .eh_frame section.
3047
3048 2011-06-17  Ian Lance Taylor  <iant@google.com>
3049
3050         PR gold/12893
3051         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3052         symbol is redefined with the exact same object and value.
3053
3054 2011-06-17  Ian Lance Taylor  <iant@google.com>
3055
3056         PR gold/12880
3057         * layout.h (class Layout): Add interp_segment_ field.
3058         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3059         (Layout::attach_allocated_section_to_segment): If making shared
3060         library, put .interp section in PT_INTERP segment.
3061         (Layout::finalize): Also call create_interp if -dynamic-linker
3062         option was used.
3063         (Layout::create_interp): Assert that there is no PT_INTERP
3064         segment.  If not using a SECTIONS clause, use make_output_section.
3065         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3066         * script-sections.cc
3067         (Script_sections::create_note_and_tls_segments): If making shared
3068         library, put .interp section in PT_INTERP segment.
3069
3070 2011-06-17  Ian Lance Taylor  <iant@google.com>
3071
3072         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3073         when making a shared library.
3074
3075 2011-06-17  Ian Lance Taylor  <iant@google.com>
3076
3077         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3078         parameter.  Change all callers.  Don't issue warning about PC32
3079         against locally defined symbol.
3080
3081 2011-06-16  Ian Lance Taylor  <iant@google.com>
3082
3083         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3084         occurs in same object.
3085
3086 2011-06-14  Alan Modra  <amodra@gmail.com>
3087
3088         * po/POTFILES.in: Regenerate.
3089
3090 2011-06-09  Ian Lance Taylor  <iant@google.com>
3091
3092         * script-sections.cc
3093         (Orphan_output_section::set_section_addresses): For a relocatable
3094         link set address to 0.
3095
3096 2011-06-09  Cary Coutant  <ccoutant@google.com>
3097
3098         PR gold/12804
3099         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3100         used with --compress-debug-sections.
3101         * gold/object.cc (Sized_relobj_file::do_layout): Report
3102         uncompressed size of compressed input sections.
3103
3104 2011-06-08  Cary Coutant  <ccoutant@google.com>
3105
3106         PR gold/12804
3107         * testsuite/two_file_test_2_v1.cc: Change initialization of
3108         v2 to keep it in .data.
3109
3110 2011-06-07  Cary Coutant  <ccoutant@google.com>
3111
3112         * common.cc (Symbol_table::do_allocate_commons_list): Call
3113         gold_fallback.
3114         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3115         (Errors::fallback): New function.
3116         (gold_fallback): New function.
3117         * errors.h (Errors::fallback): New function.
3118         * gold.cc (gold_exit): Change status parameter to enum; adjust
3119         all callers.
3120         (queue_initial_tasks): Call gold_fallback.
3121         * gold.h: Include cstdlib.
3122         (Exit_status): New enum type.
3123         (gold_exit): Change status parameter to enum.
3124         (gold_fallback): New function.
3125         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3126         (Layout::create_symtab_sections): Likewise.
3127         (Layout::create_shdrs): Likewise.
3128         * main.cc (main): Adjust call to gold_exit.
3129         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3130         (Output_data_got::add_got_entry_pair): Likewise.
3131         (Output_section::add_input_section): Likewise.
3132         (Output_section::add_output_section_data): Likewise.
3133         (Output_segment::set_section_list_addresses): Likewise.
3134         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3135
3136 2011-06-07  Cary Coutant  <ccoutant@google.com>
3137
3138         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3139         for incremental links.
3140         * output.cc (Output_segment::set_section_list_addresses): Remove
3141         FIXME and test for TLS or BSS.
3142
3143 2011-06-07  Cary Coutant  <ccoutant@google.com>
3144
3145         * testsuite/Makefile.am: Add incremental_copy_test,
3146         incremental_common_test_1.
3147         * testsuite/Makefile.in: Regenerate.
3148         * testsuite/common_test_1_v1.c: New source file.
3149         * testsuite/common_test_1_v2.c: New source file.
3150         * testsuite/copy_test_v1.cc: New source file.
3151
3152 2011-06-07  Cary Coutant  <ccoutant@google.com>
3153
3154         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3155         update, allocate common from bss section's free list.
3156         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3157         linker-defined symbols.
3158         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3159         Skip GOT and PLT entries that are no longer referenced.
3160         (Output_section_incremental_inputs::write_info_blocks): Mark
3161         linker-defined symbols.
3162         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3163         * output.cc (Output_section::allocate): New function.
3164         * output.h (Output_section::allocate): New function.
3165         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3166         linker-defined symbols.
3167         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3168         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3169         (Symbol::init_base_output_data): Likewise.
3170         (Symbol::init_base_output_segment): Likewise.
3171         (Symbol::init_base_constant): Likewise.
3172         (Sized_symbol::init_output_data): Likewise.
3173         (Sized_symbol::init_output_segment): Likewise.
3174         (Sized_symbol::init_constant): Likewise.
3175         (Symbol_table::do_define_in_output_data): Likewise.
3176         (Symbol_table::do_define_in_output_segment): Likewise.
3177         (Symbol_table::do_define_as_constant): Likewise.
3178         * symtab.h (Symbol::is_predefined): New function.
3179         (Symbol::init_base_output_data): Add is_predefined parameter.
3180         (Symbol::init_base_output_segment): Likewise.
3181         (Symbol::init_base_constant): Likewise.
3182         (Symbol::is_predefined_): New data member.
3183         (Sized_symbol::init_output_data): Add is_predefined parameter.
3184         (Sized_symbol::init_output_segment): Likewise.
3185         (Sized_symbol::init_constant): Likewise.
3186         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3187
3188 2011-06-07  Cary Coutant  <ccoutant@google.com>
3189
3190         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3191         instead of emit_copy_reloc.
3192         (Copy_relocs::emit_copy_reloc): Refactor.
3193         (Copy_relocs::make_copy_reloc): New function.
3194         (Copy_relocs::add_copy_reloc): Remove.
3195         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3196         section.
3197         (Copy_relocs::make_copy_reloc): New function.
3198         (Copy_relocs::add_copy_reloc): Remove.
3199         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3200         unchanged input files.
3201         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3202         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3203         Reserve BSS space for COPY relocations.
3204         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3205         (Output_section_incremental_inputs::write_info_blocks): Record
3206         whether a symbol is copied from a shared object.
3207         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3208         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3209         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3210         (Incremental_input_entry_reader::get_output_symbol_index): Add
3211         is_copy parameter.
3212         (Incremental_binary::emit_copy_relocs): New function.
3213         (Incremental_binary::do_emit_copy_relocs): New function.
3214         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3215         new data member.
3216         (Sized_incremental_binary::add_copy_reloc): New function.
3217         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3218         (Sized_incremental_binary::Copy_reloc): New struct.
3219         (Sized_incremental_binary::Copy_relocs): New typedef.
3220         (Sized_incremental_binary::copy_relocs_): New data member.
3221         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3222         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3223         * target.h (Sized_target::emit_copy_reloc): New function.
3224         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3225
3226 2011-06-02  Cary Coutant  <ccoutant@google.com>
3227
3228         PR gold/12163
3229         * gold/archive.cc (Archive::Archive): Initialize new data member.
3230         (Archive::include_all_members): Return if archive has already been
3231         included.
3232         * gold/archive.h (Archive::include_all_members_): New data member.
3233
3234 2011-06-02  Nick Clifton  <nickc@redhat.com>
3235
3236         * dynobj.h: Fix spelling mistake in comment.
3237         * output.cc: Likewise.
3238
3239 2011-05-31  Doug Kwan  <dougkwan@google.com>
3240             Asier Llano
3241
3242         PR gold/12826
3243         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3244         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3245         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3246         redundant arm_exidx_test.so.
3247         * testsuite/Makefile.in: Regenerate.
3248         (check_SCRIPTS): Add pr12826.sh
3249         (check_DATA): Add pr12826.stdout
3250         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3251         * testsuite/pr12826.sh: New file.
3252         * testsuite/pr12826_1.s: Ditto.
3253         * testsuite/pr12826_1.s: Ditto.
3254
3255 2011-05-30  Ian Lance Taylor  <iant@google.com>
3256
3257         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3258         sections.
3259
3260 2011-05-29  Ian Lance Taylor  <iant@google.com>
3261
3262         PR gold/12804
3263         * testsuite/Makefile.am: Use different file name for two_file_test
3264         temporary file for each incremental test.
3265         * testsuite/Makefile.in: Rebuild.
3266
3267 2011-05-29  Ian Lance Taylor  <iant@google.com>
3268
3269         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3270         binary input file is empty.
3271
3272 2011-05-27  Ian Lance Taylor  <iant@google.com>
3273
3274         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3275         (ver_test_9.so): Likewise.
3276         * testsuite/Makefile.in: Rebuild.
3277
3278 2011-05-26 Cary Coutant  <ccoutant@google.com>
3279
3280         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3281         * incremental.cc (Incremental_inputs::report_input_section): Fix
3282         comment, indentation.
3283         (Incremental_inputs::report_comdat_group): New function.
3284         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3285         of data for incremental input file entry.
3286         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3287         group count, COMDAT group signatures.
3288         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3289         an unchanged input file.
3290         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3291         Initialize new data member.
3292         (Incremental_object_entry::add_comdat_group): New function.
3293         (Incremental_object_entry::get_comdat_group_count): New function.
3294         (Incremental_object_entry::get_comdat_signature_key): New function.
3295         (Incremental_object_entry::groups_): New data member.
3296         (Incremental_inputs::report_comdat_group): New function.
3297         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3298         data for incremental input file entry.
3299         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3300         (Incremental_input_entry_reader::get_input_section): Adjust size of
3301         data for incremental input file entry.
3302         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3303         (Incremental_input_entry_reader::get_comdat_group_signature): New
3304         function.
3305         * object.cc (Sized_relobj::include_section_group): Report kept
3306         COMDAT groups for incremental links.
3307
3308 2011-05-24  David Meyer  <pdox@google.com>
3309
3310         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3311         with name parameter.  Add found_name parameter.
3312         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3313         * dirsearch.h (class Dirsearch): Update declaration.
3314
3315 2011-05-24  Ian Lance Taylor  <iant@google.com>
3316
3317         * archive.cc (Library_base::should_include_member): Pull in object
3318         from archive if it defines the entry symbol.
3319         * parameters.cc (Parameters::entry): New function.
3320         * parameters.h (class Parameters): Declare entry.
3321         * output.h (class Output_file_header): Remove entry_ field.
3322         * output.cc (Output_file_header::Output_file_header): Remove entry
3323         parameter.  Change all callers.
3324         (Output_file_header::entry): Use parameters->entry.
3325         * gold.cc (queue_middle_tasks): Likewise.
3326         * plugin.cc (Plugin_hook::run): Likewise.
3327
3328 2011-05-24 Cary Coutant  <ccoutant@google.com>
3329
3330         * gold.cc (queue_initial_tasks): Pass incremental base filename
3331         to Output_file::open_base_file; don't print error message.
3332         * incremental-dump.cc (main): Adjust call to
3333         Output_file::open_for_modification.
3334         * incremental-dump.cc (main): Likewise.
3335         * incremental.cc (Incremental_inputs::report_command_line):
3336         Ignore --incremental-base option when comparing command lines.
3337         Ignore parameter when given as separate argument.
3338         * options.h (class General_options): Add --incremental-base.
3339         * output.cc (Output_file::Output_file):
3340         (Output_file::open_base_file): Add base_name and writable parameters;
3341         read base file into new file; print error message here.
3342         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3343         callers.
3344         * output.h (Output_file::open_for_modification): Rename to...
3345         (Output_file::open_base_file): ...this; add base_name and
3346         writable parameters; adjust all callers.
3347         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3348         callers.
3349         * testsuite/Makefile.am (incremental_test_4): Test
3350         --incremental-base.
3351         * testsuite/Makefile.in: Regenerate.
3352
3353 2011-05-24 Cary Coutant  <ccoutant@google.com>
3354
3355         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3356         incremental_test_4.
3357         * testsuite/Makefile.in: Regenerate.
3358         * testsuite/two_file_test_1_v1.cc: New test source file.
3359         * testsuite/two_file_test_1b_v1.cc: New test source file.
3360         * testsuite/two_file_test_2_v1.cc: New test source file.
3361
3362 2011-05-24 Cary Coutant  <ccoutant@google.com>
3363
3364         * dynobj.h (Dynobj::do_dynobj): New function.
3365         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3366         flag and soname for shared objects.
3367         * incremental.cc (Incremental_inputs::report_object): Make
3368         either Incremental_object_entry or Incremental_dynobj_entry; add
3369         soname to string table.
3370         (Incremental_inputs::report_input_section): Add assertion.
3371         (Output_section_incremental_inputs::set_final_data_size): Adjust
3372         type of input file entry for shared libraries; adjust size of
3373         shared library info entry.
3374         (Output_section_incremental_inputs::write_input_files): Write
3375         as_needed flag for shared libraries.
3376         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3377         of input file entry for shared libraries; write soname.
3378         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3379         soname from incremental info.
3380         * incremental.h (enum Incremental_input_flags): Add
3381         INCREMENTAL_INPUT_AS_NEEDED.
3382         (Incremental_input_entry::Incremental_input_entry): Initialize new
3383         data member.
3384         (Incremental_input_entry::set_as_needed): New function.
3385         (Incremental_input_entry::as_needed): New function.
3386         (Incremental_input_entry::do_dynobj_entry): New function.
3387         (Incremental_input_entry::as_needed_): New data member.
3388         (Incremental_object_entry::Incremental_object_entry): Don't check
3389         for shared library.
3390         (Incremental_object_entry::do_type): Likewise.
3391         (class Incremental_dynobj_entry): New class.
3392         (Incremental_input_entry_reader::as_needed): New function.
3393         (Incremental_input_entry_reader::get_soname): New function.
3394         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3395         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3396         size of shared library info entry.
3397         * layout.cc (Layout::finish_dynamic_section): Don't test for
3398         incremental link when adding DT_NEEDED entries.
3399         * object.h (Object::Object): Initialize new data member.
3400         (Object::dynobj): New function.
3401         (Object::set_as_needed): New function.
3402         (Object::as_needed): New function.
3403         (Object::do_dynobj): New function.
3404         (Object::as_needed_): New data member.
3405
3406 2011-05-24 Cary Coutant  <ccoutant@google.com>
3407
3408         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3409         info; adjust display of GOT entries.
3410         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3411         vector of input objects; remove file_status_.
3412         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3413         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3414         got_plt reader; call target hooks to reserve GOT entries.
3415         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3416         of input file info header and GOT info entry.
3417         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3418         relocation info.
3419         (Got_plt_view_info::got_descriptor): Remove.
3420         (Got_plt_view_info::sym_index): New data member.
3421         (Got_plt_view_info::input_index): New data member.
3422         (Local_got_offset_visitor::visit): Write input file index.
3423         (Global_got_offset_visitor::visit): Write 0 for input file index.
3424         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3425         with sym_index and input_index.
3426         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3427         incremental info GOT entry; replace got_descriptor with input_index.
3428         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3429         map from input file index to object.
3430         (Sized_relobj_incr::do_layout): Replace direct data member reference
3431         with accessor function.
3432         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3433         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3434         Adjust size of input file info header.
3435         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3436         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3437         (Incremental_input_entry_reader::get_input_section): Adjust size of
3438         input file info header.
3439         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3440         of incremental info GOT entry.
3441         (Incremental_got_plt_reader::get_got_desc): Remove.
3442         (Incremental_got_plt_reader::get_got_symndx): New function.
3443         (Incremental_got_plt_reader::get_got_input_index): New function.
3444         (Sized_incremental_binary::Sized_incremental_binary): Remove
3445         file_status_; add input_objects_.
3446         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3447         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3448         (Sized_incremental_binary::file_is_unchanged): Remove.
3449         (Sized_incremental_binary::set_input_object): New function.
3450         (Sized_incremental_binary::input_object): New function.
3451         (Sized_incremental_binary::file_status_): Remove.
3452         (Sized_incremental_binary::input_objects_): New data member.
3453         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3454         references.
3455         (Sized_relobj_incr::invalid_address): Move to base class.
3456         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3457         class.
3458         (Sized_relobj_incr::do_output_section_offset): Likewise.
3459         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3460         (Sized_relobj_incr::section_offsets_): Likewise.
3461         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3462         function.
3463         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3464         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3465         with accessor function.
3466         (Sized_relobj_file::do_layout): Likewise.
3467         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3468         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3469         (Sized_relobj_file::compute_final_local_value): Replace refs to
3470         section_offsets_ with accessor function.
3471         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3472         * object.h (Relobj::Relobj): Initialize new data members.
3473         (Relobj::add_dyn_reloc): New function.
3474         (Relobj::first_dyn_reloc): New function.
3475         (Relobj::dyn_reloc_count): New function.
3476         (Relobj::first_dyn_reloc_): New data member.
3477         (Relobj::dyn_reloc_count_): New data member.
3478         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3479         references.
3480         (Sized_relobj::Address): New typedef.
3481         (Sized_relobj::invalid_address): Move here from child class.
3482         (Sized_relobj::Sized_relobj): Initialize new data members.
3483         (Sized_relobj::sized_relobj): New function.
3484         (Sized_relobj::is_output_section_offset_invalid): Move here from
3485         child class.
3486         (Sized_relobj::get_output_section_offset): Likewise.
3487         (Sized_relobj::local_has_got_offset): Likewise.
3488         (Sized_relobj::local_got_offset): Likewise.
3489         (Sized_relobj::set_local_got_offset): Likewise.
3490         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3491         (Sized_relobj::clear_got_offsets): New function.
3492         (Sized_relobj::section_offsets): Move here from child class.
3493         (Sized_relobj::do_output_section_offset): Likewise.
3494         (Sized_relobj::do_set_section_offset): Likewise.
3495         (Sized_relobj::Local_got_offsets): Likewise.
3496         (Sized_relobj::local_got_offsets_): Likewise.
3497         (Sized_relobj::section_offsets_): Likewise.
3498         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3499         references.
3500         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3501         class.
3502         (Sized_relobj_file::sized_relobj): New function
3503         (Sized_relobj_file::local_has_got_offset): Move to base class.
3504         (Sized_relobj_file::local_got_offset): Likewise.
3505         (Sized_relobj_file::set_local_got_offset): Likewise.
3506         (Sized_relobj_file::get_output_section_offset): Likewise.
3507         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3508         (Sized_relobj_file::do_output_section_offset): Likewise.
3509         (Sized_relobj_file::do_set_section_offset): Likewise.
3510         (Sized_relobj_file::Local_got_offsets): Likewise.
3511         (Sized_relobj_file::local_got_offsets_): Likewise.
3512         (Sized_relobj_file::section_offsets_): Likewise.
3513         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3514         (all constructors).
3515         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3516         (Output_reloc::get_symbol_index): Likewise.
3517         (Output_reloc::local_section_offset): Likewise.
3518         (Output_reloc::get_address): Likewise.
3519         (Output_reloc::symbol_value): Likewise.
3520         (Output_data_got::reserve_slot): Move to class definition.
3521         (Output_data_got::reserve_local): New function.
3522         (Output_data_got::reserve_slot_for_global): Remove.
3523         (Output_data_got::reserve_global): New function.
3524         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3525         (all constructors, two instantiations).
3526         (Output_reloc::get_relobj): New function (two instantiations).
3527         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3528         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3529         (Output_data_reloc::add_global): Adjust type of relobj.
3530         (Output_data_reloc::add_global_relative): Likewise.
3531         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3532         (Output_data_reloc::add_local): Likewise.
3533         (Output_data_reloc::add_local_relative): Likewise.
3534         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3535         (Output_data_reloc::add_local_section): Likewise.
3536         (Output_data_reloc::add_output_section): Likewise.
3537         (Output_data_reloc::add_absolute): Likewise.
3538         (Output_data_reloc::add_target_specific): Likewise.
3539         (Output_data_got::reserve_slot): Move definition here.
3540         (Output_data_got::reserve_local): New function.
3541         (Output_data_got::reserve_global): New function.
3542         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3543         section_offsets_ with accessor function.
3544         (Sized_relobj_file::write_sections): Likewise.
3545         (Sized_relobj_file::do_relocate_sections): Likewise.
3546         * target.h (Sized_target::reserve_local_got_entry): New function.
3547         (Sized_target::reserve_global_got_entry): New function.
3548         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3549         (Target_x86_64::reserve_global_got_entry): New function.
3550         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3551
3552 2011-05-23 Cary Coutant  <ccoutant@google.com>
3553
3554         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3555         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3556         bit when checking got_type.
3557         * incremental.cc (Sized_incremental_binary::setup_readers):
3558         Store symbol table and string table locations; initialize bit vector
3559         of file status flags.
3560         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3561         unchanged files.
3562         (Sized_incremental_binary::do_process_got_plt): New function.
3563         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3564         (Output_section_incremental_inputs::set_final_data_size): Record
3565         file index for each input file.
3566         (Output_section_incremental_inputs::write_got_plt): Store file index
3567         instead of input entry offset for each GOT entry.
3568         * incremental.h
3569         (Incremental_input_entry::Incremental_input_entry): Initialize new
3570         data member.
3571         (Incremental_input_entry::set_offset): Store file index.
3572         (Incremental_input_entry::get_file_index): New function.
3573         (Incremental_input_entry::file_index_): New data member.
3574         (Incremental_binary::process_got_plt): New function.
3575         (Incremental_binary::do_process_got_plt): New function.
3576         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3577         data members.
3578         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3579         (Sized_incremental_binary::set_file_is_unchanged): New function.
3580         (Sized_incremental_binary::file_is_unchanged): New function.
3581         (Sized_incremental_binary::do_process_got_plt): New function.
3582         (Sized_incremental_binary::file_status_): New data member.
3583         (Sized_incremental_binary::main_symtab_loc_): New data member.
3584         (Sized_incremental_binary::main_strtab_loc_): New data member.
3585         * output.cc (Output_data_got::Got_entry::write): Add case
3586         RESERVED_CODE.
3587         (Output_data_got::add_global): Call add_got_entry.
3588         (Output_data_got::add_global_plt): Likewise.
3589         (Output_data_got::add_global_with_rel): Likewise.
3590         (Output_data_got::add_global_with_rela): Likewise.
3591         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3592         (Output_data_got::add_global_pair_with_rela): Likewise.
3593         (Output_data_got::add_local): Call add_got_entry.
3594         (Output_data_got::add_local_plt): Likewise.
3595         (Output_data_got::add_local_with_rel): Likewise.
3596         (Output_data_got::add_local_with_rela): Likewise.
3597         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3598         (Output_data_got::add_local_pair_with_rela): Likewise.
3599         (Output_data_got::reserve_slot): New function.
3600         (Output_data_got::reserve_slot_for_global): New function.
3601         (Output_data_got::add_got_entry): New function.
3602         (Output_data_got::add_got_entry_pair): New function.
3603         (Output_section::add_output_section_data): Edit FIXME.
3604         * output.h
3605         (Output_section_data_build::Output_section_data_build): New
3606         constructor with size parameter.
3607         (Output_data_space::Output_data_space): Likewise.
3608         (Output_data_got::Output_data_got): Initialize new data member; new
3609         constructor with size parameter.
3610         (Output_data_got::add_constant): Call add_got_entry.
3611         (Output_data_got::reserve_slot): New function.
3612         (Output_data_got::reserve_slot_for_global): New function.
3613         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3614         (Output_data_got::add_got_entry): New function.
3615         (Output_data_got::add_got_entry_pair): New function.
3616         (Output_data_got::free_list_): New data member.
3617         * target.h (Sized_target::init_got_plt_for_update): New function.
3618         (Sized_target::register_global_plt_entry): New function.
3619         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3620         Initialize new data member; call init; add constructor with PLT count.
3621         (Output_data_plt_x86_64::init): New function.
3622         (Output_data_plt_x86_64::add_relocation): New function.
3623         (Output_data_plt_x86_64::reserve_slot): New function.
3624         (Output_data_plt_x86_64::free_list_): New data member.
3625         (Target_x86_64::init_got_plt_for_update): New function.
3626         (Target_x86_64::register_global_plt_entry): New function.
3627         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3628         incremental updates.
3629         (Output_data_plt_x86_64::add_relocation): New function.
3630         * testsuite/object_unittest.cc (Object_test): Set default options.
3631
3632 2011-05-16  Ian Lance Taylor  <iant@google.com>
3633
3634         * options.h (class General_options): Make -i a synonym for -r.
3635
3636 2011-05-16  Ian Lance Taylor  <iant@google.com>
3637
3638         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3639
3640 2011-05-10 Cary Coutant  <ccoutant@google.com>
3641
3642         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3643         strip_all (-s).
3644
3645 2011-05-06  Ian Lance Taylor  <iant@google.com>
3646
3647         * layout.cc (Layout::layout): If the output section flags change,
3648         update the ordering.
3649
3650 2011-04-25 Cary Coutant  <ccoutant@google.com>
3651
3652         * incremental-dump.cc (dump_incremental_inputs): Print local
3653         symbol info for each input file.
3654         * incremental.cc
3655         (Output_section_incremental_inputs::set_final_data_size): Add local
3656         symbol info to input file entries in incremental info.
3657         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3658         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3659         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3660         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3661         implementation.
3662         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3663         (Sized_incr_relobj::do_relocate): Write the local symbols.
3664         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3665         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3666         Adjust size of input file header.
3667         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3668         (Incremental_inputs_reader::get_local_symbol_count): New function.
3669         (Incremental_inputs_reader::get_input_section): Adjust size of input
3670         file header.
3671         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3672         (Sized_incr_relobj::This): New typedef.
3673         (Sized_incr_relobj::sym_size): New const data member.
3674         (Sized_incr_relobj::Local_symbol): New struct.
3675         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3676         (Sized_incr_relobj::do_local_symbol_offset): New function.
3677         (Sized_incr_relobj::local_symbol_count_): New data member.
3678         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3679         (Sized_incr_relobj::local_symbol_index_): New data member.
3680         (Sized_incr_relobj::local_symbol_offset_): New data member.
3681         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3682         (Sized_incr_relobj::local_symbols_): New data member.
3683         * object.h (Relobj::output_local_symbol_count): New function.
3684         (Relobj::local_symbol_offset): New function.
3685         (Relobj::do_output_local_symbol_count): New function.
3686         (Relobj::do_local_symbol_offset): New function.
3687         (Sized_relobj::do_output_local_symbol_count): New function.
3688         (Sized_relobj::do_local_symbol_offset): New function.
3689
3690 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3691
3692         * descriptors.cc (set_close_on_exec): New function.
3693         (Descriptors::open): Use set_close_on_exec.
3694         * output.cc (S_ISLNK): Define if not defined.
3695
3696 2011-04-22 Cary Coutant  <ccoutant@google.com>
3697
3698         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3699         global symbol map.
3700         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3701         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3702         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3703         relocations.
3704         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3705         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3706         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3707         * incremental.h
3708         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3709         function.
3710         (Incremental_binary::apply_incremental_relocs): New function.
3711         (Incremental_binary::do_apply_incremental_relocs): New function.
3712         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3713         data member.
3714         (Sized_incremental_binary::add_global_symbol): New function.
3715         (Sized_incremental_binary::global_symbol): New function.
3716         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3717         (Sized_incremental_binary::symbol_map_): New data member.
3718         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3719         * target.h (Sized_target::apply_relocation): New function.
3720         * target-reloc.h (apply_relocation): New function.
3721         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3722
3723 2011-04-22  Doug Kwan  <dougkwan@google.com>
3724
3725         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3726         flag of a SHT_ARM_EXIDX section.
3727         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3728         * testsuite/Makefile.in: Regenerate.
3729         * testsuite/arm_exidx_test.s: New file.
3730         * testsuite/arm_exidx_test.sh: Same.
3731
3732 2011-04-20 Cary Coutant  <ccoutant@google.com>
3733
3734         PR gold/12689
3735         * archive.h (Incremental_archive_entry::Archive_member):
3736         Initialize arg_serial_ (second constructor).
3737
3738 2011-04-17  Ian Lance Taylor  <iant@google.com>
3739
3740         * object.cc (Relocate_info::location): Simplify location string.
3741         * errors.cc (Errors::error_at_location): Don't print program
3742         name.
3743         (Errors::warning_at_location): Likewise.
3744         (Errors::undefined_symbol): Likewise.
3745         * testsuite/debug_msg.sh: Update accordingly.
3746
3747 2011-04-14 Cary Coutant  <ccoutant@google.com>
3748
3749         * gold/layout.cc (Layout::symtab_section_offset): New function.
3750         * gold/layout.h (Layout::symtab_section_offset): New function.
3751         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3752
3753 2011-04-12  Ian Lance Taylor  <iant@google.com>
3754
3755         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3756         with MREMAP_MAYMOVE.
3757         * output.h (class Output_file): Add map_is_allocated_ field.
3758         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3759         not available, provide stubs.  If mremap is not available, #define
3760         it to gold_mremap.
3761         (MREMAP_MAYMOVE): Define if not defined.
3762         (Output_file::Output_file): Initialize map_is_allocated_.
3763         (Output_file::resize): Check map_is_allocated_.
3764         (Output_file::map_anonymous): If mmap fails, use malloc.
3765         (Output_file::unmap): Don't do anything for an anonymous map.
3766         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3767         is not available, provide stubs.
3768         (File_read::View::~View): Use free rather than delete[].
3769         (File_read::make_view): Use malloc rather than new[].  If mmap
3770         fails, use malloc.
3771         (File_read::find_or_make_view): Use malloc rather than new[].
3772         * gold.h: Remove HAVE_REMAP code.
3773         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3774         exists.  Rename mremap to gold_mremap.  If mmap is not available
3775         don't do anything.
3776         * configure, config.in: Rebuild.
3777
3778 2011-04-11  Ian Lance Taylor  <iant@google.com>
3779
3780         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3781         initialize local variable v.
3782
3783 2011-04-11  Cary Coutant  <ccoutant@google.com>
3784
3785         * archive.cc (Archive::include_member): Adjust call to
3786         report_object.
3787         (Add_archive_symbols::run): Track argument serial numbers.
3788         (Lib_group::include_member): Likewise.
3789         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3790         * archive.h (Incremental_archive_entry::Archive_member):
3791         Initialize arg_serial_.
3792         (Archive_member::arg_serial_): New data member.
3793         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3794         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3795         incremental link.
3796         (Sized_dynobj::do_for_all_local_got_entries): New function.
3797         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3798         function.
3799         * fileread.cc (get_mtime): New function.
3800         * fileread.h (get_mtime): New function.
3801         * gold.cc (queue_initial_tasks): Check for incremental update.
3802         (process_incremental_input): New function.
3803         (queue_middle_tasks): Don't force valid target for incremental
3804         update.
3805         * incremental-dump.cc (find_input_containing_global): Adjust
3806         size of symbol info entry.
3807         (dump_incremental_inputs): Dump argument serial number and
3808         in_system_directory flag; bias shndx by 1; print symbol names
3809         when dumping per-file symbol lists; use new symbol info readers.
3810         * incremental.cc
3811         (Output_section_incremental_inputs:update_data_size): New function.
3812         (Sized_incremental_binary::setup_readers): Setup input readers
3813         for each input file; build maps for files added from libraries
3814         and scripts.
3815         (Sized_incremental_binary::check_input_args): New function.
3816         (Sized_incremental_binary::do_check_inputs): Build map of argument
3817         serial numbers to input arguments.
3818         (Sized_incremental_binary::do_file_has_changed): Rename
3819         do_file_is_unchanged to this; compare file modification times.
3820         (Sized_incremental_binary::do_init_layout): New function.
3821         (Sized_incremental_binary::do_reserve_layout): New function.
3822         (Sized_incremental_binary::do_get_input_reader): Remove.
3823         (Sized_incremental_binary::get_symtab_view): New function.
3824         (Incremental_checker::can_incrementally_link_output_file): Remove.
3825         (Incremental_inputs::report_command_line): Exclude --debug options.
3826         (Incremental_inputs::report_archive_begin): Add parameter; track
3827         argument serial numbers; don't put input file entry for archive
3828         before archive members.
3829         (Incremental_inputs::report_archive_end): Put input file entry
3830         for archive after archive members.
3831         (Incremental_inputs::report_object): Add parameter; track argument
3832         serial numbers and in_system_directory flag.
3833         (Incremental_inputs::report_script): Add parameter; track argument
3834         serial numbers.
3835         (Output_section_incremental_inputs::set_final_data_size): Adjust
3836         size of symbol info entry; check for forwarding symbols.
3837         (Output_section_incremental_inputs::write_input_files): Write
3838         in_system_directory flag and argument serial number.
3839         (Output_section_incremental_inputs::write_info_blocks): Map section
3840         indices between incremental info and original input file; store
3841         input section index for each symbol.
3842         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3843         change operator() to visit().
3844         (class Global_got_offset_visitor): Likewise.
3845         (class Global_symbol_visitor_got_plt):
3846         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3847         classes.
3848         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3849         (Sized_incr_relobj::do_read_symbols): New function.
3850         (Sized_incr_relobj::do_layout): New function.
3851         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3852         (Sized_incr_relobj::do_add_symbols): New function.
3853         (Sized_incr_relobj::do_should_include_member): New function.
3854         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3855         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3856         (Sized_incr_relobj::do_section_size): New function.
3857         (Sized_incr_relobj::do_section_name): New function.
3858         (Sized_incr_relobj::do_section_contents): New function.
3859         (Sized_incr_relobj::do_section_flags): New function.
3860         (Sized_incr_relobj::do_section_entsize): New function.
3861         (Sized_incr_relobj::do_section_address): New function.
3862         (Sized_incr_relobj::do_section_type): New function.
3863         (Sized_incr_relobj::do_section_link): New function.
3864         (Sized_incr_relobj::do_section_info): New function.
3865         (Sized_incr_relobj::do_section_addralign): New function.
3866         (Sized_incr_relobj::do_initialize_xindex): New function.
3867         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3868         (Sized_incr_relobj::do_read_relocs): New function.
3869         (Sized_incr_relobj::do_gc_process_relocs): New function.
3870         (Sized_incr_relobj::do_scan_relocs): New function.
3871         (Sized_incr_relobj::do_count_local_symbols): New function.
3872         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3873         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3874         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3875         (Sized_incr_relobj::do_relocate): New function.
3876         (Sized_incr_relobj::do_set_section_offset): New function.
3877         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3878         (Sized_incr_dynobj::do_read_symbols): New function.
3879         (Sized_incr_dynobj::do_layout): New function.
3880         (Sized_incr_dynobj::do_add_symbols): New function.
3881         (Sized_incr_dynobj::do_should_include_member): New function.
3882         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3883         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3884         (Sized_incr_dynobj::do_section_size): New function.
3885         (Sized_incr_dynobj::do_section_name): New function.
3886         (Sized_incr_dynobj::do_section_contents): New function.
3887         (Sized_incr_dynobj::do_section_flags): New function.
3888         (Sized_incr_dynobj::do_section_entsize): New function.
3889         (Sized_incr_dynobj::do_section_address): New function.
3890         (Sized_incr_dynobj::do_section_type): New function.
3891         (Sized_incr_dynobj::do_section_link): New function.
3892         (Sized_incr_dynobj::do_section_info): New function.
3893         (Sized_incr_dynobj::do_section_addralign): New function.
3894         (Sized_incr_dynobj::do_initialize_xindex): New function.
3895         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3896         (make_sized_incremental_object): New function.
3897         (Incremental_library::copy_unused_symbols): New function.
3898         (Incremental_library::do_for_all_unused_symbols): New function.
3899         * incremental.h (enum Incremental_input_flags): New type.
3900         (class Incremental_checker): Remove.
3901         (Incremental_input_entry::Incremental_input_entry): Add argument
3902         serial number.
3903         (Incremental_input_entry::arg_serial): New function.
3904         (Incremental_input_entry::set_is_in_system_directory): New function.
3905         (Incremental_input_entry::is_in_system_directory): New function.
3906         (Incremental_input_entry::arg_serial_): New data member.
3907         (Incremental_input_entry::is_in_system_directory_): New data member.
3908         (class Script_info): Move here from script.h.
3909         (Script_info::Script_info): Add filename parameter.
3910         (Script_info::filename): New function.
3911         (Script_info::filename_): New data member.
3912         (Incremental_script_entry::Incremental_script_entry): Add argument
3913         serial number.
3914         (Incremental_object_entry::Incremental_object_entry): Likewise.
3915         (Incremental_object_entry::add_input_section): Build list of input
3916         sections with map to original shndx.
3917         (Incremental_object_entry::get_input_section_index): New function.
3918         (Incremental_object_entry::shndx_): New data member.
3919         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3920         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3921         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3922         serial number.
3923         (Incremental_inputs::report_archive_begin): Likewise.
3924         (Incremental_inputs::report_object): Likewise.
3925         (Incremental_inputs::report_script): Likewise.
3926         (class Incremental_global_symbol_reader): New class.
3927         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3928         and store flags and input file type.
3929         (Incremental_input_entry_reader::arg_serial): New function.
3930         (Incremental_input_entry_reader::type): Extract type from flags.
3931         (Incremental_input_entry_reader::is_in_system_directory): New function.
3932         (Incremental_input_entry_reader::get_input_section_count): Call
3933         accessor function for type.
3934         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3935         function for type; adjust size of global symbol entry.
3936         (Incremental_input_entry_reader::get_global_symbol_count): Call
3937         accessor function for type.
3938         (Incremental_input_entry_reader::get_object_count): Likewise.
3939         (Incremental_input_entry_reader::get_object_offset): Likewise.
3940         (Incremental_input_entry_reader::get_member_count): Likewise.
3941         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3942         (Incremental_input_entry_reader::get_member_offset): Likewise.
3943         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3944         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3945         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3946         (Incremental_input_entry_reader::get_global_symbol_reader): New
3947         function.
3948         (Incremental_input_entry_reader::get_output_symbol_index): New
3949         function.
3950         (Incremental_input_entry_reader::type_): Remove.
3951         (Incremental_input_entry_reader::flags_): New data member.
3952         (Incremental_inputs_reader::input_file_offset): New function.
3953         (Incremental_inputs_reader::input_file_index): New function.
3954         (Incremental_inputs_reader::input_file): Call input_file_offset.
3955         (Incremental_inputs_reader::input_file_at_offset): New function.
3956         (Incremental_relocs_reader::get_r_type): Reformat.
3957         (Incremental_relocs_reader::get_r_shndx): Reformat.
3958         (Incremental_relocs_reader::get_r_offset): Reformat.
3959         (Incremental_relocs_reader::data): New function.
3960         (Incremental_binary::Incremental_binary): Initialize new data members.
3961         (Incremental_binary::check_inputs): Add cmdline parameter.
3962         (Incremental_binary::file_is_unchanged): Remove.
3963         (Input_reader::arg_serial): New function.
3964         (Input_reader::get_unused_symbol_count): New function.
3965         (Input_reader::get_unused_symbol): New function.
3966         (Input_reader::do_arg_serial): New function.
3967         (Input_reader::do_get_unused_symbol_count): New function.
3968         (Input_reader::do_get_unused_symbol): New function.
3969         (Incremental_binary::input_file_count): New function.
3970         (Incremental_binary::get_input_reader): Change signature to use
3971         index instead of filename.
3972         (Incremental_binary::file_has_changed): New function.
3973         (Incremental_binary::get_input_argument): New function.
3974         (Incremental_binary::get_library): New function.
3975         (Incremental_binary::get_script_info): New function.
3976         (Incremental_binary::init_layout): New function.
3977         (Incremental_binary::reserve_layout): New function.
3978         (Incremental_binary::output_file): New function.
3979         (Incremental_binary::do_check_inputs): New function.
3980         (Incremental_binary::do_file_is_unchanged): Remove.
3981         (Incremental_binary::do_file_has_changed): New function.
3982         (Incremental_binary::do_init_layout): New function.
3983         (Incremental_binary::do_reserve_layout): New function.
3984         (Incremental_binary::do_input_file_count): New function.
3985         (Incremental_binary::do_get_input_reader): Change signature.
3986         (Incremental_binary::input_args_map_): New data member.
3987         (Incremental_binary::library_map_): New data member.
3988         (Incremental_binary::script_map_): New data member.
3989         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3990         new data members.
3991         (Sized_incremental_binary::output_section): New function.
3992         (Sized_incremental_binary::inputs_reader): Add const.
3993         (Sized_incremental_binary::symtab_reader): Add const.
3994         (Sized_incremental_binary::relocs_reader): Add const.
3995         (Sized_incremental_binary::got_plt_reader): Add const.
3996         (Sized_incremental_binary::get_symtab_view): New function.
3997         (Sized_incremental_binary::Inputs_reader): New typedef.
3998         (Sized_incremental_binary::Input_entry_reader): New typedef.
3999         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4000         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4001         (Sized_incremental_binary::do_file_has_changed): New function.
4002         (Sized_incremental_binary::do_init_layout): New function.
4003         (Sized_incremental_binary::do_reserve_layout): New function.
4004         (Sized_input_reader::Inputs_reader): Remove.
4005         (Sized_input_reader::Input_entry_reader): Remove.
4006         (Sized_input_reader::do_arg_serial): New function.
4007         (Sized_input_reader::do_get_unused_symbol_count): New function.
4008         (Sized_input_reader::do_get_unused_symbol): New function.
4009         (Sized_incremental_binary::do_input_file_count): New function.
4010         (Sized_incremental_binary::do_get_input_reader): Change signature;
4011         use index instead of filename.
4012         (Sized_incremental_binary::section_map_): New data member.
4013         (Sized_incremental_binary::input_entry_readers_): New data member.
4014         (class Sized_incr_relobj): New class.
4015         (class Sized_incr_dynobj): New class.
4016         (make_sized_incremental_object): New function.
4017         (class Incremental_library): New class.
4018         * layout.cc (Free_list::num_lists): New static data member.
4019         (Free_list::num_nodes): New static data member.
4020         (Free_list::num_removes): New static data member.
4021         (Free_list::num_remove_visits): New static data member.
4022         (Free_list::num_allocates): New static data member.
4023         (Free_list::num_allocate_visits): New static data member.
4024         (Free_list::init): New function.
4025         (Free_list::remove): New function.
4026         (Free_list::allocate): New function.
4027         (Free_list::dump): New function.
4028         (Free_list::print_stats): New function.
4029         (Layout_task_runner::run): Resize output file for incremental updates.
4030         (Layout::Layout): Initialize new data members.
4031         (Layout::set_incremental_base): New function.
4032         (Layout::init_fixed_output_section): New function.
4033         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4034         incremental updates.
4035         (Layout::create_gold_note): Do not create gold note section for
4036         incremental updates.
4037         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4038         for incremental updates.
4039         (Layout::set_section_offsets): For incremental updates, allocate space
4040         from free list.
4041         (Layout::create_symtab_sections): Layout with offsets relative to
4042         start of section; for incremental updates, allocate space from free
4043         list.
4044         (Layout::create_shdrs): For incremental updates, allocate space from
4045         free list.
4046         (Layout::finish_dynamic_section): For incremental updates, do not
4047         check --as-needed (fixed in subsequent patch).
4048         * layout.h (class Free_list): New class.
4049         (Layout::set_incremental_base): New function.
4050         (Layout::incremental_base): New function.
4051         (Layout::init_fixed_output_section): New function.
4052         (Layout::allocate): New function.
4053         (Layout::incremental_base_): New data member.
4054         (Layout::free_list_): New data member.
4055         * main.cc (main): Print Free_list statistics.
4056         * object.cc (Relobj::finalize_incremental_relocs): Add
4057         clear_counts parameter; clear counts only when clear_counts is set.
4058         (Sized_relobj::Sized_relobj): Initialize new base class.
4059         (Sized_relobj::do_layout): Don't report special sections.
4060         (Sized_relobj::do_for_all_local_got_entries): New function.
4061         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4062         symtab_off to all symbol table offsets.
4063         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4064         * object.h (class Got_offset_list): Move to top of file.
4065         (Object::Object): Allow case where input_file == NULL.
4066         (Object::~Object): Likewise.
4067         (Object::input_file): Assert that input_file != NULL.
4068         (Object::lock): Allow case where input_file == NULL.
4069         (Object::unlock): Likewise.
4070         (Object::is_locked): Likewise.
4071         (Object::token): Likewise.
4072         (Object::release): Likewise.
4073         (Object::is_incremental): New function.
4074         (Object::get_mtime): New function.
4075         (Object::for_all_local_got_entries): New function.
4076         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4077         (Object::set_is_in_system_directory): New function.
4078         (Object::is_in_system_directory): New function.
4079         (Object::do_is_incremental): New function.
4080         (Object::do_get_mtime): New function.
4081         (Object::do_for_all_local_got_entries): New function.
4082         (Object::is_in_system_directory_): New data member.
4083         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4084         (class Sized_relobj_base): New class.
4085         (class Sized_relobj): Derive from Sized_relobj_base.
4086         (class Sized_relobj::Symbols): Redeclare from base class.
4087         (class Sized_relobj::local_got_offset_list): Remove.
4088         (class Sized_relobj::Output_sections): Redeclare from base class.
4089         (class Sized_relobj::do_for_all_local_got_entries): New function.
4090         (class Sized_relobj::write_local_symbols): Add offset parameter.
4091         (class Sized_relobj::local_symbol_offset_): Update comment.
4092         (class Sized_relobj::local_dynsym_offset_): Update comment.
4093         * options.cc (Input_arguments::add_file): Remove const.
4094         * options.h (Input_file_argument::Input_file_argument):
4095         Initialize arg_serial_ (all constructors).
4096         (Input_file_argument::set_arg_serial): New function.
4097         (Input_file_argument::arg_serial): New function.
4098         (Input_file_argument::arg_serial_): New data member.
4099         (Input_arguments::Input_arguments): Initialize file_count_.
4100         (Input_arguments::add_file): Remove const.
4101         (Input_arguments::number_of_input_files): New function.
4102         (Input_arguments::file_count_): New data member.
4103         (Command_line::number_of_input_files): Call
4104         Input_arguments::number_of_input_files.
4105         * output.cc (Output_segment_headers::Output_segment_headers):
4106         Set current size.
4107         (Output_section::Input_section::current_data_size): New function.
4108         (Output_section::Output_section): Initialize new data members.
4109         (Output_section::add_input_section): Don't do merge sections for
4110         an incremental link; allocate space from free list for an
4111         incremental update.
4112         (Output_section::add_output_section_data): Allocate space from
4113         free list for an incremental update.
4114         (Output_section::update_data_size): New function.
4115         (Output_section::set_fixed_layout): New function.
4116         (Output_section::reserve): New function.
4117         (Output_segment::set_section_addresses): Remove const.
4118         (Output_segment::set_section_list_addresses): Remove const; allocate
4119         space from free list for an incremental update.
4120         (Output_segment::set_offset): Adjust size of RELRO segment for an
4121         incremental update.
4122         * output.h (Output_data::current_data_size): Move here from
4123         child classes.
4124         (Output_data::pre_finalize_data_size): New function.
4125         (Output_data::update_data_size): New function.
4126         (Output_section_headers::update_data_size): new function.
4127         (Output_section_data_build::current_data_size): Move to Output_data.
4128         (Output_data_strtab::update_data_size): New function.
4129         (Output_section::current_data_size): Move to Output_data.
4130         (Output_section::set_fixed_layout): New function.
4131         (Output_section::has_fixed_layout): New function.
4132         (Output_section::reserve): New function.
4133         (Output_section::update_data_size): New function.
4134         (Output_section::has_fixed_layout_): New data member.
4135         (Output_section::free_list_): New data member.
4136         (Output_segment::set_section_addresses): Remove const.
4137         (Output_segment::set_section_list_addresses): Remove const.
4138         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4139         New function.
4140         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4141         New function.
4142         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4143         parameter when calling Add_symbols constructor; store argument
4144         serial number for members of a lib group.
4145         (Add_symbols::locks): Allow case where token == NULL.
4146         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4147         (Read_member::~Read_member): New function.
4148         (Read_member::is_runnable): New function.
4149         (Read_member::locks): New function.
4150         (Read_member::run): New function.
4151         (Check_script::~Check_script): New function.
4152         (Check_script::is_runnable): New function.
4153         (Check_script::locks): New function.
4154         (Check_script::run): New function.
4155         (Check_library::~Check_library): New function.
4156         (Check_library::is_runnable): New function.
4157         (Check_library::locks): New function.
4158         (Check_library::run): New function.
4159         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4160         (Add_symbols::library_): New data member.
4161         (class Read_member): New class.
4162         (class Check_script): New class.
4163         (class Check_library): New class.
4164         * reloc.cc (Read_relocs::is_runnable): Allow case where
4165         token == NULL.
4166         (Read_relocs::locks): Likewise.
4167         (Scan_relocs::locks): Likewise.
4168         (Relocate_task::locks): Likewise.
4169         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4170         to clear counters.
4171         (Sized_relobj::incremental_relocs_scan): Fix comment.
4172         (Sized_relobj::do_relocate): Pass output file offset to
4173         write_local_symbols.
4174         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4175         from class declaration.
4176         * script.cc (read_input_script): Allocate Script_info; pass
4177         argument serial number to report_script.
4178         * script.h (class Script_info): Move to incremental.h.
4179         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4180         * symtab.h (Symbol_table::add_from_incrobj): New function.
4181         (Symbol_table::set_file_offset): New function.
4182
4183 2011-04-05  Cary Coutant  <ccoutant@google.com>
4184
4185         * incremental-dump.cc (dump_incremental_inputs): Change signature
4186         to take a Sized_incremental_binary; change caller.  Use readers
4187         in Sized_incremental_binary.
4188         * incremental.cc
4189         (Sized_incremental_binary::find_incremental_inputs_sections):
4190         Rename do_find_incremental_inputs_sections to this.
4191         (Sized_incremental_binary::setup_readers): New function.
4192         (Sized_incremental_binary::do_check_inputs): Check
4193         has_incremental_info_ flag; move setup code to setup_readers;
4194         use input readers.
4195         (Sized_incremental_binary::do_file_is_unchanged): New function.
4196         (Sized_incremental_binary::do_get_input_reader): New function.
4197         * incremental.h (class Incremental_binary): Move to end of file.
4198         (Incremental_binary::file_is_unchanged): New function.
4199         (Incremental_binary::do_file_is_unchanged): New function.
4200         (Incremental_binary::Input_reader): New class.
4201         (Incremental_binary::get_input_reader): New function.
4202         (class Sized_incremental_binary): Move to end of file.
4203         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4204         input section reader classes.
4205         (Sized_incremental_binary::has_incremental_info): New function.
4206         (Sized_incremental_binary::inputs_reader): New function.
4207         (Sized_incremental_binary::symtab_reader): New function.
4208         (Sized_incremental_binary::relocs_reader): New function.
4209         (Sized_incremental_binary::got_plt_reader): New function.
4210         (Sized_incremental_binary::do_file_is_unchanged): New function.
4211         (Sized_incremental_binary::Sized_input_reader): New class.
4212         (Sized_incremental_binary::get_input_reader): New function.
4213         (Sized_incremental_binary::find_incremental_inputs_sections):
4214         Rename do_find_incremental_inputs_sections to this.
4215         (Sized_incremental_binary::setup_readers): New function.
4216         (Sized_incremental_binary::has_incremental_info_): New data member.
4217         (Sized_incremental_binary::inputs_reader_): New data member.
4218         (Sized_incremental_binary::symtab_reader_): New data member.
4219         (Sized_incremental_binary::relocs_reader_): New data member.
4220         (Sized_incremental_binary::got_plt_reader_): New data member.
4221         (Sized_incremental_binary::current_input_file_): New data member.
4222
4223 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4224
4225         PR gold/12640
4226         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4227         violation.
4228
4229 2011-03-30  Cary Coutant  <ccoutant@google.com>
4230
4231         * archive.cc (Archive::include_member): Adjust call to report_object.
4232         (Add_archive_symbols::run): Add script_info to call to
4233         report_archive_begin.
4234         (Lib_group::include_member): Adjust call to report_object.
4235         (Add_lib_group_symbols::run): Adjust call to report_object.
4236         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4237         blocks.  Add object count for script input files.
4238         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4239         script_info parameter; change all callers.
4240         (Incremental_inputs::report_object): Add script_info parameter;
4241         change all callers.
4242         (Incremental_inputs::report_script): Store backpointer to
4243         incremental info entry.
4244         (Output_section_incremental_inputs::set_final_data_size): Record
4245         additional information for scripts.
4246         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4247         * incremental.h (Incremental_script_entry::add_object): New function.
4248         (Incremental_script_entry::get_object_count): New function.
4249         (Incremental_script_entry::get_object): New function.
4250         (Incremental_script_entry::objects_): New data member; adjust
4251         constructor.
4252         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4253         (Incremental_inputs::report_object): Add script_info parameter.
4254         (Incremental_inputs_reader::get_object_count): New function.
4255         (Incremental_inputs_reader::get_object_offset): New function.
4256         * options.cc (Input_arguments::add_file): Return reference to
4257         new input argument.
4258         * options.h (Input_argument::set_script_info): New function.
4259         (Input_argument::script_info): New function.
4260         (Input_argument::script_info_): New data member; adjust all
4261         constructors.
4262         (Input_file_group::add_file): Return reference to new input argument.
4263         (Input_file_lib::add_file): Likewise.
4264         (Input_arguments::add_file): Likewise.
4265         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4266         * script.cc (Parser_closure::Parser_closure): Add script_info
4267         parameter; adjust all callers.
4268         (Parser_closure::script_info): New function.
4269         (Parser_closure::script_info_): New data member.
4270         (read_input_script): Report scripts earlier to incremental info.
4271         (script_add_file): Set script_info in Input_argument.
4272         (script_add_library): Likewise.
4273         * script.h (Script_options::Script_info): Rewrite class.
4274
4275 2011-03-29  Cary Coutant  <ccoutant@google.com>
4276
4277         * archive.cc (Library_base::should_include_member): Move
4278         method here from class Archive.
4279         (Archive::Archive): Initialize base class.
4280         (Archive::should_include_member): Move to base class.
4281         (Archive::do_for_all_unused_symbols): New function.
4282         (Add_archive_symbols::run): Remove redundant access to
4283         incremental_inputs.
4284         (Lib_group::Lib_group): Initialize base class.
4285         (Lib_group::do_filename): New function.
4286         (Lib_group::include_member): Pass pointer to Lib_group to
4287         report_object.
4288         (Lib_group::do_for_all_unused_symbols): New function.
4289         (Add_lib_group_symbols::run): Report archive information for
4290         incremental links.
4291         * archive.h (class Library_base): New base class.
4292         (class Archive): Derive from Library_base.
4293         (Archive::filename): Move to base class.
4294         (Archive::set_incremental_info): Likewise.
4295         (Archive::incremental_info): Likewise.
4296         (Archive::Should_include): Likewise.
4297         (Archive::should_include_member): Likewise.
4298         (Archive::Armap_entry): Remove.
4299         (Archive::Unused_symbol_iterator): Remove.
4300         (Archive::unused_symbols_begin): Remove.
4301         (Archive::unused_symbols_end): Remove.
4302         (Archive::do_filename): New function.
4303         (Archive::do_get_mtime): New function.
4304         (Archive::do_for_all_unused_symbols): New function.
4305         (Archive::task_): Move to base class.
4306         (Archive::incremental_info_): Likewise.
4307         (class Lib_group): Derive from Library_base.
4308         (Lib_group::do_filename): New function.
4309         (Lib_group::do_get_mtime): New function.
4310         (Lib_group::do_for_all_unused_symbols): New function.
4311         (Lib_group::task_): Move to base class.
4312         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4313         function.
4314         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4315         function.
4316         * incremental.cc (Incremental_inputs::report_archive_begin):
4317         Use Library_base; call library's get_mtime; add incremental inputs
4318         entry before members.
4319         (class Unused_symbol_visitor): New class.
4320         (Incremental_inputs::report_archive_end): Use Library_base; use
4321         visitor class to record unused symbols; don't add incremental inputs
4322         entry after members.
4323         (Incremental_inputs::report_object): Use Library_base.
4324         * incremental.h
4325         (Incremental_archive_entry::Incremental_archive_entry): Remove
4326         unused Archive parameter.
4327         (Incremental_inputs::report_archive_begin): Use Library_base.
4328         (Incremental_inputs::report_archive_end): Likewise.
4329         (Incremental_inputs::report_object): Likewise.
4330         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4331         function.
4332         * object.h (Object::for_all_global_symbols): New function.
4333         (Object::do_for_all_global_symbols): New function.
4334         (Sized_relobj::do_for_all_global_symbols): New function.
4335         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4336         function.
4337         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4338         function.
4339
4340 2011-03-27  Ian Lance Taylor  <iant@google.com>
4341
4342         * archive.cc (Archive::interpret_header): Return -1 if something
4343         goes wrong.  Change callers accordingly.
4344
4345 2011-03-25  Cary Coutant  <ccoutant@google.com>
4346
4347         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4348         * testsuite/Makefile.in: Regenerate.
4349
4350 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4351
4352         * plugin.cc (get_view): New.
4353         (Plugin::load): Pass get_view to the plugin.
4354         (Plugin_manager::get_view): New.
4355
4356 2011-03-21  Ian Lance Taylor  <iant@google.com>
4357
4358         * testsuite/final_layout.sh: Rewrite to not use dc.
4359         * testsuite/relro_test.sh: Fail if dc is not present.
4360
4361 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4362
4363         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4364         Change == to -eq.
4365         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4366         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4367         Change == to -eq.
4368         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4369         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4370
4371 2011-03-14  Ian Lance Taylor  <iant@google.com>
4372
4373         * script-sections.cc (Sort_output_sections::script_compare):
4374         Rename from is_before, change return type.
4375         (Sort_output_sections::operator()): Adjust accordingly.
4376
4377 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4378
4379         PR gold/12572
4380         * testsuite/odr_violation2.cc: Add comment to make all error line
4381         numbers double digits.
4382         * testsuite/debug_msg.sh: Adjust expected errors.
4383
4384 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4385
4386         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4387         but mark earlier ones as non-canonical
4388         (offset_to_iterator): Update search target and example
4389         (do_addr2line): Return extra lines in a vector*
4390         (format_file_lineno): Extract from do_addr2line
4391         (one_addr2line): Add vector* out-param
4392         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4393         when a lineno entry appeared last for its instruction
4394         (Dwarf_line_info): Add vector* out-param
4395         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4396         * symtab.cc (Odr_violation_compare): Include the lineno in the
4397         comparison again.
4398         (linenos_from_loc): New. Combine the canonical line for an
4399         address with its other lines.
4400         (True_if_intersect): New. Helper functor to make
4401         std::set_intersection a query.
4402         (detect_odr_violations): Compare sets of lines instead of just
4403         one line for each function. This became less deterministic, but
4404         has fewer false positives.
4405         * symtab.h: Declarations.
4406         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4407         mix an optimized and non-optimized object in the same binary
4408         (odr_violation2.so): Same.
4409         * testsuite/Makefile.in: Regenerate from Makefile.am.
4410         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4411         * testsuite/debug_msg.sh: Update line numbers and add
4412         assertions.
4413         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4414         non-optimized context.
4415         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4416         isn't inlined, and use OdrDerived in an optimized context.
4417         * testsuite/odr_header1.h: Defines OdrDerived, where
4418         optimization will change the
4419         first-instruction-in-the-destructor's file and line number.
4420         * testsuite/odr_header2.h: Defines OdrBase.
4421
4422 2011-03-09  Ian Lance Taylor  <iant@google.com>
4423
4424         * fileread.cc (File_read::clear_views): Don't delete the whole
4425         file view.
4426
4427 2011-03-08  Ian Lance Taylor  <iant@google.com>
4428
4429         PR gold/12525
4430         * fileread.cc: #include <climits>.
4431         (GOLD_IOV_MAX): Define.
4432         (File_read::read_multiple): Limit number of entries by iov_max.
4433         * fileread.h (class File_read): Always set max_readv_entries to
4434         128.
4435
4436 2011-03-07  Ian Lance Taylor  <iant@google.com>
4437
4438         PR gold/12525
4439         * options.h (class General_options): Add -dy and -dn.
4440
4441 2011-03-02  Cary Coutant  <ccoutant@google.com>
4442
4443         * testsuite/script_test_9.t: Add TLS segment.
4444
4445 2011-03-02  Simon Baldwin  <simonb@google.com>
4446
4447         * configure.ac: Add check for gnu_indirect_function support in
4448         the toolchain building binutils.
4449         * configure: Rebuild.
4450
4451 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4452
4453         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4454         plugin only symbols.
4455         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4456         in plugin files as not needed in the symbol table.
4457
4458 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4459
4460         * output.cc (Output_section::add_input_section): Delay fill
4461         generation for section ordering.
4462
4463 2011-02-09  Ian Lance Taylor  <iant@google.com>
4464
4465         PR gold/12316
4466         * object.h (class Sized_relobj): Remove clear_local_symbols.
4467         * reloc.cc (Sized_relobj::do_relocate): Don't call
4468         clear_local_symbols.
4469
4470 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4471
4472         * plugin.cc (is_visible_from_outside): Return true for symbols
4473         in the -u option.
4474
4475 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4476
4477         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4478         filename.
4479
4480 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4481
4482         * icf.h (is_section_foldable_candidate): Change type of parameter
4483         to std::string.
4484         * icf.cc (Icf::find_identical_sections): Change type of local variable
4485         section_name to be std::string.
4486         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4487
4488 2011-01-25  Ian Lance Taylor  <iant@google.com>
4489
4490         * script.cc (script_add_extern): Rewrite to use
4491         add_symbol_reference.
4492
4493 2011-01-25  Doug Kwan  <dougkwan@google.com>
4494
4495         * icf.cc (get_section_contents): Always lock section's object.
4496
4497 2011-01-24  Ian Lance Taylor  <iant@google.com>
4498
4499         * options.h (class General_options): Accept
4500         --no-detect-odr-violations.
4501
4502 2011-01-24  Ian Lance Taylor  <iant@google.com>
4503
4504         * version.cc (version_string): Bump to 1.11.
4505
4506 2011-01-24  Ian Lance Taylor  <iant@google.com>
4507
4508         * plugin.cc (class Plugin_rescan): Define new class.
4509         (Plugin_manager::claim_file): Set any_claimed_.
4510         (Plugin_manager::save_archive): New function.
4511         (Plugin_manager::save_input_group): New function.
4512         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4513         necessary.
4514         (Plugin_manager::new_undefined_symbol): New function.
4515         (Plugin_manager::rescan): New function.
4516         (Plugin_manager::rescannable_defines): New function.
4517         (Plugin_manager::add_input_file): Set any_added_.
4518         * plugin.h (class Plugin_manager): define new fields rescannable_,
4519         undefined_symbols_, any_claimed_, and any_added_.  Declare
4520         Plugin_rescan as friend.  Declare new functions.
4521         (Plugin_manager::Rescannable): Define type.
4522         (Plugin_manager::Rescannable_list): Define type.
4523         (Plugin_manager::Undefined_symbol_list): Define type.
4524         (Plugin_manager::Plugin_manager): Initialize new fields.
4525         * archive.cc (Archive::defines_symbol): New function.
4526         (Add_archive_symbols::run): Pass archive to plugins if any.
4527         * archive.h (class Archive): Declare defines_symbol.
4528         * readsyms.cc (Input_group::~Input_group): New function.
4529         (Finish_group::run): Pass input_group to plugins if any.
4530         * readsyms.h (class Input_group): Declare destructor.
4531         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4532         any.
4533
4534 2011-01-10  Ian Lance Taylor  <iant@google.com>
4535
4536         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4537         section as relro.
4538         (Layout::set_segment_offsets): Reset increase_relro before calling
4539         set_section_addresses a second time.
4540
4541 2011-01-04  Cary Coutant  <ccoutant@google.com>
4542
4543         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4544         sections before NOBITS sections.
4545
4546 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4547
4548         * version.cc (print_version): Update copyright to 2011.
4549
4550 2010-12-23  Cary Coutant  <ccoutant@google.com>
4551
4552         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4553         of OS to this->add.  Add OD parameter to second form of the function.
4554
4555 2010-12-20  Ian Lance Taylor  <iant@google.com>
4556
4557         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4558         second of two consecutive entries with same offset.
4559
4560 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4561
4562         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4563         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4564         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4565         to avoid unneeded links against $(LDADD).
4566         * testsuite/Makefile.in: Regenerate.
4567
4568 2010-12-15  Ian Lance Taylor  <iant@google.com>
4569
4570         PR gold/12324
4571         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4572         for R_X86_64_32 and R_X86_64_PC32.
4573         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4574         ver_matching_def_pic.o.
4575         (ver_matching_def_pic.o): New target.
4576
4577 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4578
4579         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4580         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4581         Move definition before File_read::View member definitions.
4582         (File_read::View::~View): Initialize and hold lock before
4583         updating current_mapped_bytes.
4584
4585 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4586
4587         * dwarf_reader.cc: Remove outdated comment.
4588         * gold-threads.cc: Fix typo in error message.
4589         * archive.cc: Fix typos in comments.
4590         * archive.h: Likewise.
4591         * arm-reloc-property.cc: Likewise.
4592         * arm-reloc-property.h: Likewise.
4593         * arm-reloc.def: Likewise.
4594         * arm.cc: Likewise.
4595         * attributes.h: Likewise.
4596         * cref.cc: Likewise.
4597         * ehframe.cc: Likewise.
4598         * fileread.h: Likewise.
4599         * gold.h: Likewise.
4600         * i386.cc: Likewise.
4601         * icf.cc: Likewise.
4602         * incremental.h: Likewise.
4603         * int_encoding.cc: Likewise.
4604         * layout.h: Likewise.
4605         * main.cc: Likewise.
4606         * merge.h: Likewise.
4607         * object.cc: Likewise.
4608         * object.h: Likewise.
4609         * options.cc: Likewise.
4610         * readsyms.cc: Likewise.
4611         * reduced_debug_output.cc: Likewise.
4612         * reloc.cc: Likewise.
4613         * script-sections.cc: Likewise.
4614         * sparc.cc: Likewise.
4615         * symtab.h: Likewise.
4616         * target-reloc.h: Likewise.
4617         * target.cc: Likewise.
4618         * target.h: Likewise.
4619         * timer.cc: Likewise.
4620         * timer.h: Likewise.
4621         * x86_64.cc: Likewise.
4622
4623 2010-12-09  Cary Coutant  <ccoutant@google.com>
4624
4625         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4626         stack.
4627         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4628         parameter; change all callers.
4629         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4630         * options.h (warn_execstack): New option.
4631
4632 2010-12-07  Doug Kwan  <dougkwan@google.com>
4633
4634         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4635         like function call relocations.
4636
4637 2010-12-07  Ian Lance Taylor  <iant@google.com>
4638
4639         * archive.cc (Archive::get_elf_object_for_member): Permit
4640         punconfigured to be NULL.
4641         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4642         (Archive::include_member): Pass NULL to get_elf_object_for_member
4643         if we searched for the archive and this is the first included
4644         object.
4645
4646 2010-12-01  Ian Lance Taylor  <iant@google.com>
4647
4648         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4649         track_relocs_type_ field.
4650         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4651         Set track_relocs_type_.
4652         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4653         contents when using RELA relocs.
4654         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4655         reloc_map_.
4656         * reloc.cc (Track_relocs::next_addend): New function.
4657         * reloc.h (class Track_relocs): Declare next_addend.
4658
4659 2010-12-01  Ian Lance Taylor  <iant@google.com>
4660
4661         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4662         virtual destructor.
4663
4664 2010-12-01  Ian Lance Taylor  <iant@google.com>
4665
4666         * README: Update compilers known to work and fail.
4667
4668 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4669
4670         * configure.in: For --enable-gold, handle value `default' instead of
4671         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4672         not the default.
4673         * configure: Regenerate.
4674
4675 2010-11-18  Doug Kwan  <dougkwan@google.com>
4676
4677         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4678         and right_alignment to be zero.  Store result alignment only if it is
4679         greater than existing alignment.
4680
4681 2010-11-16  Cary Coutant  <ccoutant@google.com>
4682
4683         PR gold/12220
4684         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4685         Check for ".zdebug_line".
4686
4687 2010-11-16  Doug Kwan  <dougkwan@google.com>
4688             Cary Coutant  <ccoutant@google.com>
4689
4690         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4691         by reference; adjust all callers.
4692         * output.cc (Output_segment::set_section_addresses): Adjust references
4693         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4694         list is empty.
4695         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4696         end at page boundary.
4697
4698 2010-11-16  Cary Coutant  <ccoutant@google.com>
4699
4700         PR gold/12220
4701         * layout.cc (Layout::choose_output_section): Transform names of
4702         compressed sections even when using a script with a SECTIONS clause.
4703         (Layout::output_section_name): Remove code to transform
4704         compressed debug section names.
4705         * output.cc (Output_section::add_input_section): Use uncompressed
4706         section size when tracking input sections.
4707
4708 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4709
4710         * symtab.h (Symbol::NON_PIC_REF): Remove.
4711         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4712         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4713         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4714         (Symbol::use_plt_offset): Take a flags argument and pass it
4715         directly to needs_dynamic_reloc.  Restrict check for undefined
4716         weak symbols to function calls.
4717         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4718         (Target_arm::Scan::global): Use it.
4719         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4720         (Target_arm::Relocate::relocate): Likewise.
4721         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4722         parameter with an r_type parameter.  Use get_reference_flags
4723         to get the flags.
4724         (Target_arm::Relocate::relocate): Update accordingly.
4725         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4726         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4727         (Target_i386::Scan::global): Likewise.
4728         (Target_i386::Relocate::relocate): Likewise.
4729         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4730         parameter with an r_type parameter.  Use get_reference_flags
4731         to get the flags.
4732         (Target_i386::Relocate::relocate): Update accordingly.
4733         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4734         (Target_powerpc::Scan::global): Use it.
4735         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4736         (Target_powerpc::Relocate::relocate): Likewise.
4737         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4738         (Target_sparc::Scan::global): Use it.
4739         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4740         (Target_sparc::Relocate::relocate): Likewise.
4741         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4742         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4743         (Target_x86_64::Scan::global): Likewise.
4744         (Target_x86_64::Relocate::relocate): Likewise.
4745
4746 2010-11-08  Doug Kwan  <dougkwan@google.com>
4747             Cary Coutant  <ccoutant@google.com>
4748
4749         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4750         (Arm_exidx_merge_section::section_contents_): New data member.
4751         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4752         (Arm_input_section::~Arm_input_section): De-allocate memory.
4753         (Arm_input_section::original_contents_): New data member.
4754         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4755         in parameters instead of calling Object::section_contents without
4756         locking.
4757         (Arm_output_section::group_section): New parameter TASK.  Pass it
4758         to callees that need locking objects.
4759         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4760         to lock EXIDX input sections.  Fix a formatting issue.  Call
4761         Arm_exidx_merged_section::build_contents to create merged section
4762         contents.
4763         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4764         to lock object of stub table owner.
4765         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4766         TEXT_SIZE to initialize data member TEXT_SIZE_.
4767         (Arm_exidx_input_section::addralign): Fix typo in comment.
4768         (Arm_exidx_input_section::text_size): New method.
4769         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4770         that require locking objects.  Lock objects before scanning for stubs
4771         and updating local symbols.
4772         (Arm_input_section<big_endian>::init): Copy contents of original
4773         input section.
4774         (Arm_input_section<big_endian>::do_write): Use saved contents of
4775         original input section instead of calling Object::section_contents
4776         without locking.
4777         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4778         size without calling Object::section_size().
4779         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4780         for size.  Allocate a buffer for merged EXIDX entries.
4781         (Arm_exidx_merged_section::build_contents): New method.
4782         (Arm_exidx_merged_section::do_write): Move merge section contents
4783         building code to Arm_exidx_merged_section::build_contetns.  Write
4784         out contetns in buffer instead of building it on the fly.
4785         (Arm_relobj::make_exidx_input_section): Also pass text section size
4786         to Arm_exidx_input_section constructor.
4787         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4788         (Arm_dynobj::do_read_symbols): Fix memory leak.
4789         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4790         * target.h: (class Task): Add forward declaration.
4791         (Target::relax): Add new parameter TASK and pass it to
4792         Target::do_relax().
4793         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4794
4795 2010-11-05  Cary Coutant  <ccoutant@google.com>
4796
4797         PR gold/10708
4798         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4799         object when reading from the file.
4800         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4801         second layout pass.
4802         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4803         when reading section contents.
4804         (get_section_contents): Likewise.
4805         (icf::find_identical_sections): Likewise.
4806         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4807         object when reading from the file.
4808         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4809         the object when doing deferred section layout.
4810
4811 2010-11-03  Nick Clifton  <nickc@redhat.com>
4812
4813         PR gold/12001
4814         * script.h (class Symbol_assignment: name): New member.  Returns
4815         the name of the symbol.
4816         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4817         Returns true if the given symbol name is on the list of
4818         assignments wating to be processed.
4819         * archive.cc (should_incldue_member): If the symbol is undefined,
4820         check to see if it is on the list of symbols pending assignment.
4821
4822 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4823
4824         * script-sections.cc (Script_sections::find_memory_region): Check
4825         for a NULL output section pointer.
4826
4827 2010-10-29  Doug Kwan  <dougkwan@google.com>
4828
4829         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4830         Output_section::add_relaxed_input_section.
4831         * output.cc (Output_section::add_relaxed_input_section): Add new
4832         arguments LAYOUT and NAME.  Set section order index.
4833         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4834         Copy section order index.
4835         * output.h (Output_section::add_relaxed_input_section): Add new
4836         arguments LAYOUT and NAME.
4837
4838 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4839
4840         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4841         NATIVE_OR_CROSS_LINKER.
4842         * testsuite/Makefile.in: Regenerate.
4843
4844 2010-10-20  Doug Kwan  <dougkwan@google.com>
4845
4846         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4847         without SHF_LINK_ORDER flags.
4848         * layout.cc (Layout::choose_output_section): Do not filter
4849         SHF_LINK_ORDER flag in a relocatable link.
4850
4851 2010-10-17  Cary Coutant  <ccoutant@google.com>
4852
4853         * output.h (Output_segment::set_section_addresses): Change function
4854         signature.  Update all callers.
4855         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4856         sections.
4857         (Output_segment::set_section_addresses): Align after last TLS
4858         section.  Add padding before last relro section instead of after.
4859
4860 2010-10-17  Doug Kwan  <dougkwan@google.com>
4861
4862         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4863         GOT output section to be writable.
4864
4865 2010-10-14  Cary Coutant  <ccoutant@google.com>
4866
4867         * debug.h (DEBUG_INCREMENTAL): New flag.
4868         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4869         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4870         mode.
4871         * incremental.cc (report_command_line): Ignore all forms of
4872         --incremental.
4873         * layout.cc (Layout::Layout): Check parameters for incremental link
4874         mode.
4875         * options.cc (General_options::parse_incremental): New function.
4876         (General_options::parse_no_incremental): New function.
4877         (General_options::parse_incremental_full): New function.
4878         (General_options::parse_incremental_update): New function.
4879         (General_options::incremental_mode_): New data member.
4880         (General_options::finalize): Check incremental_mode_.
4881         * options.h (General_options): Update help text for --incremental.
4882         Add --no-incremental, --incremental-full, --incremental-update.
4883         (General_options::Incremental_mode): New enum type.
4884         (General_options::incremental_mode): New function.
4885         (General_options::incremental_mode_): New data member.
4886         * parameters.cc (Parameters::incremental_mode_): New data member.
4887         (Parameters::set_options): Set incremental_mode_.
4888         (Parameters::set_incremental_full): New function.
4889         (Parameters::incremental): New function.
4890         (Parameters::incremental_update): New function.
4891         (set_parameters_incremental_full): New function.
4892         * parameters.h (Parameters::set_incremental_full): New function.
4893         (Parameters::incremental): New function.
4894         (Parameters::incremental_update): New function.
4895         (Parameters::incremental_mode_): New data member.
4896         (set_parameters_incremental_full): New function.
4897         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4898         incremental link mode.
4899         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4900         (Sized_relobj::do_relocate_sections): Likewise.
4901         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4902         option.
4903         * testsuite/Makefile.in: Regenerate.
4904         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4905
4906 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4907
4908         * script-sections.h (class Script_sections): Make
4909         Sections_elements typedef public.
4910         * script-sections.cc (class Sort_output_sections): Add elements_
4911         field.  Add constructor which sets it; change all callers.
4912         (Sort_output_sections::is_before): New function.
4913         (Sort_output_sections::operator()): Call is_before.
4914         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4915         conditional.
4916         * testsuite/script_test_10.sh: New test. Test script section
4917         order.
4918         * testsuite/script_test_10.t: Likewise.
4919         * testsuite/script_test_10.s: Likewise.
4920         * testsuite/Makefile.am: Wrap the cross linker tests and the
4921         common tests into NATIVE_OR_CROSS_LINKER.
4922         (check_SCRIPTS): Add script_test_10.sh.
4923         (check_DATA): Add script_test_10.stdout.
4924         (script_test_10.o, script_test_10): New targets.
4925         (script_test_10.stdout): New target.
4926         * configure, testsuite/Makefile.in: Regenerate.
4927
4928 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4929
4930         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4931         error for the deprecated relocations.
4932         (Target_arm::Scan::global): Likewise.
4933         (Target_arm::Relocate::relocate): Likewise.
4934
4935 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4936
4937         * fileread.cc (Input_file::find_file): Initialize *found_name
4938         and *namep when using the fallback search for case 4.
4939
4940 2010-10-11  Cary Coutant  <ccoutant@google.com>
4941
4942         * options.h (class General_options): Redefine -z lazy as an alias for
4943         the negation of -z now.
4944
4945 2010-10-11  Ian Lance Taylor  <iant@google.com>
4946
4947         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4948         binding.
4949
4950 2010-10-06  Nick Clifton  <nickc@redhat.com>
4951
4952         * script-sections.cc(class Memory_region): Remove
4953         current_lma_offset_ field.  Rename current_vma_offset_ to
4954         current_offset_.  Add last_section_ field.
4955         (Memory_region::get_current_vma_address): Rename to
4956         get_current_address.
4957         (Memory_region::get_current_lma_address): Delete.
4958         (Memory_region::increment_vma_offset): Rename to
4959         increment_offset.
4960         (Memory_region::increment_lma_offset): Delete.
4961         (Memory_region::attributes_compatible): New method.  Returns
4962         true if the provided section is compatible with the region.
4963         (Memory_region::get_last_section): New method.  Returns the last
4964         section to use the region.
4965         (Memory_region::set_last_section): New method.  Stores the last
4966         section to use the region.
4967         (Script_sections::block_in_region): New method.  Returns true if
4968         a block of memory is contained within a region.
4969         (Script_sections::find_memory_region): New method.  Locates a
4970         memory region to be used to set a VMA or LMA address.
4971         (Output_section_definition::set_section_addresses): Add code to
4972         check for addresses set by memory regions.
4973         (Output_segment::set_section_addresses): Remove memory region
4974         walking code.
4975         (Script_sections::create_segment): Add a warning if a header
4976         segment is created outside of any region.
4977         * script-sections.h (class Script_sections): Add prototypes for
4978         find_memory_region and block_in_region methods.
4979         * testsuite/memory_test.s: Use .long instead of .word.
4980         * testsuite/memory_test.t: Add some more output sections.
4981         * testsuite/memory_test.sh: Update expected output.
4982
4983 2010-10-02  Doug Kwan  <dougkwan@google.com>
4984
4985         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
4986         defintion to symtab.h
4987         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
4988         declaration to defintion.
4989
4990 2010-10-01  Nick Clifton  <nickc@redhat.com>
4991
4992         * expression.cc (eval): Replace dummy argument with NULL.
4993         (eval_maybe_dot): Check for a NULL result section pointer.
4994         (Symbol_expression::value): Likewise.
4995         (Dot_expression::value): Likewise.
4996         (BINARY_EXPRESSION): Likewise.
4997         (Max_expression::value): Likewise.
4998         (Min_expression::value): Likewise.
4999         (Absolute_expression::value): Likewise.
5000         (Addr_expression::value_from_output_section): Likewise.
5001         (Loaddddr_expression::value_from_output_section): Likewise.
5002         (Segment_start_expression::value): Likewise.
5003         * script-sections.cc
5004         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5005         argument with NULL.
5006         (Sections_elememt_dot_assignment::set_section_addresses):
5007         Likewise.
5008         (Output_data_expression::do_write_to_buffer): Likewise.
5009         (Output_section_definition::finalize_symbols): Likewise.
5010         (Output_section_definition::set_section_addresses): Likewise.
5011
5012 2010-09-30  Doug Kwan  <dougkwan@google.com>
5013
5014         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5015
5016 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5017
5018         * target.h (Target::can_icf_inline_merge_sections): New virtual
5019         function.
5020         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5021         virtual function.
5022         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5023         virtual function.
5024         * icf.cc (get_section_contents): Inline merge sections only when
5025         target allows it.
5026
5027 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5028
5029         * configure: Regenerate.
5030
5031 2010-09-17  Ian Lance Taylor  <iant@google.com>
5032
5033         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5034         * testsuite/Makefile.am (memory_test.o): New target.
5035         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5036         memory_test.t.
5037         * testsuite/Makefile.in: Rebuild.
5038
5039 2010-09-17  Doug Kwan  <dougkwan@google.com>
5040
5041         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5042         defintion if relocation uses GOT entries of the symbol.
5043         * testsuite/icf_safe_test.sh: Fix test.
5044         * testsuite/icf_safe_so_test.sh: Fix test.
5045
5046 2010-09-16  Cary Coutant  <ccoutant@google.com>
5047
5048         * script_sections.cc (class Memory_region): Remove "NULL" from
5049         vector initializations.
5050
5051 2010-09-15  Cary Coutant  <ccoutant@google.com>
5052
5053         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5054         Resolve forwarding symbols.
5055
5056 2010-09-15  Doug Kwan  <dougkwan@google.com>
5057
5058         * gold/testsuite/script_test_3.t: Add ARM special sections.
5059         * gold/testsuite/script_test_4.t: Same.
5060         * gold/testsuite/script_test_5.t: Same.
5061         * gold/testsuite/script_test_6.t: Same.
5062         * gold/testsuite/script_test_7.t: Same.
5063         * gold/testsuite/script_test_7.t: Same.
5064         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5065
5066 2010-09-14  Cary Coutant  <ccoutant@google.com>
5067
5068         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5069         (Target_x86_64::Relocate::relocate_tls): Replace check for
5070         saw_tls_block_reloc_ with test for executable section.
5071
5072 2010-09-12  Cary Coutant  <ccoutant@google.com>
5073
5074         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5075         position-independent executables to shared libraries need dynamic
5076         relocations.
5077         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5078         position-independent executables.
5079         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5080         * testsuite/Makefile.in: Regenerate.
5081
5082 2010-09-10  Nick Clifton  <nickc@redhat.com>
5083
5084         PR gold/11997
5085         * testsuite/memory_test.t: Discard any sections that are not
5086         needed.
5087
5088 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5089
5090         PR gold/11996
5091         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5092         "This::" to work around a bug in gcc 4.2.
5093
5094         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5095
5096 2010-09-09  Rafael Espindola  <espindola@google.com>
5097
5098         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5099         sections with different PF_X flags in the same segment.
5100         (Layout::find_first_load_seg): Search all segments to find the first
5101         one.
5102         * options.h (rosegment): New.
5103
5104 2010-09-08  Rafael Espindola  <espindola@google.com>
5105
5106         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5107
5108 2010-09-08  Doug Kwan  <dougkwan@google.com>
5109
5110         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5111         (Arm_relobj::do_relocate_sections): Add new parameter for output
5112         file to match the parent.
5113         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5114         of local symbols instead of input values.  Update code to track
5115         changes in gold::relocate_section.
5116         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5117         (Sized_relobj::compute_final_local_value_internal): New methods.
5118         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5119         body into private version of Sized_relobj::compute_final_local_value.
5120         Call the inline method.
5121         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5122         merged symbol value if there is one.
5123         (Symbol_value::has_output_value): New method defintiion.
5124         (Sized_relobj::Compute_final_local_value_status): New enum type.
5125         (Sized_relobj::compute_final_local_value): New methods.
5126         (Sized_relobj::compute_final_local_value_internal): New methods.
5127         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5128         and arm_cortex_a8.sh.
5129         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5130         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5131         New tests.
5132         * Makefile.in: Regenerate.
5133         * testsuite/arm_bl_out_of_range.s: Update test.
5134         * testsuite/thumb_bl_out_of_range.s: Ditto.
5135         * testsuite/thumb_blx_out_of_range.s: Ditto.
5136         * testsuite/arm_branch_out_of_range.sh: New file.
5137         * testsuite/arm_cortex_a8.sh: Ditto.
5138         * testsuite/arm_cortex_a8_b.s: Ditto.
5139         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5140         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5141         * testsuite/arm_cortex_a8_bl.s: Ditto.
5142         * testsuite/arm_cortex_a8_blx.s: Ditto.
5143         * testsuite/arm_cortex_a8_local.s: Ditto.
5144         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5145         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5146
5147 2010-09-08  Rafael Espindola  <espindola@google.com>
5148
5149         * Makefile.am (memory_test.stdout): Run readelf with -W.
5150         * Makefile.in: Regenerate.
5151         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5152         64 bit output.
5153
5154 2010-09-08  Rafael Espindola  <espindola@google.com>
5155
5156         * script-sections.cc (Script_sections::add_memory_region): Convert
5157         field precision to int.
5158         * script.cc (script_set_section_region, script_set_section_region):
5159         Convert field precision to int.
5160
5161 2010-09-08  Rafael Espindola  <espindola@google.com>
5162
5163         * arm.cc (do_finalize_sections): Create the __exidx_start and
5164         __exdix_end symbols even when the section is missing.
5165
5166 2010-09-08  Nick Clifton  <nickc@redhat.com>
5167
5168         * README: Remove claim that MEMORY is not supported.
5169         * expression.cc (script_exp_function_origin)
5170         (script_exp_function_length): Move from here to ...
5171         * script.cc: ... here.
5172         (script_set_section_region, script_add_memory)
5173         (script_parse_memory_attr, script_include_directive): New
5174         functions.
5175         * script-sections.cc
5176         (class Memory_region): New class.
5177         (class Output_section_definition): Add set_memory_region,
5178         set_section_vma, set_section_lma and get_section_name methods.
5179         (class Script_Sections): Add add_memory_region,
5180         find_memory_region, find_memory_region_origin,
5181         find_memory_region_length and set_memory_region methods.
5182         Have set_section_addresses method walk the list of set memory
5183         regions.
5184         Extend the print methos to display memory regions.
5185         * script-sections.h: Add prototypes for new methods.
5186         Add enum for MEMORY region attributes.
5187         * yyscript.y: Add support for parsing MEMORY regions.
5188         * script-c.h: Add prototypes for new functions.
5189         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5190         * testsuite/Makefile.in: Regenerate.
5191         * testsuite/memory_test.sh: New script.
5192         * testsuite/memory_test.s: New assembler source file.
5193         * testsuite/memory_test.t: New linker script.
5194
5195 2010-08-27  Doug Kwan  <dougkwan@google.com>
5196
5197         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5198         reference override an existing dynamic weak reference.
5199         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5200         * testsuite/Makefile.in: Regenerate.
5201         * testsuite/dyn_weak_ref.sh: New file.
5202         * testsuite/dyn_weak_ref_1.c: Ditto.
5203         * testsuite/dyn_weak_ref_2.c: Ditto.
5204
5205 2010-08-27  Ian Lance Taylor  <iant@google.com>
5206
5207         * incremental.h (class Incremental_input_entry): Add virtual
5208         destructor.
5209
5210 2010-08-27  Ian Lance Taylor  <iant@google.com>
5211
5212         * testsuite/start_lib_test_3.c: Mark t3 as used.
5213
5214 2010-08-27  Nick Clifton  <nickc@redhat.com>
5215
5216         * options.cc (version_script): Fix small typo in previous
5217         whitespace tidyup.
5218
5219 2010-08-25  Nick Clifton  <nickc@redhat.com>
5220
5221         * archive.cc: Formatting fixes: Remove whitespace between
5222         typename and following asterisk.  Remove whitespace between
5223         function name and opening parenthesis.
5224         * archive.h: Likewise.
5225         * arm.cc: Likewise.
5226         * attributes.cc: Likewise.
5227         * attributes.h: Likewise.
5228         * common.cc: Likewise.
5229         * copy-relocs.cc: Likewise.
5230         * dirsearch.h: Likewise.
5231         * dynobj.cc: Likewise.
5232         * ehframe.cc: Likewise.
5233         * ehframe.h: Likewise.
5234         * expression.cc: Likewise.
5235         * fileread.cc: Likewise.
5236         * fileread.h: Likewise.
5237         * gc.h: Likewise.
5238         * gold-threads.cc: Likewise.
5239         * gold.cc: Likewise.
5240         * i386.cc: Likewise.
5241         * icf.h: Likewise.
5242         * incremental-dump.cc: Likewise.
5243         * incremental.cc: Likewise.
5244         * layout.cc: Likewise.
5245         * layout.h: Likewise.
5246         * main.cc: Likewise.
5247         * merge.cc: Likewise.
5248         * merge.h: Likewise.
5249         * object.cc: Likewise.
5250         * object.h: Likewise.
5251         * options.cc: Likewise.
5252         * options.h: Likewise.
5253         * output.cc: Likewise.
5254         * output.h: Likewise.
5255         * plugin.cc: Likewise.
5256         * plugin.h: Likewise.
5257         * powerpc.cc: Likewise.
5258         * reloc.cc: Likewise.
5259         * script-c.h: Likewise.
5260         * script-sections.cc: Likewise.
5261         * script.cc: Likewise.
5262         * stringpool.cc: Likewise.
5263         * symtab.cc: Likewise.
5264         * symtab.h: Likewise.
5265         * target.cc: Likewise.
5266         * timer.cc: Likewise.
5267         * timer.h: Likewise.
5268         * version.cc: Likewise.
5269         * x86_64.cc: Likewise.
5270
5271 2010-08-24  Nick Clifton  <nickc@redhat.com>
5272
5273         PR 11899
5274         * layout.cc (segment_precedes): Sort segments by their physical
5275         addresses, if they have been set.
5276
5277 2010-08-23  Cary Coutant  <ccoutant@google.com>
5278
5279         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5280         symbols data.
5281         (Lib_group::include_member): Unlock object after deleting its
5282         symbols data.
5283         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5284         the bug fixed here.
5285
5286 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5287             Cary Coutant  <ccoutant@google.com>
5288
5289         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5290         constructor, and set_blocker.
5291         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5292         readsyms_blocker_.
5293         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5294         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5295         * testsuite/Makefile.am (start_lib_test): New test case.
5296         * testsuite/Makefile.in: Regenerate.
5297         * testsuite/start_lib_test_main.c: New file.
5298         * testsuite/start_lib_test_1.c: New file.
5299         * testsuite/start_lib_test_2.c: New file.
5300         * testsuite/start_lib_test_3.c: New file.
5301
5302 2010-08-19  Ian Lance Taylor  <iant@google.com>
5303
5304         * Makefile.in: Rebuild with automake 1.11.1.
5305         * aclocal.m4: Likewise.
5306         * testsuite/Makefile.in: Likewise.
5307
5308 2010-08-19  Ian Lance Taylor  <iant@google.com>
5309
5310         PR 10893
5311         * i386.cc (class Output_data_plt_i386): Update declarations.
5312         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5313         local_ifuncs_ fields.
5314         (Target_i386::do_plt_section_for_global): New function.
5315         (Target_i386::do_plt_section_for_local): New function.
5316         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5317         parameter; change all callers.  Initialize global_ifuncs_ and
5318         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5319         __rel_iplt_end.
5320         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5321         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5322         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5323         symbols.
5324         (Target_i386::make_plt_section): New function, broken out of
5325         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5326         (Target_i386::make_plt_entry): Call make_plt_section.
5327         (Target_i386::make_local_ifunc_plt_entry): New function.
5328         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5329         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5330         R_386_IRELATIVE to switch.
5331         (Target_i386::Scan::global): Likewise.
5332         (Target_i386::Relocate::relocate): Likewise.
5333         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5334         switch.
5335         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5336         (Target_x86_64::do_plt_section_for_global): New function.
5337         (Target_x86_64::do_plt_section_for_local): New function.
5338         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5339         parameter; change all callers.  If doing a static link define
5340         __rela_iplt_start and __rela_iplt_end.
5341         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5342         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5343         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5344         to point to .plt.
5345         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5346         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5347         switch.
5348         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5349         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5350         R_X86_64_IRELATIVE to switch.
5351         (Target_x86_64::Scan::global): Likewise.
5352         (Target_x86_64::Relocate::relocate): Likewise.
5353         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5354         switch.
5355         * target.h (class Target): Add plt_section_for_global and
5356         plt_section_for_local functions.  Add do_plt_section_for_global
5357         and do_plt_section_for_local virtual functions.
5358         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5359         clarifying comments.
5360         (Symbol::use_plt_offset): Handle IFUNC symbol.
5361         * object.cc (Sized_relobj::Sized_relobj): Initialize
5362         local_plt_offsets_.
5363         (Sized_relobj::local_has_plt_offset): New function.
5364         (Sized_relobj::local_plt_offset): New function.
5365         (Sized_relobj::set_local_plt_offset): New function.
5366         (Sized_relobj::do_count): Handle IFUNC symbol.
5367         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5368         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5369         is_ifunc_symbol functions.
5370         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5371         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5372         local_plt_offsets_ field.
5373         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5374         * output.h (class Output_section_data): Add non-const
5375         output_section function.
5376         (class Output_data_got): Update declarations.
5377         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5378         Add use_plt_offset parameter to global and local constructors.
5379         Change all callers.  Change local_sym_index_ field to 31 bits.
5380         Change GSYM_CODE and CONSTANT_CODE accordingly.
5381         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5382         doing a static link don't set sh_link field.
5383         (Output_data_got::Got_entry::write): Use PLT offset if
5384         appropriate.
5385         (Output_data_got::add_global_plt): New function.
5386         (Output_data_got::add_local_plt): New function.
5387         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5388         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5389         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5390         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5391         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5392         IFUNC conditional.
5393         * testsuite/ifunc-sel.h: New file.
5394         * testsuite/ifuncmain1.c: New file.
5395         * testsuite/ifuncmain1vis.c: New file.
5396         * testsuite/ifuncmod1.c: New file.
5397         * testsuite/ifuncdep2.c: New file.
5398         * testsuite/ifuncmain2.c: New file.
5399         * testsuite/ifuncmain3.c: New file.
5400         * testsuite/ifuncmod3.c: New file.
5401         * testsuite/ifuncmain4.c: New file.
5402         * testsuite/ifuncmain5.c: New file.
5403         * testsuite/ifuncmod5.c: New file.
5404         * testsuite/ifuncmain6pie.c: New file.
5405         * testsuite/ifuncmod6.c: New file.
5406         * testsuite/ifuncmain7.c: New file.
5407         * configure, testsuite/Makefile.in: Rebuild.
5408
5409 2010-08-18  Ian Lance Taylor  <iant@google.com>
5410
5411         * incremental.cc
5412         (Output_section_incremental_inputs::write_input_files): Add cast
5413         to avoid signed/unsigned comparison warning.
5414         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5415
5416 2010-08-12  Cary Coutant  <ccoutant@google.com>
5417
5418         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5419
5420 2010-08-13  Ian Lance Taylor  <iant@google.com>
5421
5422         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5423
5424 2010-08-12  Cary Coutant  <ccoutant@google.com>
5425             Doug Kwan  <dougkwan@google.com>
5426
5427         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5428         defintion overrides non-weak undef, remember that the original undef
5429         is not weak.
5430         * symtab.cc (Symbol_table::sized_write_global): For undef without
5431         an original weak binding, set binding to global in output.
5432         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5433         * testsuite/Makefile.in: Regenerate.
5434         * testsuite/strong_ref_weak_def.sh: New file.
5435         * testsuite/strong_ref_weak_def_1.c: Ditto.
5436         * testsuite/strong_ref_weak_def_2.c: Ditto.
5437
5438 2010-08-12  Cary Coutant  <ccoutant@google.com>
5439
5440         * testsuite/incremental_test.sh: Rewrite.
5441         * testsuite/incremental_test_1.c: Rewrite.
5442         * testsuite/incremental_test_2.c: Rewrite.
5443
5444 2010-08-12  Cary Coutant  <ccoutant@google.com>
5445
5446         * arm.cc (Target_arm::got_size): Add const.
5447         (Target_arm::got_entry_count): New function.
5448         (Target_arm::plt_entry_count): New function.
5449         (Target_arm::first_plt_entry_offset): New function.
5450         (Target_arm::plt_entry_size): New function.
5451         (Output_data_plt_arm::entry_count): New function.
5452         (Output_data_plt_arm::first_plt_entry_offset): New function.
5453         (Output_data_plt_arm::get_plt_entry_size): New function.
5454         * i386.cc (Target_i386::got_size): Add const.
5455         (Target_i386::got_entry_count): New function.
5456         (Target_i386::plt_entry_count): New function.
5457         (Target_i386::first_plt_entry_offset): New function.
5458         (Target_i386::plt_entry_size): New function.
5459         (Output_data_plt_i386::entry_count): New function.
5460         (Output_data_plt_i386::first_plt_entry_offset): New function.
5461         (Output_data_plt_i386::get_plt_entry_size): New function.
5462         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5463         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5464         * incremental.cc: Include target.h.
5465         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5466         parameter.  Adjust all callers.  Find incremental_got_plt section.
5467         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5468         section.
5469         (Output_section_incremental_inputs::set_final_data_size): Calculate
5470         size of incremental_got_plt section.
5471         (Output_section_incremental_inputs::do_write): Write the
5472         incremental_got_plt section.
5473         (Got_plt_view_info): New struct.
5474         (Local_got_offset_visitor): New class.
5475         (Global_got_offset_visitor): New class.
5476         (Global_symbol_visitor_got_plt): New class.
5477         (Output_section_incremental_inputs::write_got_plt): New function.
5478         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5479         Add parameter.  Adjust all callers.
5480         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5481         (Incremental_inputs::got_plt_section): New function.
5482         (Incremental_inputs::got_plt_section_): New data member.
5483         (Incremental_got_plt_reader): New class.
5484         * layout.cc (Layout::create_incremental_info_sections): Add the
5485         incremental_got_plt section.
5486         * object.h (Got_offset_list::get_list): New function.
5487         (Got offset_list::for_all_got_offsets): New function.
5488         (Sized_relobj::local_got_offset_list): New function.
5489         * powerpc.cc (Target_powerpc::got_size): Add const.
5490         (Target_powerpc::got_entry_count): New function.
5491         (Target_powerpc::plt_entry_count): New function.
5492         (Target_powerpc::first_plt_entry_offset): New function.
5493         (Target_powerpc::plt_entry_size): New function.
5494         (Output_data_plt_powerpc::entry_count): New function.
5495         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5496         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5497         * sparc.cc (Target_sparc::got_size): Add const.
5498         (Target_sparc::got_entry_count): New function.
5499         (Target_sparc::plt_entry_count): New function.
5500         (Target_sparc::first_plt_entry_offset): New function.
5501         (Target_sparc::plt_entry_size): New function.
5502         (Output_data_plt_sparc::entry_count): New function.
5503         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5504         (Output_data_plt_sparc::get_plt_entry_size): New function.
5505         * symtab.h (Symbol::got_offset_list): New function.
5506         (Symbol_table::for_all_symbols): New function.
5507         * target.h (Sized_target::got_entry_count): New function.
5508         (Sized_target::plt_entry_count): New function.
5509         (Sized_target::plt_entry_size): New function.
5510         * x86_64.cc (Target_x86_64::got_size): Add const.
5511         (Target_x86_64::got_entry_count): New function.
5512         (Target_x86_64::plt_entry_count): New function.
5513         (Target_x86_64::first_plt_entry_offset): New function.
5514         (Target_x86_64::plt_entry_size): New function.
5515         (Output_data_plt_x86_64::entry_count): New function.
5516         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5517         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5518
5519 2010-08-12  Cary Coutant  <ccoutant@google.com>
5520
5521         * archive.cc: Include incremental.h.
5522         (Archive::Archive): Initialize incremental_info_.
5523         (Archive::include_member): Record archive members in incremental info.
5524         (Add_archive_symbols::run): Record begin and end of an archive in
5525         incremental info.
5526         (Lib_group::include_member): Record objects in incremental info.
5527         * archive.h (Incremental_archive_entry): Forward declaration.
5528         (Archive::set_incremental_info): New member function.
5529         (Archive::incremental_info): New member function.
5530         (Archive::Unused_symbol_iterator): New class.
5531         (Archive::unused_symbols_begin): New member function.
5532         (Archive::unused_symbols_end): New member function.
5533         (Archive::incremental_info_): New data member.
5534         * incremental-dump.cc (find_input_containing_global): New function.
5535         (dump_incremental_inputs): Dump new incremental info sections.
5536         * incremental.cc: Include symtab.h.
5537         (Output_section_incremental_inputs): New class.
5538         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5539         new incremental info sections.
5540         (Sized_incremental_binary::do_check_inputs): Likewise.
5541         (Incremental_inputs::report_archive): Remove.
5542         (Incremental_inputs::report_archive_begin): New function.
5543         (Incremental_inputs::report_archive_end): New function.
5544         (Incremental_inputs::report_object): New function.
5545         (Incremental_inputs::finalize_inputs): Remove.
5546         (Incremental_inputs::report_input_section): New function.
5547         (Incremental_inputs::report_script): Rewrite.
5548         (Incremental_inputs::finalize): Do nothing but finalize string table.
5549         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5550         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5551         (Incremental_inputs::create_data_sections): New function.
5552         (Incremental_inputs::relocs_entsize): New function.
5553         (Output_section_incremental_inputs::set_final_data_size): New function.
5554         (Output_section_incremental_inputs::do_write): New function.
5555         (Output_section_incremental_inputs::write_header): New function.
5556         (Output_section_incremental_inputs::write_input_files): New function.
5557         (Output_section_incremental_inputs::write_info_blocks): New function.
5558         (Output_section_incremental_inputs::write_symtab): New function.
5559         * incremental.h (Incremental_script_entry): Forward declaration.
5560         (Incremental_object_entry): Forward declaration.
5561         (Incremental_archive_entry): Forward declaration.
5562         (Incremental_inputs): Forward declaration.
5563         (Incremental_inputs_header_data): Remove.
5564         (Incremental_inputs_header): Remove.
5565         (Incremental_inputs_header_write): Remove.
5566         (Incremental_inputs_entry_data): Remove.
5567         (Incremental_inputs_entry): Remove.
5568         (Incremental_inputs_entry_write): Remove.
5569         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5570         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5571         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5572         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5573         Likewise.
5574         (Incremental_input_entry): New class.
5575         (Incremental_script_entry): New class.
5576         (Incremental_object_entry): New class.
5577         (Incremental_archive_entry): New class.
5578         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5579         (Incremental_inputs::report_inputs): Remove.
5580         (Incremental_inputs::report_archive): Remove.
5581         (Incremental_inputs::report_archive_begin): New function.
5582         (Incremental_inputs::report_archive_end): New function.
5583         (Incremental_inputs::report_object): Change prototype.
5584         (Incremental_inputs::report_input_section): New function.
5585         (Incremental_inputs::report_script): Change prototype.
5586         (Incremental_inputs::get_reloc_count): New function.
5587         (Incremental_inputs::set_reloc_count): New function.
5588         (Incremental_inputs::create_data_sections): New function.
5589         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5590         (Incremental_inputs::inputs_section): New function.
5591         (Incremental_inputs::symtab_section): New function.
5592         (Incremental_inputs::relocs_section): New function.
5593         (Incremental_inputs::get_stringpool): Add const.
5594         (Incremental_inputs::command_line): Add const.
5595         (Incremental_inputs::inputs): Remove.
5596         (Incremental_inputs::command_line_key): New function.
5597         (Incremental_inputs::input_file_count): New function.
5598         (Incremental_inputs::input_files): New function.
5599         (Incremental_inputs::relocs_entsize): New function.
5600         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5601         (Incremental_inputs::finalize_inputs): Remove.
5602         (Incremental_inputs::Input_info): Remove.
5603         (Incremental_inputs::lock_): Remove.
5604         (Incremental_inputs::inputs_): Change type.
5605         (Incremental_inputs::inputs_map_): Remove.
5606         (Incremental_inputs::current_object_entry_): New data member.
5607         (Incremental_inputs::inputs_section_): New data member.
5608         (Incremental_inputs::symtab_section_): New data member.
5609         (Incremental_inputs::relocs_section_): New data member.
5610         (Incremental_inputs::reloc_count_): New data member.
5611         (Incremental_inputs_reader): New class.
5612         (Incremental_symtab_reader): New class.
5613         (Incremental_relocs_reader): New class.
5614         * layout.cc (Layout::finalize): Move finalization of incremental info
5615         and creation of incremental info sections to follow finalization of
5616         symbol table.  Set offsets for postprocessing sections.
5617         (Layout::create_incremental_info_sections): Call
5618         Incremental_inputs::create_data_sections.  Add incremental symtab
5619         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5620         sections to layout after input sections.
5621         * layout.h (struct Timespec): Forward declaration.
5622         (Layout::incremental_inputs): Add const.
5623         (Layout::create_incremental_info_sections): Add parameter.
5624         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5625         * object.cc: Include incremental.h.
5626         (Relobj::finalize_incremental_relocs): New function.
5627         (Sized_relobj::do_layout): Record input sections in incremental info.
5628         * object.h (Object::output_section): New function.
5629         (Object::output_section_offset): Moved from Relobj.
5630         (Object::get_incremental_reloc_base): New function.
5631         (Object::get_incremental_reloc_count): New function.
5632         (Object::do_output_section): New function.
5633         (Object::do_output_section_offset): Moved from Relobj.
5634         (Object::do_get_incremental_reloc_base): New function.
5635         (Object::do_get_incremental_reloc_count): New function.
5636         (Object::Object): Initialize new data members.
5637         (Relobj::output_section): Renamed do_output_section and moved to
5638         protected.
5639         (Relobj::output_section_offset): Moved to Object.
5640         (Relobj::do_get_incremental_reloc_base): New function.
5641         (Relobj::do_get_incremental_reloc_count): New function.
5642         (Relobj::allocate_incremental_reloc_counts): New function.
5643         (Relobj::count_incremental_reloc): New function.
5644         (Relobj::finalize_incremental_relocs): New function.
5645         (Relobj::next_incremental_reloc_index): New function.
5646         (Relobj::reloc_counts_): New data member.
5647         (Relobj::reloc_bases_): New data member.
5648         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5649         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5650         (Sized_relobj::incremental_relocs_scan): New function.
5651         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5652         (Sized_relobj::incremental_relocs_write): New function.
5653         (Sized_relobj::incremental_relocs_write_reltype): New function.
5654         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5655         incremental link.
5656         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5657         archives and object files elsewhere.
5658         (Add_symbols::run): Report object files here.
5659         (Finish_group::run): Report end of archive at end of group.
5660         * reloc.cc: Include layout.h, incremental.h.
5661         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5662         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5663         (Sized_relobj::incremental_relocs_scan): New function.
5664         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5665         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5666         (Sized_relobj::incremental_relocs_write): New function.
5667         (Sized_relobj::incremental_relocs_write_reltype): New function.
5668         * script.cc (read_input_script): Rewrite test for incremental link.
5669         Change call to Incremental_inputs::report_script.
5670         * symtab.h (Symbol_table::first_global_index): New function.
5671         (Symbol_table::output_count): New function.
5672
5673 2010-08-12  Doug Kwan  <dougkwan@google.com>
5674
5675         * arm.cc (Target_arm::merge_object_attributes): Check command line
5676         options --no-wchar-size-warning and --no-enum-size-warning.
5677         * options.h (General_options): Add ld-compatible options
5678         --no-enum-size-warning and --no-wchar-size-warning.
5679
5680 2010-08-04  Ian Lance Taylor  <iant@google.com>
5681
5682         * x86_64.cc (Target_x86_64::Scan::local): Use
5683         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5684         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5685         (Target_x86_64::Scan::global): Likewise.
5686         (Target_x86_64::Relocate::relocate): Likewise.
5687         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5688         Likewise.
5689
5690 2010-08-03  Cary Coutant  <ccoutant@google.com>
5691
5692         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5693         to reserve space in merged_strings vector. Keep total input size
5694         for stats.
5695         (Output_merge_string::do_print_merge_stats): Print total input size.
5696         * merge.h (Output_merge_string): Add input_size_ field.
5697         * stringpool.cc (Stringpool_template::string_length): Move
5698         implementations out of Stringpool_template class and place in
5699         stringpool.h.
5700         * stringpool.h (string_length): Move out of Stringpool_template.
5701
5702 2010-08-03  Ian Lance Taylor  <iant@google.com>
5703
5704         PR 11712
5705         * layout.cc (relaxation_loop_body): If address of load segment is
5706         set, adjust address to include headers if possible.
5707
5708 2010-08-03  Ian Lance Taylor  <iant@google.com>
5709
5710         * version.cc (version_string): Bump to 1.10.
5711
5712 2010-08-03  Ian Lance Taylor  <iant@google.com>
5713
5714         PR 11805
5715         * layout.h (enum Output_section_order): Define.
5716         (class Layout): Update declarations.
5717         * layout.cc (Layout::get_output_section): Add order parameter.
5718         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5719         is_first_non_relro parameters.  Change all callers.
5720         (Layout::choose_output_section): Likewise.
5721         (Layout::add_output_section_data): Likewise.
5722         (Layout::make_output_section): Likewise.  Set order.
5723         (Layout::default_section_order): New function.
5724         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5725         * output.cc (Output_section::Output_section): Initialize order_.
5726         Don't initialize deleted fields.
5727         (Output_segment::Output_segment): Don't initialize deleted
5728         fields.
5729         (Output_segment::add_output_section_to_load): New function
5730         replacing add_output_section.  Change all callers to call this or
5731         add_output_section_to_nonload.
5732         (Output_segment::add_output_section_to_nonload): New function.
5733         (Output_segment::remove_output_section): Rewrite.
5734         (Output_segment::add_initial_output_data): Likewise.
5735         (Output_segment::has_any_data_sections): Likewise.
5736         (Output_segment::is_first_section_relro): Likewise.
5737         (Output_segment::maximum_alignment): Likewise.
5738         (Output_segment::has_dynamic_reloc): New function replacing
5739         dynamic_reloc_count.  Change all callers.
5740         (Output_segment::has_dynamic_reloc_list): New function replacing
5741         dynamic_reloc_count_list.  Change all callers.
5742         (Output_segment::set_section_addresses): Rewrite.
5743         (Output_segment::set_offset): Rewrite.
5744         (Output_segment::find_first_and_last_list): Remove.
5745         (Output_segment::set_tls_offsets): Rewrite.
5746         (Output_segment::first_section_load_address): Likewise.
5747         (Output_segment::output_section_count): Likewise.
5748         (Output_segment::section_with_lowest_load_address): Likewise.
5749         (Output_segment::write_section_headers): Likewise.
5750         (Output_segment::print_sections_to_map): Likewise.
5751         * output.h (class Output_data): Remove dynamic_reloc_count_
5752         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5753         (Output_data::add_dynamic_reloc): Rewrite.
5754         (Output_data::has_dynamic_reloc): New function.
5755         (Output_data::dynamic_reloc_count): Remove.
5756         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5757         is_last_relro_, is_first_non_relro_, is_interp_,
5758         is_dynamic_linker_section_ fields.  Add order and set_order
5759         functions.  Remove is_relro_local, set_is_relro_local,
5760         is_last_relro, set_is_last_relro, is_first_non_relro,
5761         set_is_first_non_relro functions, is_interp, set_is_interp,
5762         is_dynamic_linker_section, and set_is_dynamic_linker_section
5763         functions.
5764         (class Output_segment): Change Output_data_list from std::list to
5765         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5766         output_bss_ fields.  Update declarations.
5767
5768 2010-08-02  Ian Lance Taylor  <iant@google.com>
5769
5770         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5771         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5772         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5773
5774 2010-08-02  Ian Lance Taylor  <iant@google.com>
5775
5776         PR 11855
5777         * script.cc (Script_options::Script_options): Initialize
5778         symbol_definitions_ and symbol_references_.
5779         (Script_options::add_symbol_assignment): Update
5780         symbol_definitions_ and symbol_references_.
5781         (Script_options::add_symbol_reference): New function.
5782         (script_symbol): New function.
5783         * script.h (class Script_options): Add symbol_definitions_ and
5784         symbol_references_ fields.
5785         (Script_options::referenced_const_iterator): New type.
5786         (Script_options::referenced_begin): New function.
5787         (Script_options::referenced_end): New function.
5788         (Script_options::is_referenced): New function.
5789         (Script_options::any_unreferenced): New function.
5790         * script-c.h (script_symbol): Declare.
5791         * yyscript.y (exp): Call script_symbol.
5792         * symtab.cc: Include "script.h".
5793         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5794         Change all callers.  Check symbols referenced by scripts.
5795         (Symbol_table::add_undefined_symbols_from_command_line): Add
5796         layout parameter.  Change all callers.
5797         (Symbol_table::do_add_undefined_symbols_from_command_line):
5798         Likewise.  Break out loop body.  Check symbols referenced by
5799         scripts.
5800         (Symbol_table::add_undefined_symbol_from_command_line): New
5801         function broken out of
5802         do_add_undefined_symbols_from_command_line.
5803         * symtab.h (class Symbol_table): Update declarations.
5804         * archive.cc: Include "layout.h".
5805         (Archive::should_include_member): Add layout parameter.  Change
5806         all callers.  Check for symbol mentioned in expression.
5807         * archive.h (class Archive): Update declaration.
5808         * object.cc (Sized_relobj::do_should_include_member): Add layout
5809         parameter.
5810         * object.h (Object::should_include_member): Add layout parameter.
5811         Change all callers.
5812         (Object::do_should_include_member): Add layout parameter.
5813         (class Sized_relobj): Update declaration.
5814         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5815         parameter.
5816         * dynobj.h (class Sized_dynobj): Update declaration.
5817         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5818         layout parameter.
5819         * plugin.h (class Sized_pluginobj): Update declaration.
5820
5821 2010-08-02  Ian Lance Taylor  <iant@google.com>
5822
5823         PR 11866
5824         * output.cc (Output_segment::set_offset): Search for the first and
5825         last sections rather than assuming that the list is in order.
5826         (Output_segment::find_first_and_last_list): New function.
5827         * output.h (class Output_segment): Update declarations.
5828         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5829         (relro_strip_test_SOURCES): New variable.
5830         (relro_strip_test_DEPENDENCIES): New variable.
5831         (relro_strip_test_LDFLAGS): New variable.
5832         (relro_strip_test_LDADD): New variable.
5833         (relro_strip_test.so): New target.
5834
5835 2010-08-02  Ian Lance Taylor  <iant@google.com>
5836
5837         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5838         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5839         (Target_i386::got_tlsdesc_section): New function.
5840         (Target_i386::got_section): Create space for GOT entries for
5841         TLSDESC relocations.
5842         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5843         R_386_TLS_GOTDESC.
5844         (Target_i386::Scan::global): Likewise.
5845         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5846         using TLSDESC GOT.
5847         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5848         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5849         (Target_x86_64::got_tlsdesc_section): New function.
5850         (Target_x86_64::got_section): Create space for GOT entries for
5851         TLSDESC relocations.
5852         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5853         R_386_TLS_GOTDESC.
5854         (Target_x86_64::Scan::global): Likewise.
5855         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5856         using TLSDESC GOT.
5857
5858 2010-08-02  Ian Lance Taylor  <iant@google.com>
5859
5860         * testsuite/final_layout.sh: Use dc to convert from hex to
5861         decimal.
5862
5863 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5864
5865         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5866         paramter to the call to gold::gc_process_relocs.
5867         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5868         paramter to the call to gold::gc_process_relocs.
5869         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5870         parameter to the call to gold::gc_process_relocs.
5871         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5872         template parameter to the call to gold::gc_process_relocs.
5873         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5874         paramter to the call to gold::gc_process_relocs.
5875         * gc.h (get_embedded_addend_size): New function.
5876         (gc_process_relocs): Save the size of the reloc for use by ICF.
5877         * icf.cc (get_section_contents): Get the addend from the text section
5878         for SHT_REL relocation sections.
5879         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5880         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5881         * int_encoding.h (read_from_pointer): New overloaded function.
5882         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5883         * testsuite/icf_sht_rel_addend_test.sh: New file.
5884         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5885         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5886
5887 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5888
5889         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5890         * Makefile.in: Regenerate.
5891         * testsuite/Makefile.in: Regenerate.
5892
5893 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5894
5895         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5896         * gold/testsuite/debug_msg.cc: Likewise.
5897         * gold/testsuite/odr_violation1.cc
5898         * gold/testsuite/odr_violation2.cc
5899
5900 2010-07-21  Cary Coutant  <ccoutant@google.com>
5901
5902         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5903         string, and length fields.
5904         (Output_merge_string::Merged_strings_list): New type.
5905         (Output_merge_string::Merged_strings_lists): New typedef.
5906         (Output_merge_string): Replace merged_strings_ with
5907         merged_strings_lists_.
5908         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5909         Merged_strings_list per input object and section.  Don't store pointer
5910         to the string.  Don't store length with each merged string entry.
5911         (Output_merge_string::finalize_merged_data): Loop over list of merged
5912         strings lists.  Recompute length of each merged string.
5913
5914 2010-07-15  Cary Coutant  <ccoutant@google.com>
5915
5916         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5917         here.
5918
5919 2010-07-14  Ian Lance Taylor  <iant@google.com>
5920
5921         * descriptors.cc (Descriptors::open): Report correct name in error
5922         message.
5923
5924 2010-07-13  Doug Kwan  <dougkwan@google.com>
5925
5926         * arm.cc (Arm_input_section::Arm_input_section): For a
5927         SHT_ARM_EXIDX section, always keeps the input sections.
5928         (Arm_input_section::set_exidx_section_link): New method.
5929         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5930         has_errors_ to false.
5931         (Arm_exidx_input_section::has_errors,
5932         Arm_exidx_input_section::set_has_errors): New methods.
5933         (Arm_exidx_input_section::has_errors_): New data member.
5934         (Arm_relobj::get_exidx_shndx_list): New method.
5935         (Arm_output_section::append_text_sections_to_list): Do not skip
5936         section without SHF_EXECINSTR.
5937         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5938         errors.
5939         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5940         section header.  Make error messages more verbose.  Check for
5941         a non-executable section linked to an EXIDX section.
5942         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5943         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5944         check that there is no deferred EXIDX section if we exit early.
5945         Instead of not making an EXIDX section in case of an error, make one
5946         and set the has_errors flag of it.
5947         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5948         in a relocatable link.
5949         (Target_arm::do_relax): Look for the EXIDX output section instead of
5950         assuming that it is called .ARM.exidx.
5951         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5952         section list.  Do not check for SHF_EXECINSTR section flags but
5953         skip any input section with errors.
5954         * output.cc (Output_section::Output_section): Initialize
5955         always_keeps_input_sections_ to false.
5956         (Output_section::add_input_section): Check for
5957         always_keeps_input_sections_.
5958         *  output.h (Output_section::always_keeps_input_sections,
5959         Output_section::set_always_keeps_input_sections): New methods.
5960         (Output_section::always_keeps_input_sections): New data member.
5961
5962 2010-07-13  Rafael Espindola  <espindola@google.com>
5963
5964         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5965         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5966
5967 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5968             Ian Lance Taylor  <iant@google.com>
5969
5970         * output.h (Output_section_lookup_maps::add_merge_section):
5971         Correct check of whether value was inserted.
5972         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5973         (Output_section_lookup_maps::add_relaxed_input_section):
5974         Likewise.
5975         * arm.cc (Target_arm::got_section): Remove used local os.
5976         * i386.cc (Target_i386::got_section): Likewise.
5977         * x86_64.cc (Target_x86_64::got_section): Likewise.
5978         * sparc.cc (Target_sparc::got_section): Likewise.
5979         (Target_sparc::relocate): Remove unused local have_got_offset.
5980         * powerpc.cc (Target_powerpc::relocate): Likewise.
5981
5982 2010-07-13  Ian Lance Taylor  <iant@google.com>
5983
5984         * compressed_output.cc (zlib_decompress): Fix signature in
5985         !HAVE_ZLIB_H case.
5986
5987         * archive.cc (Archive::include_member): Unlock an external member
5988         of a thin archive.  Don't bother to delete an object we know is
5989         NULL.
5990
5991 2010-07-12  Cary Coutant  <ccoutant@google.com>
5992
5993         * compressed_output.cc (zlib_decompress): New function.
5994         (get_uncompressed_size): New function.
5995         (decompress_input_section): New function.
5996         * compressed_output.h (get_uncompressed_size): New function.
5997         (decompress_input_section): New function.
5998         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
5999         Handle compressed debug sections.
6000         * layout.cc (is_compressed_debug_section): New function.
6001         (Layout::output_section_name): Map compressed section names to
6002         canonical names.
6003         * layout.h (is_compressed_debug_section): New function.
6004         (is_debug_info_section): Recognize compressed debug sections.
6005         * merge.cc: Include compressed_output.h.
6006         (Output_merge_data::do_add_input_section): Handle compressed
6007         debug sections.
6008         (Output_merge_string::do_add_input_section): Handle compressed
6009         debug sections.
6010         * object.cc: Include compressed_output.h.
6011         (Sized_relobj::Sized_relobj): Initialize new data members.
6012         (build_compressed_section_map): New function.
6013         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6014         * object.h (Object::section_is_compressed): New method.
6015         (Object::do_section_is_compressed): New method.
6016         (Sized_relobj::Compressed_section_map): New type.
6017         (Sized_relobj::do_section_is_compressed): New method.
6018         (Sized_relobj::compressed_sections_): New data member.
6019         * output.cc (Output_section::add_input_section): Handle compressed
6020         debug sections.
6021         * reloc.cc: Include compressed_output.h.
6022         (Sized_relobj::write_sections): Handle compressed debug sections.
6023
6024 2010-07-08  Cary Coutant  <ccoutant@google.com>
6025
6026         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6027         weak when resolving to a dynamic def.
6028         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6029         for weak undef/dynamic def cases. Adjust callers.
6030         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6031         undef_binding_weak_.
6032         (Symbol_table::sized_write_globals): Adjust symbol binding.
6033         (Symbol_table::sized_write_symbol): Add binding parameter.
6034         * symtab.h (Symbol::set_undef_binding): New method.
6035         (Symbol::is_undef_binding_weak): New method.
6036         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6037         (Symbol_table::should_override): Add new parameter.
6038         (Symbol_table::sized_write_symbol): Add new parameter.
6039
6040         * testsuite/weak_undef_file1.cc: Add new test case.
6041         * testsuite/weak_undef_file2.cc: Fix header comment.
6042         * testsuite/weak_undef_test.cc: Add new test case.
6043
6044 2010-06-29  Doug Kwan  <dougkwan@google.com>
6045
6046         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6047         Initialize USE_SYMBOL_.
6048         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6049         definition.
6050         (Arm_reloc_property::uses_symbol_): New data member declaration.
6051         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6052         uses symbol value and symbol is undefined but not weakly undefined.
6053
6054 2010-06-28  Rafael Espindola  <espindola@google.com>
6055
6056         * plugin.cc (Plugin::load): Use dlerror.
6057
6058 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6059
6060         * symtab.cc (detect_odr_violations): When reporting an ODR
6061         violation, report an object where the symbol is defined.
6062
6063 2010-06-25  Doug Kwan  <dougkwan@google.com>
6064
6065         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6066         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6067         definition.
6068         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6069         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6070         target hook to detect function points.
6071         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6072         * icf.h (Icf::check_section_for_function_pointers): Change type of
6073         parameter SECTION_NAME to const reference to std::string.  Use
6074         target hook to determine if section may have unsafe pointers.
6075         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6076         method definition.
6077
6078 2010-06-21  Rafael Espindola  <espindola@google.com>
6079
6080         * fileread.cc (Input_file::find_fie): New
6081         (Input_file::open): Use Input_file::find_fie.
6082         * fileread.h (Input_file::find_fie): New
6083         * plugin.cc (set_extra_library_path): New.
6084         (Plugin::load): Add set_extra_library_path to the transfer vector.
6085         (Plugin_manager::set_extra_library_path): New.
6086         (Plugin_manager::add_input_file): Use the extra search path if set.
6087         (set_extra_library_path(): New.
6088         * plugin.h (Plugin_manager): Add set_extra_library_path and
6089         extra_search_path_.
6090
6091 2010-06-19  Cary Coutant  <ccoutant@google.com>
6092
6093         * layout.cc (gdb_sections): Add .debug_types.
6094         (lines_only_debug_sections): Likewise.
6095
6096 2010-06-18  Rafael Espindola  <espindola@google.com>
6097
6098         * plugin.cc (add_input_file,add_input_library)
6099         (Plugin_manager::add_input_file): Make filename arguments const.
6100         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6101         const.
6102
6103 2010-06-16  Doug Kwan  <dougkwan@google.com>
6104
6105         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6106         .ARM.attributes section if we have not merged any input
6107         attributes sections.
6108
6109 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6110
6111         * arm.cc: Allow combining objects with no EABI version
6112         information.
6113
6114 2010-06-15  Rafael Espindola  <espindola@google.com>
6115
6116         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6117
6118 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6119
6120         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6121         (struct iovec): Correct !HAVE_READV definition.
6122
6123 2010-06-10  Cary Coutant  <ccoutant@google.com>
6124
6125         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6126         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6127         reloc sections.
6128         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6129
6130         PR 11683
6131         * symtab.h (Symbol::is_placeholder): New member function.
6132         * target-reloc.h (relocate_section): Check for placeholder symbols.
6133
6134         * testsuite/Makefile.am (plugin_test_8): New test.
6135         (plugin_test_9): New test.
6136         * testsuite/Makefile.in: Regenerate.
6137
6138 2010-06-09  Nick Clifton  <nickc@redhat.com>
6139
6140         * yyscript.y (input_list_element): Allow strings prefixed with
6141         the '-' character.  Treat these as libraries.
6142         * script.cc (script_add_library): New function.  Adds a library
6143         specified by "-l<name>" found in an input script.
6144         * script-c.h: Add prototype for script_add_library.
6145
6146 2010-06-07  Doug Kwan  <dougkwan@google.com>
6147
6148         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6149         Restrict stub-group size to be within long conditional branch
6150         range when working around cortex-A8 erratum.
6151
6152 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6153
6154         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6155         #ifdef typo.
6156
6157 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6158
6159         PR gold/11658
6160         * output.cc
6161         (Output_section::Input_section_sort_entry::compare_section_ordering):
6162         Change to return non-zero correctly.
6163         (Output_section::Input_section_sort_section_order_index_compare
6164         ::operator()): Change to fix ambiguity in comparisons.
6165
6166 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6167
6168         * gold.h (is_wildcard_string): New function.
6169         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6170         (Layout::layout_eh_frame): Ditto.
6171         (Layout::find_section_order_index): New method.
6172         (Layout::read_layout_from_file): New method.
6173         * layout.h (Layout::find_section_order_index): New method.
6174         (Layout::read_layout_from_file): New method.
6175         (Layout::input_section_position_): New private member.
6176         (Layout::input_section_glob_): New private member.
6177         * main.cc (main): Call read_layout_from_file here.
6178         * options.h (--section-ordering-file): New option.
6179         * output.cc (Output_section::input_section_order_specified_): New
6180         member.
6181         (Output_section::Output_section): Initialize new member.
6182         (Output_section::add_input_section): Add new parameter.
6183         Keep input sections when --section-ordering-file is used.
6184         (Output_section::set_final_data_size): Sort input sections when
6185         section ordering file is specified.
6186         (Output_section::Input_section_sort_entry): Add new parameter.
6187         Check sorting type.
6188         (Output_section::Input_section_sort_entry::compare_section_ordering):
6189         New method.
6190         (Output_section::Input_section_sort_compare::operator()): Change to
6191         consider section_order_index.
6192         (Output_section::Input_section_sort_init_fini_compare::operator()):
6193         Change to consider section_order_index.
6194         (Output_section::Input_section_sort_section_order_index_compare
6195         ::operator()): New method.
6196         (Output_section::sort_attached_input_sections): Change to sort
6197         according to section order when specified.
6198         (Output_section::add_input_section<32, true>): Add new parameter.
6199         (Output_section::add_input_section<64, true>): Add new parameter.
6200         (Output_section::add_input_section<32, false>): Add new parameter.
6201         (Output_section::add_input_section<64, false>): Add new parameter.
6202         * output.h (Output_section::add_input_section): Add new parameter.
6203         (Output_section::input_section_order_specified): New
6204         method.
6205         (Output_section::set_input_section_order_specified): New method.
6206         (Input_section::Input_section): Initialize section_order_index_.
6207         (Input_section::section_order_index): New method.
6208         (Input_section::set_section_order_index): New method.
6209         (Input_section::section_order_index_): New member.
6210         (Input_section::Input_section_sort_section_order_index_compare): New
6211         struct.
6212         (Output_section::input_section_order_specified_): New member.
6213         * script-sections.cc (is_wildcard_string): Delete and move modified
6214         method to gold.h.
6215         (Output_section_element_input::Output_section_element_input): Modify
6216         call to is_wildcard_string.
6217         (Output_section_element_input::Input_section_pattern
6218         ::Input_section_pattern): Ditto.
6219         (Output_section_element_input::Output_section_element_input): Ditto.
6220         * testsuite/Makefile.am (final_layout): New test case.
6221         * testsuite/Makefile.in: Regenerate.
6222         * testsuite/final_layout.cc: New file.
6223         * testsuite/final_layout.sh: New file.
6224
6225 2010-06-01  Rafael Espindola  <espindola@google.com>
6226
6227         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6228
6229 2010-06-01  Rafael Espindola  <espindola@google.com>
6230
6231         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6232         visibility of symbols.
6233
6234 2010-05-27  Doug Kwan  <dougkwan@google.com>
6235
6236         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6237         from start of output section instead of address for a local symbol
6238         in a merged or relaxed section when doing a relocatable link.
6239
6240 2010-05-26  Rafael Espindola  <espindola@google.com>
6241
6242         PR 11604
6243         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6244         adding sections the garbage collector removed.
6245         * gold/testsuite/Makefile.am: Add test.
6246         * gold/testsuite/Makefile.in: Regenerate.
6247         * gold/testsuite/plugin_test_7.sh: New.
6248         * gold/testsuite/plugin_test_7_1.c: New.
6249         * gold/testsuite/plugin_test_7_2.c: New.
6250
6251 2010-05-26  Rafael Espindola  <espindola@google.com>
6252
6253         * script-sections.cc (Output_section_definition::set_section_addresses):
6254         Check for --section-start.
6255
6256 2010-05-26  Doug Kwan  <dougkwan@google.com>
6257
6258         * arm.cc (Arm_scan_relocatable_relocs): New class.
6259         (Target_arm::relocate_special_relocatable): New method.
6260         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6261         (Arm_relocate_functions::thumb_branch_common): Same.
6262         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6263         instead of Default_scan_relocatable_relocs.
6264         * target-reloc.h (relocate_for_relocatable): Let target handle
6265         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6266         * target.h (Sized_target::relocate_special_relocatable): New method.
6267
6268 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6269
6270         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6271
6272 2010-05-23  Doug Kwan  <dougkwan@google.com>
6273
6274         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6275         instead of a cast.
6276         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6277         with a direct branch, not a conditional branch, to a stub.
6278         * merge.cc (Output_merge_base::record_input_section): New method
6279         defintion.
6280         (Output_merge_data::do_add_input_section): Record input section if
6281         keeps-input-sections flag is set.
6282         (Output_merge_string::do_add_input_section): Ditto.
6283         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6284         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6285         INPUT_SECTIONS_.
6286         (Output_merge_base::keeps_input_sections,
6287         Output_merge_base::set_keeps_input_sections,
6288         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6289         method definitions.
6290         (Output_merge_base::Input_sections): New type declaration.
6291         (Output_merge_base::input_sections_begin,
6292         Output_merge_base::input_sections_end,
6293         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6294         (Output_merge_base::bool keeps_input_sections_,
6295         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6296         Output_merge_base::input_sections_): New data members.
6297         (Output_merge_data::do_set_keeps_input_sections): New method
6298         defintion.
6299         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6300         * output.cc (Output_section::Input_section::relobj): Move method
6301         defintion from class declaration to here and handle merge sections.
6302         (Output_section::Input_section::shndx): Ditto.
6303         (Output_section::Output_section): Remove initializations of removed
6304         data members and initialize new data member LOOKUP_MAPS_.
6305         (Output_section::add_input_section): Set keeps-input-sections flag
6306         for a newly created merge output section as appropriate.  Adjust code
6307         to use Output_section_lookup_maps class.
6308         (Output_section::add_relaxed_input_section): Adjst code for lookup
6309         maps code refactoring.
6310         (Output_section::add_merge_input_section): Add a new parameter
6311         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6312         class.  If adding input section to a newly created merge output
6313         section fails, remove the new merge section.
6314         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6315         Adjust code for use of the Output_section_lookup_maps class.
6316         (Output_section::find_merge_section): Ditto.
6317         (Output_section::build_lookup_maps): New method defintion.
6318         (Output_section::find_relaxed_input_section): Adjust code to use
6319         Output_section_lookup_maps class.
6320         (Output_section::get_input_sections): Export merge sections.  Adjust
6321         code to use Output_section_lookup_maps class.
6322         (Output_section:::add_script_input_section): Adjust code to use
6323         Output_section_lookup_maps class.  Update lookup maps for merge
6324         sections also.
6325         (Output_section::discard_states): Use Output_section_lookup_maps.
6326         (Output_section::restore_states): Same.
6327         * output.h (Merge_section_properties): Move class defintion out of
6328         Output_section.
6329         (Output_section_lookup_maps): New class.
6330         (Output_section::Input_section::is_merge_section): New method
6331         defintion.
6332         (Output_section::Input_section::relobj): Move defintion out of class
6333         defintion.  Declare method only.
6334         (Output_section::Input_section::shndx): Ditto.
6335         (Output_section::Input_section::output_merge_base): New method defintion.
6336         (Output_section::Input_section::u2_.pomb): New union field.
6337         (Output_section::Merge_section_by_properties_map,
6338         Output_section::Output_section_data_by_input_section_map,
6339         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6340         Remove types.
6341         (Output_section::add_merge_input_section): Add new parameter
6342         KEEPS_INPUT_SECTIONS.
6343         (Output_section::build_lookup_maps): New method declaration.
6344         (Output_section::merge_section_map_,
6345         Output_section::merge_section_by_properties_map_,
6346         Output_section::relaxed_input_section_map_,
6347         Output_section::is_relaxed_input_section_map_valid_): Remove data
6348         members.
6349         (Output_section::lookup_maps_): New data member.
6350
6351 2010-05-21  Doug Kwan  <dougkwan@google.com>
6352
6353         PR gold/11619
6354         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6355         avoid a compilation error.
6356
6357 2010-05-19  Rafael Espindola  <espindola@google.com>
6358
6359         * script-sections.cc (Output_section_definition::allocate_to_segment):
6360         Update the phdrs_list even when the output section is NULL.
6361         * testsuite/Makefile.am: Add test.
6362         * testsuite/Makefile.in: Regenerate.
6363         * testsuite/script_test_9.cc: New.
6364         * testsuite/script_test_9.sh: New.
6365         * testsuite/script_test_9.t: New.
6366
6367 2010-05-19  Doug Kwan  <dougkwan@google.com>
6368
6369         * arm.cc (Arm_input_section::original_size): New method.
6370         (Arm_input_section::do_addralign): Add a cast.
6371         (Arm_input_section::do_output_offset): Remove static cast.
6372         (Arm_input_section::original_addralign,
6373          Arm_input_section::original_size_): Change type to uint32_t.
6374         (Arm_input_section::init): Add safe casts for section alignment
6375         and size.
6376         (Arm_input_section::set_final_data_size): Do not set address and
6377         offset of stub table.
6378         (Arm_output_section::fix_exidx_coverage): Change use of of
6379         Output_section::Simple_input_section to that of
6380         Output_section::Input_section.
6381         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6382         except for the first pass.
6383         * output.cc (Output_section::get_input_sections): Change type of
6384         input_sections to std::list<Input_section>.
6385         (Output_section::add_script_input_section): Rename from
6386         Output_section::add_simple_input_section.  Change type of SIS
6387         parameter from Simple_input_section to Input_section.
6388         * output.h (Output_section::Simple_input_section): Remove class.
6389         (Output_section::Input_section): Change class visibility to public.
6390         (Output_section::Input_section::addralign): Use stored alignments
6391         for special input sections if set.
6392         (Output_section::Input_section::set_addralign): New method.
6393         (Output_section::get_input_sections): Change parameter type from
6394         list of Simple_input_section to list of Input_section.
6395         (Output_section::add_script_input_section): Rename from
6396         Output_section::add_simple_input_section. Change first parameter's
6397         type from Simple_input_section to Input_section and remove the
6398         second and third parameters.
6399         * script-sections.cc (Input_section::Input_section_list): Change
6400         type to list of Output_section::Input_section/
6401         (Input_section_info::Input_section_info): Change parameter type of
6402         INPUT_SECTION to Output_section::Input_section.
6403         (Input_section_info::input_section): Change return type.
6404         (Input_section_info::input_section_): Change type to
6405         Output_section::Input_section.
6406         (Output_section_element_input::set_section_addresses): Adjust code
6407         to use Output_section::Input_section instead of
6408         Output_section::Simple_input_section.  Adjust code for renaming
6409         of Output_section::add_simple_input_section.
6410         (Orphan_output_section::set_section_addresses): Ditto.
6411
6412 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6413
6414         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6415         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6416
6417 2010-05-18  Rafael Espindola  <espindola@google.com>
6418
6419         * options.cc (General_options::finalize): Handle -nostdlib.
6420         * options.h (nostdlib): New option.
6421         * script.cc (script_add_search_dir): Handle -nostdlib.
6422
6423 2010-05-12  Doug Kwan  <dougkwan@google.com>
6424
6425         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6426         attributes section only if there no attributes section after merging.
6427         (Target_arm::merge_object_attributes): Move value of
6428         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6429         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6430         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6431         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6432         and arm_attr_merge_7.stdout.
6433         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6434         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6435         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6436         arm_attr_merge_7b.o): New rules.
6437         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6438         arm_attr_merge_7
6439         * testsuite/Makefile.in: Regenerate.
6440         * testsuite/arm_attr_merge.sh: New file.
6441         * testsuite/arm_attr_merge_[67][ab].s: Same.
6442
6443 2010-05-05  Nick Clifton  <nickc@redhat.com>
6444
6445         * po/es.po: Updated Spanish translation.
6446
6447 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6448
6449         * Makefile.am (install-exec-local): Properly install gold as
6450         default cross linker.
6451         * Makefile.in: Regenerated.
6452
6453 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6454             Nick Clifton  <nickc@redhat.com>
6455
6456         * configure.ac (install_as_default): Define and set to false
6457         unless --enable-gold or --enable-gold=both/gold has been
6458         specified.
6459         * configure: Regenerate.
6460
6461         * Makefile.am (install-exec-local): Install the executable as
6462         'ld.gold'.  If install_as_default is true then also install it as
6463         'ld'.
6464         * Makefile.in: Regenerated.
6465
6466 2010-04-24  Ian Lance Taylor  <iant@google.com>
6467
6468         * layout.cc (Layout::layout_reloc): In relocatable link don't
6469         combine reloc sections for grouped sections.
6470
6471 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6472
6473         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6474         sections that are not ordinary to icf.
6475         * icf.cc (get_section_contents): Handle relocation pointing to section
6476         with no object or shndx information.
6477         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6478         * testsuite/Makefile.in: Regenerate.
6479         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6480         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6481
6482 2010-04-22  Ian Lance Taylor  <iant@google.com>
6483
6484         * expression.cc (Expression::Expression_eval_info): Add
6485         result_alignment_pointer field.
6486         (Expression::eval_with_dot): Add result_alignment_pointer
6487         parameter.  Change all callers.
6488         (Expression::eval_maybe_dot): Likewise.
6489         (class Binary_expression): Add alignment_pointer parameter to
6490         left_value and right_value.  Change all callers.
6491         (BINARY_EXPRESSION): Set result alignment.
6492         (class Trinary_expression): Add alignment_pointer parameter to
6493         arg2_value and arg3_value.  Change all callers.
6494         (Trinary_cond::value): Set result alignment.
6495         (Max_expression::value, Min_expression::value): Likewise.
6496         (Align_expression::value): Likewise.
6497         * script-sections.cc (class Sections_element): Add dot_alignment
6498         parameter to set_section_addresses virtual function.  Update
6499         instantiations.
6500         (class Output_section_element): Likewise.
6501         (Script_sections::create_segments): Add dot_alignment parameter.
6502         Change all callers.
6503         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6504         (Script_sections::set_phdrs_clause_addresses): Likewise.
6505         * script-sections.h: Update declarations.
6506         * script.h: Update declarations.
6507         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6508         min_p_align.
6509         * testsuite/script_test_3.t: Set large alignment.
6510         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6511         segment has expected alignment.
6512
6513 2010-04-22  Nick Clifton  <nickc@redhat.com>
6514
6515         * po/gold.pot: Updated by the Translation project.
6516         * po/vi.po: Updated Vietnamese translation.
6517
6518 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6519
6520         * testsuite/Makefile.am (check_PROGRAMS): Add
6521         icf_virtual_function_folding_test.
6522         * testsuite/Makefile.in: Regenerated.
6523
6524 2010-04-15  Andrew Haley  <aph@redhat.com>
6525
6526         * options.h (merge_exidx_entries): New option.
6527         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6528         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6529         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6530         (Target_arm::merge_exidx_entries): New function.
6531         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6532         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6533         to Arm_exidx_fixup constructor.
6534         Add new arg, merge_exidx_entries.
6535         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6536         Arm_output_section::fix_exidx_coverage.
6537
6538 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6539
6540         * icf.cc (get_section_contents): Check for preemptible functions.
6541         Ignore addend when appropriate.
6542         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6543         section folded.
6544         (add_from_relobj): Check for section folded.
6545         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6546         * symtab.h (should_add_dynsym_entry): Add new parameter.
6547         * target-reloc.h (scan_relocs): Check for section folded.
6548         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6549         Check reloc types for function pointers in shared objects.
6550         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6551         case.
6552         (icf_preemptible_functions_test): New test case.
6553         (icf_string_merge_test): New test case.
6554         * testsuite.Makefile.in: Regenerate.
6555         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6556         bar_glob.  Refactor code.
6557         * testsuite/icf_preemptible_functions_test.cc: New file.
6558         * testsuite/icf_preemptible_functions_test.sh: New file.
6559         * testsuite/icf_string_merge_test.cc: New file.
6560         * testsuite/icf_string_merge_test.sh: New file.
6561         * testsuite/icf_virtual_function_folding_test.cc: New file.
6562         * testsuite/icf_virtual_function_folding_test.sh: New file.
6563
6564 2010-04-14  Doug Kwan  <dougkwan@google.com>
6565
6566         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6567         for local symbol recounting if we remove a section due to ICF.
6568         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6569         there are no regular objects in input.
6570
6571 2010-04-13  Doug Kwan  <dougkwan@google.com>
6572
6573         * arm.cc (Arm_input_section::set_final_data_size): Compute
6574         accurate final data size instead of using current data size.
6575
6576 2010-04-09  Doug Kwan  <dougkwan@google.com>
6577
6578         * layout.cc (Layout::choose_output_section): Handle script section
6579         types.
6580         (Layout::make_output_section_for_script): Add section type parameter.
6581         Handle script section types.
6582         * layout.h (Layout::make_output_section_for_script): Add section
6583         type parameter.
6584         * output.cc (Output_section::Output_section): Initialize data member
6585         is_noload_.
6586         (Output_section::do_reset_address_and_file_offset): Do not set address
6587         to 0 if section is a NOLOAD section.
6588         * output.h (Output_section::is_noload): New method.
6589         (Output_section::set_is_noload): Ditto.
6590         (Output_section::is_noload_): New data member.
6591         * script-c.h (Script_section_type): New enum type.
6592         (struct Parser_output_section_header): Add new file section_type.
6593         * script-sections.cc (Sections_element::output_section_name): Add
6594         parameter for returning script section type.
6595         (Output_section_definition::output_section_name): Ditto.
6596         (Output_section_definition::section_type)P; New method.
6597         (Output_section_definiton::script_section_type_name): Ditto.
6598         (Output_section_definition::script_section_type_): New data member.
6599         (Output_section_definition::Output_section_definition): Initialize
6600         data member Output_section_definition::script_section_type_.
6601         (Output_section_definition::create_sections): Pass script section type
6602         to Layout::make_output_section_for_script.
6603         (Output_section_definition::output_section_name): Return script
6604         section type to caller.
6605         (Output_section_definition::set_section_address): Do not advance
6606         dot value and load address if section type is NOLOAD.  Set address
6607         of NOLOAD sections regardless of section flags.
6608         (Output_section_definition::print): Print section type if it is
6609         not SCRIPT_SECTION_TYPE_NONE.
6610         (Output_section_definition::section_type): New method.
6611         (Output_section_definition::script_section_type_name): Ditto.
6612         (Script_sections::output_section_name): Add new parameter
6613         PSECTION_TYPE for returning script section type.  Pass it to
6614         section elements.  Handle discard sections.
6615         (Sort_output_sections::operator()): Handle NOLOAD sections.
6616         * script-sections.h (Script_sections::Section_type): New enum type.
6617         (Script_sections::output_section_name): Add a new parameter for
6618         returning script section type.
6619         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6620         INFO and NOLOAD.
6621         * yyscript.y (union): Add new field SECTION_TYPE.
6622         (COPY, DSECT, INFO, NOLOAD): New tokens.
6623         (opt_address_and_section_type): Change type to output_section_header.
6624         (section_type): New non-terminal
6625         (section_header): Handle section type.
6626         (opt_address_and_section_type): Return section type value.
6627
6628 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6629
6630         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6631         * testsuite/plugin_common_test_2.c (foo): Likewise.
6632
6633 2010-04-08  Doug Kwan  <dougkwan@google.com>
6634
6635         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6636         Output_merge_data.
6637         * output.cc (Output_section::add_merge_input_section): Simplify
6638         code and return status of Output_merge_base::add_input_section.
6639         Update merge section map only if Output_merge_base::add_input_section
6640         returns true.
6641
6642 2010-04-07  Doug Kwan  <dougkwan@google.com>
6643
6644         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6645         if section is marked as containing instructions but has no mapping
6646         symbols.
6647         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6648         correct section index.
6649         (Arm_relobj::find_linked_text_section): Ditto.
6650
6651 2010-04-07  Cary Coutant  <ccoutant@google.com>
6652
6653         * archive.cc (include_member): Destroy Read_symbols_data object before
6654         releasing file.
6655         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6656         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6657         (Read_symbols_data::~Read_symbols_data) New destructor.
6658         (Section_relocs::Section_relocs) New constructor.
6659         (Section_relocs::~Section_relocs) New destructor.
6660         (Read_relocs_data::Read_relocs_data) New constructor.
6661         (Read_relocs_data::~Read_relocs_data) New destructor.
6662         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6663         pointers to NULL after deleting.
6664
6665 2010-04-07  Doug Kwan  <dougkwan@google.com>
6666
6667         * arm.cc: Replace "endianity" with "endianness" in comments.
6668         (Arm_exidx_cantunwind): Ditto.
6669         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6670         (Arm_relobj::merge_flags_and_attributes): New method.
6671         (Arm_relobj::merge_flags_and_attributes_): New data member.
6672         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6673         (Arm_relobj::scan_sections_for_stubs): Ditto.
6674         (Arm_relobj::do_read_symbols): Check to see if we really want to
6675         merge processor-specific flags and attributes.  Exit early if
6676         an object is empty except for section names and the undefined symbol.
6677         (Target_arm::do_finalize_sections): Move check for ELF format to
6678         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6679         attributes from a regular object only when we have determined that
6680         it is aapropriate.  Do not create an .ARM.attributes section in
6681         output if there is no regular input object.
6682         (Target_arm::merge_processor_specific_flags): Check
6683         --warn-mismatch before printing any error.
6684         (Target_arm::merge_object_attributes): Ditto.
6685         * gold.cc (queue_middle_tasks): Handle the case in which there is
6686         no regular object in input.
6687         * options.cc (General_options::parse_EB): New method.
6688         (General_options::parse_EL): Same.
6689         (General_options::General_options): Initialize endianness_.
6690         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6691         New options.
6692         (General_options::Endianness): New enum.
6693         (General_options::endianness): New method.
6694         (General_options::endianness_): New data member.
6695         * parameters.cc (Parameters::set_options): Check target endianness.
6696         (Parameters::set_target_once): Ditto.
6697         (Parameters::check_target_endianness): New method.
6698         (parameters_force_valid_target): If either -EL or -EB is specified,
6699         use it to define endianness of default target.
6700         * parameters.h (Parameters::check_target_endianness): New method
6701         declaration.
6702         * target.h (class Target): Change "endianity" to "endianness"
6703         in comments.
6704
6705 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6706
6707         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6708         * configure: Regenerate.
6709         * Makefile.in: Regenerate.
6710         * testsuite/Makefile.in: Regenerate.
6711
6712 2010-04-06  Cary Coutant  <ccoutant@google.com>
6713
6714         gcc PR lto/42757
6715         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6716         prevailing definitions of common symbols.
6717         * testsuite/plugin_test_6.sh: New test case.
6718         * testsuite/plugin_common_test_1.c: New test case.
6719         * testsuite/plugin_common_test_2.c: New test case.
6720         * testsuite/Makefile.am (plugin_test_6): New test case.
6721         * testsuite/Makefile.in: Regenerate.
6722
6723 2010-04-06  Nick Clifton  <nickc@redhat.com>
6724
6725         * po/vi.po: New Vietnamese translation.
6726
6727 2010-03-30  Doug Kwan  <dougkwan@google.com>
6728
6729         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6730
6731 2010-03-25  Doug Kwan  <dougkwan@google.com>
6732
6733         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6734         to avoid a conversion warning on a 32-bit host.
6735
6736 2010-03-24  Ian Lance Taylor  <iant@google.com>
6737
6738         * testsuite/script_test_3.t: Add a TLS segment.
6739         * testsuite/Makefile.am (check_PROGRAMS): Add
6740         tls_phdrs_script_test.
6741         (tls_phdrs_script_test_SOURCES): Define.
6742         (tls_phdrs_script_test_DEPENDENCIES): Define.
6743         (tls_phdrs_script_test_LDFLAGS): Define.
6744         (tls_phdrs_script_test_LDADD): Define.
6745         * testsuite/Makefile.in: Rebuild.
6746
6747 2010-03-23  Cary Coutant  <ccoutant@google.com>
6748
6749         * fileread.cc (find_or_make_view): Fix comment.
6750
6751 2010-03-23  Ian Lance Taylor  <iant@google.com>
6752
6753         * script-sections.cc (class Orphan_section_placement): Define
6754         PLACE_TLS and PLACE_TLS_BSS.
6755         (Orphan_section_placement::Orphan_section_placement): Initialize
6756         new places.
6757         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6758         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6759         (tls_script_test_SOURCES): Define.
6760         (tls_script_test_DEPENDENCIES): Define.
6761         (tls_script_test_LDFLAGS): Define.
6762         (tls_script_test_LDADD): Define.
6763         * testsuite/Makefile.in: Rebuild.
6764
6765 2010-03-22  Doug Kwan  <dougkwan@google.com>
6766
6767         * arm.cc (Arm_relocate_functions::abs8,
6768         Arm_relocate_functions::abs16): Use correct check for overflow
6769         specified in the ARM ELF specs.
6770         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6771         target of a BLX instruction specially.
6772         (Reloc_stub::stub_type_for_reloc): Ditto.
6773         (Relocate::relocate): Use symbolic names instead of numeric relocation
6774         codes to report error.
6775         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6776         workaround.
6777         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6778         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6779         thumb2_blx_out_of_range.stdout
6780         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6781         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6782         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6783         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6784         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6785         thumb2_blx_in_range, thumb2_blx_in_range.o,
6786         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6787         thumb2_blx_out_of_range.o): New rules.
6788         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6789         thumb2_blx_in_range and thumb2_blx_out_of_range.
6790         * testsuite/Makefile.in: Regenerate.
6791         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6792         * testsuite/thumb_blx_in_range.s: New file.
6793         * testsuite/thumb_blx_out_of_range.s: New file.
6794
6795 2010-03-22  Rafael Espindola  <espindola@google.com>
6796
6797         * archive.cc (Should_include): Move to archive.h.
6798         (should_include_member): Make it a member of Archive.
6799         (Lib_group): New.
6800         (Add_lib_group_symbols): New.
6801         * archive.h: Include options.h.
6802         (Archive_member): Moved from Archive.
6803         (Should_include): Moved from archive.cc.
6804         (Lib_group): New.
6805         (Add_lib_group_symbols): New.
6806         * dynobj.cc (do_should_include_member): New.
6807         * dynobj.h (do_should_include_member): New.
6808         * gold.cc (queue_initial_tasks): Update call to queue.
6809         * main.cc (main): Print lib group stats.
6810         * object.cc (do_should_include_member): New.
6811         * object.h: Include archive.h.
6812         (Object::should_include_member): New.
6813         (Object::do_should_include_member): New.
6814         (Sized_relobj::do_should_include_member): New.
6815         * options.cc (General_options::parse_start_lib): New.
6816         (General_options::parse_end_lib): New.
6817         (Input_arguments::add_file): Handle lib groups.
6818         (Input_arguments::start_group): Check we are not in a lib.
6819         (Input_arguments::start_lib): New.
6820         (Input_arguments::end_lib): New.
6821         * options.h (General_options): Add start_lib and end_lib.
6822         (Input_argument::lib_): New.
6823         (Input_argument::lib): New.
6824         (Input_argument::is_lib): New.
6825         (Input_file_lib): New.
6826         (Input_arguments::in_lib_): New.
6827         (Input_arguments::in_lib): New.
6828         (Input_arguments::start_lib): New.
6829         (Input_arguments::end_lib_): New.
6830         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6831         in unused members as preempted.
6832         (Sized_pluginobj::do_should_include_member): New.
6833         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6834         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6835         return the blocker.
6836         (Read_symbols::do_whole_lib_group): New.
6837         (Read_symbols::do_lib_group): New.
6838         (Read_symbols::do_read_symbols): Handle lib groups.
6839         (Read_symbols::get_name): Handle lib groups.
6840         * readsyms.h (Read_symbols): Add an archive member pointer.
6841         (Read_symbols::do_whole_lib_group): New.
6842         (Read_symbols::do_lib_group): New.
6843         (Read_symbols::member_): New.
6844         * script.cc (read_input_script): Update call to queue_soon.
6845
6846 2010-03-19  Doug Kwan  <dougkwan@google.com>
6847
6848         * arm.cc (Stub_table::Stub_table): Initialize new data members
6849         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6850         (Stub_table::add_reloc_stub): Assign stub offset and update
6851         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6852         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6853         New data members.
6854         (Stub_table::update_data_size_and_addralign): Use
6855         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6856         instead of going over all reloc stubs.
6857         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6858         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6859         Stringpool_template::offset_ to size of Stringpool_char.
6860         (Stringpool_template::new_key_offset): Remove code to initialize
6861         Stringpool_template::offset_.
6862         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6863         Stringpool_template::offset_ to zero.
6864
6865 2010-03-15  Doug Kwan  <dougkwan@google.com>
6866
6867         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6868         offset_.
6869         (Stringpool_template::new_key_offset): New method.
6870         (Stringpool_template::add_string): Assign offsets when adding new
6871         strings.
6872         (Stringpool_template::set_string_offsets): Do not set string offsets
6873         when not optimizing.
6874         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6875         member size_.
6876         (Chunked_vector::clear): Clear size_.
6877         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6878         (Chunked_vector::size): Return size_.
6879         (Chunked_vector::push_back): Use size_ to find insert position.
6880         (Chunked_vector::size_): New data member.
6881         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6882         (Stringpool_template::new_key_offset): New method declaration.
6883         (Stringpool_template::offset_): New data member.
6884
6885 2010-03-15   Rafael Espindola  <espindola@google.com>
6886
6887         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6888         Add_symbols' constructor.
6889         * readsyms.h (Add_symbols): Remove the input_group member.
6890
6891 2010-03-10  Ian Lance Taylor  <iant@google.com>
6892
6893         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6894         target to ask whether a reference to a symbol requires a stack
6895         split.
6896         * target.h (Target::is_call_to_non_split): New function.
6897         (Target::do_is_call_to_non_split): Declare virtual function.
6898         * target.cc: Include "symtab.h".
6899         (Target::do_is_call_to_non_split): New function.
6900         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6901
6902 2010-03-10  Cary Coutant  <ccoutant@google.com>
6903
6904         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6905         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6906         (File_read::open[2]): Add whole_file_view_ to list of views.
6907         (File_read::make_view): Remove test of whole_file_view_.
6908         (File_read::find_or_make_view): Create whole_file_view_ if
6909         necessary.
6910         (File_read::clear_views): Replace bool parameter with enum;
6911         adjust all callers.  Don't delete views with permanent data;
6912         do delete cached views and views from archives if
6913         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6914         if clearing the corresponding view.
6915         * fileread.h (File_read::Clear_views_mode): New enum.
6916         (File_read::View::is_permanent_view): New method.
6917         (File_read::clear_views): Replace bool parameter
6918         with enum; adjust all callers.
6919         * options.h (General_options): Change keep_files_mapped option;
6920         add map_whole_files.
6921         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6922         releasing the file.
6923         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6924         the file.
6925
6926 2010-03-10  David S. Miller  <davem@davemloft.net>
6927
6928         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6929
6930 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6931
6932         * icf.cc (get_section_contents): Add '@' marker after processing the
6933         merge reloc.
6934
6935 2010-03-08  Doug Kwan  <dougkwan@google.com>
6936
6937         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6938         due to a conversion warning.
6939         (Arm_relobj::update_output_local_symbol_count): Check for local
6940         symbol with unset output index.
6941
6942 2010-03-05  Ian Lance Taylor  <iant@google.com>
6943
6944         * options.h (class General_options): Add --spare-dynamic-tags.
6945         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6946         --spare-dynamic-tags.
6947
6948 2010-03-05  Ian Lance Taylor  <iant@google.com>
6949
6950         * incremental.cc: Include "libiberty.h".
6951
6952 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6953
6954         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6955         function, is_info_ member.
6956         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6957         (Versions::Versions): Update caller.
6958         (Versions::define_base_version): Likewise.
6959         (Versions::add_def): Likewise.
6960
6961 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6962
6963         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6964         (Scan::possible_function_pointer_reloc): New function.
6965         (Scan::local_reloc_may_be_function_pointer): Change to call
6966         possible_function_pointer_reloc.
6967         (Scan::global_reloc_may_be_function_pointer): Ditto.
6968         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6969         relocations in ".data.rel.ro._ZTV" section.
6970         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6971         * testsuite/icf_safe_so_test.cc: Ditto.
6972         * testsuite/icf_safe_test.cc: Ditto.
6973         * testsuite/icf_safe_test.sh: Ditto.
6974
6975 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6976             Ian Lance Taylor  <iant@google.com>
6977
6978         * target-reloc.h (relocate_section): Check the symbol table index
6979         for -1U before setting the local symbol index.
6980         (scan_relocatable_relocs): If copying the relocation, record that
6981         the local symbol is required.
6982         * object.h (Symbol_value::is_output_symtab_index_set): New
6983         function.
6984         (Symbol_value::may_be_discarded_from_output_symtab): New
6985         function.
6986         (Symbol_value::has_output_symtab_entry): New function.
6987         (Symbol_value::needs_output_symtab_entry): Remove.
6988         (Symbol_value::output_symtab_index): Make sure the symbol index is
6989         set.
6990         (Symbol_value::set_output_symtab_index): Make sure the symbol
6991         index is not set.  Make sure the new index is valid.
6992         (Symbol_value::set_must_have_output_symtab_entry): New function.
6993         (Symbol_value::has_output_dynsym_entry): New function.
6994         (Symbol_value::set_output_dynsym_index): Make sure the new index
6995         is valid.
6996         (Sized_relobj::set_must_have_output_symtab_entry): New function.
6997         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
6998         local symbol if permitted.
6999         (Sized_relobj::do_finalize_local_symbols): Call
7000         is_output_symtab_index_set rather than needs_output_symtab_entry.
7001         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7002         rather than needs_output_symtab_entry.  Call
7003         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7004         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7005         is_output_symtab_index_set rather than needs_output_symtab_entry.
7006         * testsuite/discard_locals_relocatable_test.c: New file.
7007         * testsuite/discard_locals_test.sh: Test -r.
7008         * testsuite/Makefile.am (check_DATA): Add
7009         discard_locals_relocatable_test1.syms,
7010         discard_local_relocatable_test2.syms.
7011         (MOSTLYCLEANFILES): Likewise.  Also add
7012         discard_locals_relocatable_test1.lout and
7013         discard_locals_relocatable_test2.out.
7014         (discard_locals_relocatable_test1.syms): New target.
7015         (discard_locals_relocatable_test.o): New target.
7016         (discard_locals_relocatable_test1.out): New target.
7017         (discard_locals_relocatable_test2.syms): New target.
7018         (discard_locals_relocatable_test2.out): New target.
7019         (various): Add missing ../ld-new dependencies.
7020         * testsuite/Makefile.in: Rebuild.
7021
7022 2010-03-03  Nick Clifton  <nickc@redhat.com>
7023
7024         * po/fi.po: New Finnish translation.
7025
7026 2010-03-01  Doug Kwan  <dougkwan@google.com>
7027
7028         * layout.cc (Layout::Layout): Force section types of .init_array*,
7029         .preinit_array* and .fini_array* sections.
7030         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7031         Fix check of return value of std::string::find.().
7032         (Output_section::Input_section_sort_compare::operator()): Remove
7033         comment about .init_array.
7034         (Output_section::Input_section_sort_init_fini_compare::operator()):
7035         New method.
7036         (Output_section::sort_attached_input_sections): Handle .init_array
7037         and .fini_array specially.
7038         * output.h (Output_section::Inut_section_sort_compare): Update
7039         comment.
7040         (Output_section::Input_section_sort_init_fini_compare): New struct.
7041
7042 2010-02-26  Doug Kwan  <dougkwan@google.com>
7043
7044         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7045         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7046         * testsuite/debug_msg.sh: Avoid matching source line number for
7047         use of global variable undef_int.
7048
7049 2010-02-26  Doug Kwan  <dougkwan@google.com>
7050
7051         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7052         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7053         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7054         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7055         * options.cc (General_options::General_options): Initialize member
7056         fix_v4bx_.
7057         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7058         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7059         and rm_no_fix_v4bx.stdout
7060         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7061         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7062         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7063         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7064         and arm_no_fix_v4bx.
7065         * Makefile.in: Regenerate.
7066         * testsuite/arm_fix_v4bx.s: New file.
7067         * testsuite/arm_fix_v4bx.sh: Ditto.
7068
7069 2010-02-24  Doug Kwan  <dougkwan@google.com>
7070
7071         * arm.cc (Target_arm::got_section): Make the .got section the first
7072         non RELRO section in the data segment.
7073         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7074         suffixes of section names.
7075
7076 2010-02-24  Doug Kwan  <dougkwan@google.com>
7077
7078         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7079         flags and attributes merging if an input file is a binary file.
7080         * fileread.cc (Input_file::open): Record format of original file.
7081         * fileread.h (Input_file::Format): New enum type.
7082         (Input_file::Input_file): Initialize data member format_.
7083         (Input_file::format): New method definition.
7084         (Input_file::format_):: New data member.
7085
7086 2010-02-24  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Arm_output_data_got): New class.
7089         (ARM_TCB_SIZE): New constant
7090         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7091         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7092         If user uses a script with a SECTIONS clause, issue only a warning
7093         for a misplaced EXIDX input section.  Otherwise, issue an error.
7094         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7095         garbage collection.
7096         (Target_arm::got_mode_index_entry): Handle static linking.
7097         (Target_arm::Scan::local): Ditto.
7098         (Target_arm::Scan::global): Ditto.
7099         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7100         all incorrectly implemented relocations.
7101         (Target_arm::fix_exidx_coverage): Pass layout to
7102         Arm_output_section::fix_exidx_coverage.
7103         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7104         from ".ARM.exidx." and ".ARM.extab.".
7105
7106 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7107
7108         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7109         section if it does not already exist.
7110         * attributes.cc (Attributes_section_data::Attributes_section_data):
7111         Don't crash if size is zero.
7112
7113 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7114             Ian Lance Taylor  <iant@google.com>
7115
7116         * gold.cc (queue_middle_tasks): If no input files were opened,
7117         exit.
7118         * workqueue.h (Task_function::Task_function): Assert that there is
7119         a blocker.
7120
7121 2010-02-22  Doug Kwan  <dougkwan@google.com>
7122
7123         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7124         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7125         types to avoid warnings due to different uint64_t implementations
7126         on different hosts.
7127
7128 2010-02-21  Doug Kwan  <dougkwan@google.com>
7129
7130         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7131         handling of the maximum backward branch offset.
7132         (Arm_relocate_functions::thumb_branch_common): Ditto.
7133         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7134         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7135         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7136         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7137         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7138         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7139         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7140         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7141         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7142         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7143         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7144         thumb2_bl_out_of_range.o): New rules.
7145         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7146         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7147         thumb2_bl_out_of_range
7148         * testsuite/Makefile.in: Regenerate.
7149         * testsuite/arm_bl_in_range.s: New file.
7150         * testsuite/arm_bl_out_of_range.s: Ditto.
7151         * testsuite/arm_branch_in_range.sh: Ditto.
7152         * testsuite/arm_branch_range.t: Ditto.
7153         * testsuite/thumb2_branch_range.t: Ditto.
7154         * testsuite/thumb_bl_in_range.s: Ditto.
7155         * testsuite/thumb_bl_out_of_range.s: Ditto.
7156         * testsuite/thumb_branch_range.t: Ditto.
7157
7158 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7159
7160         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7161         Add reloc offset information.
7162         * icf.cc (get_section_contents): Change iterators to point to the new
7163         vectors. Add reloc offset information to the contents.
7164         * icf.h (Icf::Sections_reachable_info): New typedef.
7165         (Icf::Sections_reachable_list): New typedef.
7166         (Icf::Offset_info): New typedef.
7167         (Icf::Reloc_info): New struct typedef.
7168         (Icf::Reloc_info_list): New typedef.
7169         (Icf::symbol_reloc_list): Delete method.
7170         (Icf::addend_reloc_list): Delete method.
7171         (Icf::section_reloc_list): Delete method.
7172         (Icf::reloc_info_list): New method.
7173         (Icf::reloc_info_list_): New member.
7174
7175 2010-02-19  Doug Kwan  <dougkwan@google.com>
7176
7177         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7178         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7179         * arm.cc (Arm_relocation_functions): New forward declaration.
7180         (Target_arm::Target_arm): Initialize new data members
7181         got_mod_index_offset_ and tls_base_symbol_defined_.
7182         (Target_arm::Relocate::relocate_tls): New method.
7183         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7184          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7185         New methods.
7186         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7187         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7188         (Target_arm::got_mod_index_offset_,
7189         Target_arm::tls_base_symbol_defined_): New data members.
7190         (Target_arm::Scan::local, Target::Scan::global,
7191         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7192         relocations.
7193
7194 2010-02-18  Doug Kwan  <dougkwan@google.com>
7195
7196         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7197         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7198         text section as a parameter becuase some broken tools may not set
7199         the link in section header.
7200         (Target_arm::has_got_section): New method.
7201         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7202         without any mapping symbol as data only.  Remove warning.
7203         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7204         link in its section header, try to discover the link by inspecting the
7205         REL31 relocation at the beginning of the section.
7206         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7207         in error message.
7208         (Target_arm::Scan::global): Treat any reference to the symbol
7209         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7210
7211 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7212
7213         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7214         (Scan::global_reloc_may_be_function_pointer): New function.
7215         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7216         (Scan::global_reloc_may_be_function_pointer): New function.
7217         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7218         (Scan::global_reloc_may_be_function_pointer): New function.
7219         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7220         (Scan::global_reloc_may_be_function_pointer): New function.
7221         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7222         (Scan::global_reloc_may_be_function_pointer): New function.
7223         (Scan::possible_function_pointer_reloc): New function.
7224         (Target_x86_64::can_check_for_function_pointers): New function.
7225         * gc.h (gc_process_relocs): Scan relocation types to determine if
7226         function pointers were taken for targets that support it.
7227         * icf.cc (Icf::find_identical_sections): Include functions for
7228         folding in safe ICF whose pointer is not taken.
7229         * icf.h (Secn_fptr_taken_set): New typedef.
7230         (fptr_section_id_): New member.
7231         (section_has_function_pointers): New function.
7232         (set_section_has_function_pointers): New function.
7233         (check_section_for_function_pointers): New function.
7234         * options.h: Fix comment for safe ICF option.
7235         * target.h (can_check_for_function_pointers): New function.
7236         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7237         Modify icf_safe_test for X86-64.
7238         * testsuite/Makefile.in: Regenerate.
7239         * testsuite/icf_safe_so_test.cc: New file.
7240         * testsuite/icf_safe_so_test.sh: New file.
7241         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7242         (main): Change to take pointer to function kept_func_3.
7243         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7244         folding is done correctly for X86-64.
7245
7246 2010-02-12  David S. Miller  <davem@davemloft.net>
7247
7248         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7249         is_symbolless parameter.
7250         (Output_reloc<SHT_REL>::is_symbolless): New.
7251         (Output_reloc<SHT_REL>::is_symbolless_): New.
7252         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7253         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7254         (Output_reloc<SHT_RELA>::is_symbolless): New.
7255         (Output_data_reloc::add_global): Handle is_symbolless.
7256         (Output_data_reloc::add_global_relative): Likewise.
7257         (Output_data_reloc::add_local): Likewise.
7258         (Output_data_reloc::add_local_relative): Likewise.
7259         (Output_data_reloc::add_symbolless_global_addend): New.
7260         (Output_data_reloc::add_symbolless_local_addend): New.
7261         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7262         is_symbolless.
7263         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7264         instead of ->is_relative_
7265         (Output_reloc::write): Likewise.
7266         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7267         (Output_reloc::write_rel): Simplify.
7268
7269         * sparc.cc (Target_sparc::Scan::local): Use
7270         ->add_symbolless_local_addend as needed.
7271         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7272         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7273         based upon relocation offset.
7274
7275 2010-02-11  Doug Kwan  <dougkwan@google.com>
7276
7277         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7278         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7279         beginning of function.
7280         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7281         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7282         parameter is_32bit in calls to should_apply_static_reloc.
7283         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7284         (check_DATA): Add arm_abs_global.stdout.
7285         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7286         arm_abs_global.stdout): New rules.
7287         (MOSTLLYCLEANFILES): Add arm_abs_global
7288         * Makefile.in: Regenerate.
7289         * testsuite/arm_abs_global.s: New file.
7290         * testsuite/arm_abs_global.sh: Ditto.
7291         * testsuite/arm_abs_lib.s: Ditto.
7292
7293 2010-02-11  Ian Lance Taylor  <iant@google.com>
7294
7295         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7296         Read_relocs task.
7297         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7298         Allocate_commons_task first.
7299         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7300         task, rather than symtab_lock_.
7301         (Gc_process_relocs::~Gc_process_relocs): New function.
7302         (Gc_process_relocs::is_runnable): Check this_blocker_.
7303         (Gc_process_relocs::locks): Use next_blocker_ rather than
7304         blocker_.
7305         (Scan_relocs::~Scan_relocs): New function.
7306         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7307         symtab_lock_.
7308         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7309         next_blocker_.
7310         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7311         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7312         constructor accordingly.
7313         (class Gc_process_relocs): Likewise.
7314         (class Scan_relocs): Likewise.
7315         * common.h (class Allocate_commons_task): Remove symtab_lock_
7316         field, and corresponding constructor parameter.
7317         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7318         symtab_lock_.
7319         (Allocate_commons_task::locks): Likewise.
7320
7321 2010-02-11  Ian Lance Taylor  <iant@google.com>
7322
7323         * gold-threads.h (class Once): Define.
7324         (class Initialize_lock): Rewrite as child of Once.
7325         * gold-threads.cc (class Once_initialize): Define.
7326         (once_pointer_control): New static variable.
7327         (once_pointer, once_arg): New static variables.
7328         (c_run_once): New static function.
7329         (Once::Once, Once::run_once, Once::internal_run): New functions.
7330         (class Initialize_lock_once): Remove.
7331         (initialize_lock_control): Remove.
7332         (initialize_lock_pointer): Remove.
7333         (initialize_lock_once): Remove.
7334         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7335         (Initialize_lock::initialize): Rewrite.
7336         (Initialize_lock::do_run_once): New function.
7337         * archive.cc (Archive::interpret_header): Only clear name if it is
7338         not already empty.
7339         * fileread.cc: Include "gold-threads.h"
7340         (file_counts_lock): New static variable.
7341         (file_counts_initialize_lock): Likewise.
7342         (File_read::release): Only increment counts when using --stats.
7343         Use a lock around the increment.
7344         * parameters.cc (class Set_parameters_target_once): Define.
7345         (set_parameters_target_once): New static variable.
7346         (Parameters::Parameters): Move here from parameters.h.
7347         (Parameters::set_target): Rewrite.
7348         (Parameters::set_target_once): New function.
7349         (Parameters::clear_target): Move here and rewrite.
7350         * parameters.h (class Parameters): Update declarations.  Add
7351         set_parameters_target_once_ field.
7352         (Parameters::Parameters): Move to parameters.cc.
7353         (Parameters::clear_target): Likewise.
7354         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7355         task.
7356         (Start_group::~Start_group): New function.
7357         (Start_group::is_runnable): New function.
7358         (Start_group::locks, Start_group::run): New functions.
7359         (Finish_group::run): Change saw_undefined to size_t.
7360         * readsyms.h (class Start_group): Define.
7361         (class Finish_group): Change saw_undefined_ field to size_t.
7362         (Finish_group::Finish_group): Remove saw_undefined and
7363         this_blocker parameters.  Change all callers.
7364         (Finish_group::set_saw_undefined): New function.
7365         (Finish_group::set_blocker): New function.
7366         * symtab.h (class Symbol_table): Change saw_undefined to return
7367         size_t.  Change saw_undefined_ field to size_t.
7368         * target-select.cc (Set_target_once::do_run_once): New function.
7369         (Target_selector::Target_selector): Initialize set_target_once_
7370         field.  Don't initialize lock_ and initialize_lock_ fields.
7371         (Target_selector::instantiate_target): Rewrite.
7372         (Target_selector::set_target): New function.
7373         * target-select.h (class Set_target_once): Define.
7374         (class Target_selector): Update declarations.  Make
7375         Set_target_once a friend.  Remove lock_ and initialize_lock_
7376         fields.  Add set_target_once_ field.
7377
7378 2010-02-10  Ian Lance Taylor  <iant@google.com>
7379
7380         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7381         queueing any tasks.
7382         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7383         (queue_middle_tasks): Add all blockers before queueing any tasks.
7384         (queue_final_tasks): Likewise.
7385         * token.h (Task_token::add_blockers): New function.
7386         * object.h (Input_objects::number_of_relobjs): New function.
7387
7388 2010-02-10  Ian Lance Taylor  <iant@google.com>
7389
7390         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7391         shared, not if not position independent.
7392         * x86_64.cc (Relocate::relocate_tls): Likewise.
7393         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7394         (tls_pie_pic_test): New target.
7395         * testsuite/Makefile.in: Rebuild.
7396
7397         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7398         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7399         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7400         * testsuite/Makefile.in: Rebuild.
7401
7402 2010-02-09  David S. Miller  <davem@davemloft.net>
7403
7404         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7405         R_SPARC_RELATIVE using ->add_local_relative().
7406         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7407
7408         * output.h (Output_data_dynamic::add_section_size): New method
7409         that takes two Output_data objects.
7410         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7411         entry param.  Handle it in initializers.
7412         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7413         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7414         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7415         arg.
7416         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7417         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7418         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7419         for dynrel_includes_plt.
7420         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7421         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7422         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7423         before .rela.plt
7424         (Target_sparc::do_finalize_sections): Update to pass true for
7425         dynrel_includes_plt.
7426         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7427         output before .rela.plt
7428         (Target_powerpc::do_finalize_sections): Update to pass true for
7429         dynrel_includes_plt when 32-bit.
7430
7431 2010-02-08  Doug Kwan  <dougkwan@google.com>
7432
7433         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7434         method.
7435         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7436         Arm_relobj::scan_section_for_cortex_a8_stubs,
7437         Arm_relobj::do_relocation_section): Instead of calling
7438         Output_section::output_address, use faster
7439         Arm_relobj::simple_input_section_output_address.
7440
7441 2010-02-08  David S. Miller  <davem@davemloft.net>
7442
7443         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7444         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7445         relocation helper function.
7446
7447         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7448         just like R_SPARC_GOT{10,13,22}.
7449         (Target_sparc::Scan::local): Likewise.
7450         (Target_sparc::Relocate:relocate): Likewise.
7451
7452 2010-02-06  Ian Lance Taylor  <iant@google.com>
7453
7454         * configure.ac: Rewrite targetobjs duplicate removal code to use
7455         only shell constructs.
7456         * configure: Rebuild.
7457
7458 2010-02-05  Doug Kwan  <dougkwan@google.com>
7459
7460         PR 11247
7461         * arm.cc (Arm_relobj::section_is_scannable): New method.
7462         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7463         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7464
7465 2010-02-04  Doug Kwan  <dougkwan@google.com>
7466
7467         PR 11247
7468         * arm-reloc-property.cc (cstdio): Include.
7469         * configure.ac (targetobjs): Remove duplicates.
7470         * configure: Regenerate.
7471         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7472         big and little endian version for a given address size.
7473
7474 2010-02-03  Doug Kwan  <dougkwan@google.com>
7475
7476         * arm-reloc-property.cc
7477         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7478         definition.
7479         * arm-reloc-property.h
7480         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7481         New method definition.
7482         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7483         declaration.
7484         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7485         overflow to N.
7486         (GOT_PREL): Change implemented to Y.
7487         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7488         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7489         (Arm_relocate_functions::movw_abs_nc): Remove method.
7490         (Arm_relocate_functions::movt_abs): Ditto.
7491         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7492         (Arm_relocate_functions::thm_movt_abs): Ditto.
7493         (Arm_relocate_functions::movw_rel_nc): Ditto.
7494         (Arm_relocate_functions::movw_rel): Ditto.
7495         (Arm_relocate_functions::movt_rel): Ditto.
7496         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7497         (Arm_relocate_functions:thm_movw_rel): Ditto.
7498         (Arm_relocate_functions:thm_movt_rel): Ditto.
7499         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7500         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7501         New method definitions.
7502         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7503         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7504         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7505         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7506         (Target_arm::Relocate::relocate): Check for non-static or
7507         unimplemented relocation code and exit early.  Change calls to
7508         Target_arm::reloc_uses_thumb_bit and
7509         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7510         instead.  Refactor code to handle similar relocations to increase
7511         code sharing.  Remove check for unsupported relocation code in switch
7512         statement.
7513         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7514         relocation property table to find out size.  Change error message to
7515         print out the name of a relocation code instead of the numeric value.
7516         (Target_arm::scan_reloc_for_stub): Use relocation property table
7517         instead of calling Target_arm::reloc_uses_thumb_bit().
7518
7519 2010-02-02  Doug Kwan  <dougkwan@google.com>
7520
7521         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7522         types of relaxed input section.
7523
7524 2010-02-02  Doug Kwan  <dougkwan@google.com>
7525
7526         * Makefile.am (HFILES): Add arm-reloc-property.h.
7527         (DEFFILES): New.
7528         (TARGETSOURCES): Add arm-reloc-property.cc
7529         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7530         (libgold_a_SOURCES): $(DEFFILES)
7531         * Makefile.in: Regenerate.
7532         * arm-reloc-property.cc: New file.
7533         * arm-reloc-property.h: New file.
7534         * arm-reloc.def: New file.
7535         * arm.cc: Update comments.
7536         (arm-reloc-property.h): New included header.
7537         (arm_reloc_property_table): New global variable.
7538         (Target_arm::do_select_as_default_target): New method definition.
7539         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7540         arm-reloc-property to targ_extra_obj.
7541         * parameters.cc (set_parameters_target): Call
7542         Target::select_as_default_target().
7543         * target.h (Target::select_as_default_target): New method definition.
7544         (Target::do_select_as_default_target): Same.
7545
7546 2010-02-01  Doug Kwan  <dougkwan@google.com>
7547
7548         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7549         first_output_text_section_.
7550         (Arm_exidx_fixup::first_output_text_section): New method definition.
7551         (Arm_exidx_fixup::first_output_text_section_): New data member.
7552         (Arm_exidx_fixup::process_exidx_section): Record the first text
7553         output section seen.
7554         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7555         and entsize in output section header.
7556
7557 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7558
7559         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7560         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7561         (Arm_relocate_functions::thm_alu11): New Method.
7562         (Arm_relocate_functions::thm_pc8): New Method.
7563         (Arm_relocate_functions::thm_pc12): New Method.
7564         (Target_arm::Scan::local): Handle the relocations.
7565         (Target_arm::Scan::global): Likewise.
7566         (Target_arm::Relocate::relocate): Likewise.
7567         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7568
7569 2010-01-29  Doug Kwan  <dougkwan@google.com>
7570
7571         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7572         of relocation types as ld.
7573
7574 2010-01-29  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7577         to public.
7578         (Arm_relocate_functions::thumb_branch_common): Ditto.
7579         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7580         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7581         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7582         Arm_relocate_functions::jump24): Remove.
7583         (Target_arm::Relocate::relocate): Adjust code to call
7584         Arm_relocation_functions::arm_branch_common and
7585         Arm_relocation_functions::thumb_branch_common instead of their removed
7586         wrappers.  Merge switch-cases together to reduce source code size.
7587
7588 2010-01-29  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7591         output_local_symbol_count_needs_update_.
7592         (Arm_relobj::output_local_symbol_count_needs_update,
7593          Arm_relobj::set_output_local_symbol_count_needs_update,
7594          Arm_relobj::update_output_local_symbol_count): New methods.
7595         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7596         member.
7597         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7598         of pointed function as in a R_ARM_PREL31 relocation.
7599         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7600         for output local symbol count updating.
7601         (Target_arm::do_relax): Update output local symbol counts in objects
7602         if necessary.
7603         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7604
7605 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7606
7607         * arm.cc: Added support for the ARM relocations:
7608         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7609         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7610         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7611         movw_prel_nc).
7612         (Arm_relocate_functions::movw_rel): New method.
7613         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7614         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7615         thm_movw_prel_nc).
7616         (Arm_relocate_functions::thm_movw_rel): New method.
7617         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7618         thm_movt_prel).
7619         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7620         relocations.
7621         (Target_arm::Scan::global): Likewise.
7622         (Target_arm::Relocate::relocate): Likewise.
7623         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7624         Likewise.
7625
7626 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7627
7628         * arm.cc: Added support for ARM group relocations.
7629         (Target_arm::reloc_needs_sym_origin): New method.
7630         (Arm_relocate_functions::calc_grp_kn): New method.
7631         (Arm_relocate_functions::calc_grp_residual): New method.
7632         (Arm_relocate_functions::calc_grp_gn): New method.
7633         (Arm_relocate_functions::arm_grp_alu): New Method.
7634         (Arm_relocate_functions::arm_grp_ldr): New Method.
7635         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7636         (Arm_relocate_functions::arm_grp_ldc): New Method.
7637         (Target_arm::Scan::local): Handle the ARM group relocations.
7638         (Target_arm::Scan::global): Likewise.
7639         (Target_arm::Relocate::relocate): Likewise.
7640         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7641         Likewise.
7642
7643 2010-01-26  Doug Kwan  <dougkwan@google.com>
7644
7645         * arm.cc (set): Include.
7646         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7647         pointer type.
7648         (Arm_output_section::Text_section_list): New type.
7649         (Arm_output_section::append_text_sections_to_list): New method.
7650         (Arm_output_section::fix_exidx_coverage): Ditto.
7651         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7652         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7653         Relobj::set_section_offset() instead of
7654         Sized_relobj::invalidate_section_offset().
7655         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7656         parameter for section headers. Ignore relocation sections for
7657         unallocated sections and EXIDX sections.
7658         (Target_arm::fix_exidx_coverage): New method.
7659         (Target_arm::output_section_address_less_than): New type.
7660         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7661         linked text section instead of the EXIDX section.
7662         (Arm_output_section::create_stub_group): Add an assertion to check
7663         that this is not an EXIDX output section.
7664         (Arm_output_section::append_text_sections_to_list): New method.
7665         (Arm_output_section::fix_exidx_coverage): Ditto.
7666         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7667         Arm_relobj::section_needs_reloc_stub_scanning.
7668         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7669         first pass.
7670         (Target_arm::fix_exidx_coverage): New method.
7671         * object.h (Relobj::set_output_section): New method.
7672         (Sized_relobj::invalidate_section_offset): Remove method.
7673         (Sized_relobj::do_invalidate_section_offset): Remove method.
7674         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7675
7676 2010-01-25  Doug Kwan  <dougkwan@google.com>
7677
7678         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7679         Fix warning due to signed and unsigned comparison on a 32-bit host.
7680
7681 2010-01-22  Doug Kwan  <dougkwan@google.com>
7682
7683         * arm.cc (Target_arm::do_relax): Record an output section for section
7684         offset adjustment it contains any stub table that has changed.
7685         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7686         offsets in an output section if necessary.
7687         * output.cc (Output_section::Output_section): Initialize
7688         section_offsets_need_adjustments_.
7689         (Output_section::add_input_section_for_script): Renamed to
7690         Output_section::add_simple_input_section.
7691         (Output_section::save_states): Add a comment.
7692         (Output_section::discard_states): New method defintion.
7693         (Output_section::adjust_section_offsets): Same.
7694         * output.h (Output_section::add_input_section_for_script): Renamed to
7695         Output_section::add_simple_input_section.
7696         (Output_section::discard_states): New method declaration.
7697         (Output_section::adjust_section_offsets): Same.
7698         (Output_section::section_offsets_need_adjustment,
7699         Output_section::set_section_offsets_need_adjustment): New method
7700         definitions.
7701         (Output_section::section_offsets_need_adjustment_): New data member.
7702         * script-sections.cc
7703         (Output_section_element_input::set_section_address): Adjust code for
7704         renaming of Output_section::add_input_section_for_script.
7705         (Orphan_output_section::set_section_address): Same.
7706
7707 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7708
7709         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7710         Fix_v4bx enum values .
7711         * gold/options.h (General_options): New option definitions.
7712         (General_options::fix_v4bx): New method.
7713         (General_options::Fix_v4bx): New enum.
7714         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7715         (General_options::parse_fix_v4bx_interworking): New method.
7716
7717 2010-01-22  Doug Kwan  <dougkwan@google.com>
7718
7719         * arm.cc (Arm_exidx_fixup): New class.
7720
7721 2010-01-21  Doug Kwan  <dougkwan@google.com>
7722
7723         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7724         classes.
7725         (Arm_exidx_section_offset_map): New type.
7726
7727 2010-01-21  Doug Kwan  <dougkwan@google.com>
7728
7729         * arm.cc (Arm_exidx_input_section): New class.
7730         (Arm_relobj::exidx_input_section_by_link,
7731         Arm_relobj::exidx_input_section_by_shndx,
7732         Arm_relobj::make_exidx_input_section): New methods.
7733         (read_arm_attributes_section): Remove.
7734         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7735         information about them.
7736         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7737         to here.
7738
7739 2010-01-20  Doug Kwan  <dougkwan@google.com>
7740
7741         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7742         Input_section_specifier to Section_id.
7743         (Target_arm::new_arm_input_section: Adjust code for change of key
7744         type.
7745         (Target_arm::find_arm_input_section): Ditto.
7746         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7747         (Section_id): Remove.
7748         (Garbage_collection::Section_id_hash): Remove.
7749         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7750         (Section_id): Remove.
7751         (Icf::Section_id_hash): Remove.
7752         * object.h (Section_id, Const_section_id, Section_id_hash,
7753         Const_section_id_hash): New type definitions.
7754         * output.cc (Output_section::add_relaxed_input_section): Change to
7755         use Const_section_id instead of Input_section_specifier as key type.
7756         (Output_section::add_merge_input_section): Ditto.
7757         (Output_section::build_relaxation_map): Change to use Section_id
7758         instead of Input_section_specifier as key type.
7759         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7760         Ditto.
7761         (Output_section::convert_input_sections_to_relaxed_sections): Change
7762         to use Const_section_id instead of Input_section_specifier as key type.
7763         (Output_section::find_merge_section): Ditto.
7764         (Output_section::find_relaxed_input_section): Ditto.
7765         * output.h (Input_section_specifier): Remove class.
7766         (Output_section::Output_section_data_by_input_section_map): Change
7767         key type to Const_section_id.
7768         (Output_section::Output_relaxed_input_section_by_input_section_map):
7769         Ditto.
7770         (Output_section::Relaxation_map): Change key type to Section_id.
7771
7772 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7773
7774         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7775         (class Arm_v4bx_stub): New class.
7776         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7777         (Stub_factory::make_arm_v4bx_stub): New method.
7778         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7779         (Stub_table::empty): Handle v4bx stubs.
7780         (Stub_table::add_arm_v4bx_stub): New method.
7781         (Stub_table::find_arm_v4bx_stub): New method.
7782         (Arm_relocate_functions::v4bx): New method.
7783         (Target_arm::fix_v4bx): New method.
7784         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7785         (Stub_table::relocate_stubs): Likewise.
7786         (Stub_table::do_write): Likewise.
7787         (Stub_table::update_data_size_and_addralign): Likewise.
7788         (Stub_table::finalize_stubs):  Likewise.
7789         (Target_arm::Scan::local): Likewise.
7790         (Target_arm::Scan::global): Likewise.
7791         (Target_arm::do_finalize_sections): Likewise.
7792         (Target_arm::Relocate::relocate): Likewise.
7793         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7794         Likewise.
7795         (Target_arm::scan_reloc_for_stub): Likewise.
7796         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7797
7798 2010-01-19  Ian Lance Taylor  <iant@google.com>
7799
7800         * output.cc (Output_section_headers::do_sized_write): Write large
7801         segment count to sh_info field.
7802         (Output_file_header::do_sized_write): For large segment count,
7803         write PN_XNUM to e_phnum field.
7804
7805 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7806
7807         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7808         (Arm_relocate_functions::thm_jump8): New function.
7809         (Arm_relocate_functions::thm_jump11): New function.
7810         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7811         R_ARM_THM_JUMP11.
7812         (Target_arm::Scan::global): Likewise.
7813         (Target_arm::Relocate::relocate): Likewise.
7814         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7815         Likewise.
7816
7817 2010-01-14  Doug Kwan  <dougkwan@google.com>
7818
7819         * arm.cc (map, utility): Include headers.
7820         (Target_arm::apply_cortex_a8_workaround): New method.
7821         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7822         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7823         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7824         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7825         the --[no-]fix-cortex-a8 command line options.
7826         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7827         (Target_arm::relocate_stub): Use addend in instruction template.
7828         * options.h (DEFINE_bool): Set the user-set flag.
7829         (General_options): Add --[no-]-fix-cortex options.
7830         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7831         : Update fast look-up map after conversion.
7832
7833 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7834
7835         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7836         in the first pass of do_layout.
7837
7838 2010-01-13  Doug Kwan  <dougkwan@google.com>
7839
7840         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7841         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7842         apparent compiler problem of not folding static constant integral
7843         data members of elfcpp::Elf_sizes<32>.
7844
7845 2010-01-13  Doug Kwan  <dougkwan@google.com>
7846
7847         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7848         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7849         Arm_relobj::scan_section_for_cortex_a8_erratum,
7850         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7851         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7852         sections to scan for relocation stubs into a new method
7853         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7854         relocation and Cortex-A8 stub scanning.
7855         (Target_arm::do_relax): Force stubs to be after stubbed sections
7856         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7857         the beginning of a new relaxation pass.  Update a comment.
7858         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7859
7860 2010-01-12  Ian Lance Taylor  <iant@google.com>
7861
7862         * target-reloc.h (visibility_error): New inline function.
7863         (relocate_section): Call visibility_error.
7864         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7865         (MOSTLYCLEANFILES): Likewise.
7866         (protected_4_pic.o, protected_3.err): New targets.
7867         * testsuite/protected_4.cc: New file.
7868
7869 2010-01-12  Doug Kwan  <dougkwan@google.com>
7870
7871         * arm.cc (Cortex_a8_reloc): New class.
7872         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7873         and cortex_a8_relocs_info_.
7874         (Target_arm::fix_cortex_a8): New method definition.
7875         (Target_arm::Cortex_a8_relocs_info): New type.
7876         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7877         New data member declarations.
7878         (Target_arm::scan_reloc_for_stub): Record information about
7879         relocations for THUMB branches that might be exempted from the
7880         Cortex-A8 workaround.
7881         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7882         at the beginning of a relaxation pass.
7883
7884 2010-01-12  Doug Kwan  <dougkwan@google.com>
7885
7886         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7887         (Arm_relobj::Mapping_symbol_position,
7888          Arm_reloj::Mapping_symbol_position_less,
7889          Arm_relobj::Mapping_symbols_info): New types.
7890         (Target_arm::is_mapping_symbol_name): New method definition.
7891         (Arm_relobj::do_count_local_symbols): Save information about mapping
7892         symbols.
7893
7894 2010-01-11  Doug Kwan  <dougkwan@google.com>
7895
7896         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7897         Arm_relocate_functions::thumb32_branch_upper,
7898         Arm_relocate_functions::thumb32_branch_lower,
7899         Arm_relocate_functions::thumb32_cond_branch_offset,
7900         Arm_relocate_functions::thumb32_cond_branch_upper,
7901         Arm_relocate_functions::thumb32_cond_branch_lower,
7902         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7903         branch offset encoding.
7904         (Arm_relocate_functions::thumb_branch_common): Use new branch
7905         offset encoding methods to avoid code duplication.
7906         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7907         (Stub_addend_reader::operator()): Use new branch encoding method
7908         to avoid code duplication.
7909
7910 2010-01-11  Doug Kwan  <dougkwan@google.com>
7911
7912         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7913         (Target_arm::do_finalize_sections): Define special EXIDX section
7914         symbols only if referenced.
7915         * gc.h (Garbage_collection::add_reference): New method.
7916         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7917         code duplication.
7918
7919 2010-01-11  Ian Lance Taylor  <iant@google.com>
7920
7921         * script.cc (Version_script_info::build_expression_list_lookup):
7922         Change complaing about duplicate wildcard match from error to
7923         warning.
7924
7925         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7926         of 2009-12-30.
7927         (Version_script_info::Version_script_info): Initialize globs_,
7928         default_version_, default_is_global_, and exact_.  Don't
7929         initialize globals_ or locals_.
7930         (Version_script_info::build_lookup_tables): Build local symbols
7931         first.
7932         (Version_script_info::unquote): New function.
7933         (Version_script_info::add_exact_match): New function.
7934         (Version_script_info::build_expression_list_lookup): Remove lookup
7935         parameter.  Add is_global parameter.  Change all callers.  Handle
7936         wildcard pattern specially.  Unquote pattern.  Call
7937         add_exact_match.
7938         (Version_script_info::get_name_to_match): New function.
7939         (Version_script_info::get_symbol_version): New function.
7940         (Version_script_info::get_symbol_version_helper): Remove.
7941         (Version_script_info::check_unmatched_names): Call unquote.
7942         * script.h (class Version_script_info): Change get_symbol_version
7943         to be non-inline and add is_global parameter; change all callers.
7944         Rewrite symbol_is_local.  Update declarations.  Define struct
7945         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7946         Remove globals_ and locals_ members.  Add exact_, globs_,
7947         default_version_, is_global_.
7948         (Version_script_info::Glob): Remove pattern, add expression and
7949         is_global.  Update constructor.  Change all callers.
7950         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7951         default version.
7952         (Versions::symbol_section_contents): If a symbol is undefined, or
7953         defined in a dynamic object, set the version index to
7954         VER_NDX_LOCAL.
7955         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7956         symbol_is_local.
7957         (Symbol_table::add_from_pluginobj): Likewise.
7958         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7959
7960 2010-01-11  Doug Kwan  <dougkwan@google.com>
7961
7962         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7963         (incremental_dump_LDADD): Add linking option for libintl.
7964         * Makefile.in: Regenerate.
7965
7966 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7967
7968         PR gold/11144
7969         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7970         instead of -Ds.
7971         * testsuite/Makefile.in: Regenerated.
7972
7973 2010-01-10  Doug Kwan  <dougkwan@google.com>
7974
7975         * options.h (DEFINE_var): Use parentheses around argument varname__
7976         in macro body to avoid any unintended subsequent substitutions.
7977
7978 2010-01-10  Ian Lance Taylor  <iant@google.com>
7979
7980         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
7981         candidates before doing symbol resolution.
7982
7983         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
7984         ODR candidates if only one is weak.
7985
7986 2010-01-08  Ian Lance Taylor  <iant@google.com>
7987
7988         * script.cc (Version_script_info::build_expression_list_lookup):
7989         Don't warn about ambiguous version, just record the ambiguity.
7990         (Version_script_info::get_symbol_version_helper): Give error if
7991         version is ambiguous.
7992
7993 2010-01-08  Doug Kwan  <dougkwan@google.com>
7994
7995         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
7996         prev_data_size_ and prev_addralign_.  Remove initializer for
7997         deleted data member has_been_changed_.
7998         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
7999         to determine if the table is empty.
8000         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8001         Remove.
8002         (Stub_table::add_reloc_stub): Define method in class definition
8003         instead of just declaring it there.
8004         (Stub_table::add_cortex_a8_stub): New method definition.
8005         (Stub_table::update_data_size_and_addralign): Ditto.
8006         (Stub_table::finalize_stubs): Ditto.
8007         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8008         (Stub_table::do_addralign_): Return address alignment in the
8009         (Stub_table::do_reset_address_and_file_offset): Define method in
8010         class definition instead of declaring it there.  Set current data
8011         size to be the data size of the previous pass.
8012         (Stub_table::set_final_data_size): Use current data size as the
8013         final data size.
8014         (Stub_table::relocate_stub): Change parameter type of stub from
8015         Reloc_stub pointer to Stub pointer.
8016         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8017         (Stub_table::Cortex_a8_stub_list): New typedef.
8018         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8019          Stub_table::prev_addralign_): New data member.
8020         (Arm_relobj::Arm_relobj): Initialize data member
8021         section_has_cortex_a8_workaround_.
8022         (Arm_relobj::section_has_cortex_a8_workaround,
8023          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8024          definitions.
8025         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8026         declarations.
8027         (Target_arm::relocate_stub): Change parameter type of stub from
8028         Reloc_stub pointer to Stub pointer.
8029         (Insn_template::size, Insn_template::alignment): Handle
8030         THUMB16_SPECIAL_TYPE.
8031         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8032          Stub_table::update_data_size_and_addralign,
8033          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8034         definitions.
8035         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8036         (Stub_table::do_write): Ditto.
8037         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8038
8039 2010-01-08  Ian Lance Taylor  <iant@google.com>
8040
8041         PR 11108
8042         * symtab.h (class Symbol): Remove fields is_target_special_ and
8043         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8044         (Symbol::is_defined_in_discarded_section): New function.
8045         (Symbol::set_is_defined_in_discarded_section): New function.
8046         (Symbol::has_plt_offset): Rewrite.
8047         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8048         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8049         Don't initialize is_target_special_ or has_plt_offset_.
8050         Initialize is_defined_in_discarded_section_.
8051         (Symbol_table::add_from_relobj): If appropriate, set
8052         is_defined_in_discarded_section.
8053         * resolve.cc (Symbol::override_base_with_special): Don't test
8054         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8055         * target-reloc.h (relocate_section): Do special handling for
8056         symbols defined in discarded sections for global symbols as well
8057         as local symbols.
8058
8059 2010-01-08  Ian Lance Taylor  <iant@google.com>
8060
8061         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8062         the SHT_SYMTAB case.
8063
8064 2010-01-08  Ian Lance Taylor  <iant@google.com>
8065
8066         * object.cc (Sized_relobj::do_layout): Don't get confused if
8067         layout_eh_frame returns NULL.
8068
8069 2010-01-08  Ian Lance Taylor  <iant@google.com>
8070
8071         PR 11084
8072         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8073         dynamic symbol table, use the normal symbol table.
8074         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8075         symbol table.
8076
8077 2010-01-08  Ian Lance Taylor  <iant@google.com>
8078
8079         PR 11072
8080         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8081         sections.
8082
8083 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8084
8085         * version.cc (print_version): Change to "Copyright 2010".
8086
8087 2010-01-08  Ian Lance Taylor  <iant@google.com>
8088
8089         PR 10287
8090         PR 11063
8091         * i386.cc (class Target_i386): Change return type of plt_section
8092         to be non-const.
8093         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8094         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8095         tls_desc_rel_ field.
8096         (Output_data_plt_i386::rel_tls_desc): New function.
8097         (Target_i386::rel_tls_desc_section): New function.
8098         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8099         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8100         R_386_TLS_DESC reloc in rel_tls_desc_section.
8101         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8102         Define struct Tlsdesc_info.
8103         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8104         (Target_x86_64::do_reloc_symbol_index): New function.
8105         (Target_x86_64::add_tlsdesc_info): New function.
8106         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8107         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8108         tlsdesc_rel_ field.
8109         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8110         all callers.
8111         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8112         (Target_x86_64::rela_tlsdesc_section): New function.
8113         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8114         handling.
8115         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8116         (Target_x86_64::do_reloc_addend): New function.
8117         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8118         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8119         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8120         (Output_reloc::type): New function.
8121         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8122         (Output_reloc::is_target_specific): New function.
8123         (Output_reloc::target_arg): New function.
8124         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8125         absolute relocs and target specific relocs.
8126         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8127         add_target_specific.
8128         (class Output_data_reloc) [SHT_RELA]: Likewise.
8129         * output.cc (Output_reloc::Output_reloc): Add four new versions
8130         for absolute relocs and target specific relocs.
8131         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8132         (Output_reloc::get_symbol_index): Likewise.
8133         (Output_reloc::local_section_offset): Check that local_sym_index_
8134         is not TARGET_CODE or 0.
8135         (Output_reloc::symbol_value): Likewise.
8136         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8137         reloc.
8138         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8139         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8140         functions.
8141         * layout.cc (add_target_dynamic_tags): Use output section for
8142         DT_PLTRELSZ and DT_JMPREL.
8143
8144 2010-01-07  Ian Lance Taylor  <iant@google.com>
8145
8146         PR 11061
8147         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8148         function.
8149         (class Output_data_reloc_generic): Define.
8150         (class Output_data_reloc_base): Change base class to
8151         Output_data_reloc_generic.  Change add() method to call
8152         bump_relative_reloc_count for a relative reloc.  Remove
8153         sort_relocs_ field.
8154         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8155         to sort_relocs().
8156         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8157         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8158         appropriate.
8159         * layout.h (class Layout): Update declaration.
8160
8161 2010-01-07  Ian Lance Taylor  <iant@google.com>
8162
8163         * output.h (class Output_data): Add const version of
8164         output_section and do_output_section.
8165         (class Output_section_data): Add const version of
8166         do_output_section.
8167         (class Output_section): Likewise.
8168         * layout.cc (Layout::add_target_dynamic_tags): New function.
8169         * layout.h (class Layout): Update declarations.
8170         * arm.cc (Target_arm::do_finalize_sections): Use
8171         add_target_dynamic_tags.
8172         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8173         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8174         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8175         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8176
8177 2010-01-07  Ian Lance Taylor  <iant@google.com>
8178
8179         PR 11042
8180         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8181         object as needed.
8182
8183 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8184             Ian Lance Taylor  <iant@google.com>
8185
8186         PR 11019
8187         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8188         Xindex::read_symtab_xindex.
8189
8190 2010-01-07  Doug Kwan  <dougkwan@google.com>
8191
8192         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8193         (Insn_template::thumb16_bcond_insn): New method declaration.
8194         (Insn_template): Fix spelling.
8195         (Stub::thumb16_special): New method declaration.
8196         (Stub::do_write): Define virtual method which was previously pure
8197         virtual.
8198         (Stub::do_thumb16_special): New method declaration.
8199         (Stub::do_fixed_endian_write): New template member.
8200         (Reloc_stub::do_write): Remove.
8201         (Reloc_stub::do_fixed_endian_write): Remove.
8202         (Cortex_a8_stub): New class definition.
8203         (Stub_factory::make_cortex_a8_stub): New method definition.
8204         (Stub_factory::Stub_factory): Add missing static storage class
8205         qualifier for elf32_arm_stub_a8_veneer_blx.
8206
8207 2010-01-07  Ian Lance Taylor  <iant@google.com>
8208
8209         PR 10980
8210         * options.h (class General_options): Add --warn-unresolved-symbols
8211         and --error-unresolved-symbols.
8212         * errors.cc (Errors::undefined_symbol): Implement
8213         --warn-unresolved-symbols.
8214
8215         * options.h (class General_options): Add -z text and -z textoff.
8216         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8217
8218 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8219
8220         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8221         (Garbage_collection::cident_sections): New function.
8222         (Garbage_collection::add_cident_section): New function.
8223         (Garbage_collection::cident_sections_): New member.
8224         (gc_process_relocs): Add references to sections whose names are C
8225         identifiers.
8226         * gold.h (cident_section_start_prefix): New constant.
8227         (cident_section_stop_prefix): New constant.
8228         (is_cident): New function.
8229         * layout.cc (Layout::define_section_symbols): Replace string constants
8230         with the newly defined constants.
8231         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8232         C identifiers.
8233         * testsuite/Makefile.am: Add gc_orphan_section_test.
8234         * testsuite/Makefile.in: Regenerate.
8235         * testsuite/gc_orphan_section_test.cc: New file.
8236         * testsuite/gc_orphan_section_test.sh: New file.
8237
8238 2010-01-06  Ian Lance Taylor  <iant@google.com>
8239
8240         PR 10980
8241         * options.h (class General_options): Add --warn-shared-textrel.
8242         * layout.cc (Layout::finish_dynamic_section): Implement
8243         --warn-shared-textrel.
8244
8245         PR 10980
8246         * options.h (class General_options): Add --warn-multiple-gp.
8247
8248 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8249
8250         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8251         $(THREADSLIB) and $(LIBDL).
8252         * Makefile.in: Rebuild.
8253
8254 2010-01-06  Ian Lance Taylor  <iant@google.com>
8255
8256         PR 10980
8257         * options.cc (General_options::parse_section_start): New function.
8258         (General_options::section_start): New function.
8259         (General_options::General_options): Initialize all members.
8260         * options.h: Include <map>
8261         (class General_options): Add --section-start.  Add section_starts_
8262         member.
8263         * layout.cc (Layout::attach_allocated_section_to_segment): If
8264         --section-start was used, set the address of the segment.  Remove
8265         local sort_sections.
8266         (Layout::relaxation_loop_body): If the address of the load segment
8267         has been set by --section-start, don't use it.
8268         * output.h (Output_segment::update_flags_for_output_section): New
8269         function.
8270         * output.cc (Output_segment::add_output_section): Call
8271         update_flags_for_output_section.
8272
8273 2010-01-05  Ian Lance Taylor  <iant@google.com>
8274
8275         PR 10980
8276         * options.h (class General_options): Add --undefined-version.
8277         * script.cc (struct Version_expression): Add was_matched_by_symbol
8278         field.
8279         (Version_script_info::matched_symbol): New function.
8280         (Version_script_info::get_symbol_version_helper): Call
8281         matched_symbol.
8282         (Version_script_info::check_unmatched_names): New function.
8283         * script.h (class Version_script_info): Update declarations.
8284         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8285
8286         * options.h (class General_options): Use DEFINE_bool_alias for
8287         allow_multiple_definition.
8288         * resolve.cc (Symbol_table::should_override): Don't test
8289         allow_multiple_definition.
8290
8291         PR 10980
8292         * options.h (class General_options): Add --cref.
8293         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8294         until after printing cref table.
8295         * cref.cc: Include "symtab.h".
8296         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8297         (Cref_table_compare::operator()): New function.
8298         (Cref_inputs::gather_cref): New function.
8299         (filecol): New static const.
8300         (Cref_inputs::print_cref): New function.
8301         (Cref::print_cref): New function.
8302         * cref.h: Include <cstdio>.
8303         (class Cref): Update declarations.
8304         * mapfile.h (Mapfile::file): New function.
8305         * object.h (class Object): Define Symbols.  Declare virtual
8306         do_get_global_symbols.
8307         (Object::get_global_symbols): New function.
8308         * object.cc (Input_objects::add_object): Pass object to cref_ if
8309         --cref.
8310         (Input_objects::archive_start): Likewise.
8311         (Input_objects::archive_stop): Likewise.
8312         (Input_objects::print_cref): New function.
8313         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8314         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8315         --cref.
8316         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8317         function.
8318         * plugin.h (class Sized_pluginobj): Update declarations.
8319
8320 2010-01-05  Ian Lance Taylor  <iant@google.com>
8321
8322         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8323         to is_default_version.  Rename insdef to insdefault.
8324         (Symbol_table::add_from_relobj): Rename def to is_default_version
8325         and local to is_forced_local.
8326         (Symbol_table::add_from_pluginobj): Likewise.
8327         (Symbol_table::add_from_dynobj): Likewise.
8328         (Symbol_table::define_special_symbol): Rename insdef to
8329         insdefault.
8330
8331 2010-01-04  Ian Lance Taylor  <iant@google.com>
8332
8333         PR 10980
8334         * options.h (class General_options): Add
8335         --allow-multiple-definition and -z muldefs.
8336         * resolve.cc (Symbol_table::should_override): Don't warn about a
8337         multiple symbol definition if --allow-multiple-definition or -z
8338         muldefs.
8339
8340         PR 10980
8341         * options.h (class General_options): Add --add-needed and
8342         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8343         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8344         error if --copy-dt-needed-entries aka --add-needed is used and
8345         would cause a change in behaviour.
8346
8347         PR 10980
8348         * options.h (class General_options): Add -G as a short version of
8349         --shared.  Add no-op options -assert, -g, and -i.
8350
8351 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8352
8353         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8354         check for .text or .gnu.linkonce.t sections.
8355         * icf.cc (Icf::find_identical_sections): Ditto.
8356         Change the detection for mangled function name within the section
8357         name.
8358         * icf.h (is_section_foldable_candidate): New function.
8359
8360 2009-12-30  Ian Lance Taylor  <iant@google.com>
8361
8362         PR 10980
8363         * options.h (class General_options): Permit two dashes with
8364         --retain-symbols-file.
8365
8366 2009-12-30  Ian Lance Taylor  <iant@google.com>
8367
8368         PR 10979
8369         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8370         don't put the file header and segment headers in the text
8371         segment.
8372
8373         PR 10979
8374         * common.cc (Sort_commons::operator()): Stabilize sort when both
8375         entries are NULL.
8376         (Symbol_table::do_allocate_commons_list): When allocating common
8377         symbols, skip a symbol which is no longer common.
8378         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8379         an object before checking its type.
8380         * testsuite/common_test_2.c: New file.
8381         * testsuite/common_test_3.c: New file.
8382         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8383         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8384         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8385         (common_test_2_pic.o, common_test_2.so): New targets.
8386         (common_test_3_pic.o, common_test_3.so): New targets.
8387         * testsuite/Makefile.in: Rebuild.
8388
8389         PR 10979
8390         * script.cc (read_input_script): If we see a new SECTIONS clause,
8391         and we have added an input section, give an error.
8392         * layout.h (class Layout): Add have_added_input_section function.
8393         Add have_added_input_section_ field.
8394         * layout.cc (Layout::Layout): Initialize
8395         have_added_input_section_.
8396         (Layout::layout): Set have_added_input_section_.
8397         (Layout::layout_eh_frame): Likewise.
8398
8399 2009-12-30  Ian Lance Taylor  <iant@google.com>
8400
8401         PR 10931
8402         * options.h (class General_options): Add --sort-common option.
8403         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8404         * common.cc (Sort_common): Add sort_order parameter to
8405         constructor.  Add sort_order_ field.
8406         (Sort_commons::operator): Check sort_order_.
8407         (Symbol_table::allocate_commons): Determine the sort order.
8408         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8409         Change all callers.
8410         (Symbol_table::do_allocate_commons_list): Likewise.
8411
8412 2009-12-30  Ian Lance Taylor  <iant@google.com>
8413
8414         PR 10916
8415         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8416         symbols from this object, don't change the visibility of an
8417         undefined symbol.
8418         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8419
8420 2009-12-30  Ian Lance Taylor  <iant@google.com>
8421
8422         PR 10861
8423         * script.h (class Version_script_info): Define Language enum.
8424         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8425         new fields globals_, locals_, and is_finalized_.
8426         * script.cc: Various formatting fixes.
8427         (class Parser_closure): Change language_stack_ from a vector of
8428         std::string to one of Version_script_info::Language.  Adjust all
8429         uses accordingly.
8430         (class Lazy_demangler): Remove.
8431         (struct Version_expression): Change language from std::string to
8432         Version_script_info::Language.
8433         (Version_script_info::Version_script_info): New function.
8434         (Version_script_info::~Version_script_info): Don't call clear.
8435         (Version_script_info::finalize): New function.
8436         (Version_script_info::build_lookup_tables): New function.
8437         (Version_script_info::build_expression_list_lookup): New
8438         function.
8439         (Version_script_info::get_symbol_version_helper): Rewrite to use
8440         lookup tables.
8441         (Version_script_info::print_expression_list): Adjust to use
8442         Version_script_info::Language.
8443         (script_push_lex_into_version_mode): Check that the version script
8444         has not been finalized.
8445         (version_script_push_lang): Change language string to
8446         Version_script_info::Language.
8447         * options.cc (Command_line::version_script): New function.
8448         * options.h (class General_options): Add finalize_dynamic_list
8449         function.  Change version_script from declaration to definition.
8450         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8451         * testsuite/version_script.map: Remove duplicate def of foo.
8452         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8453         version_script.map.
8454         * testsuite/Makefile.in: Rebuild.
8455
8456 2009-12-30  Ian Lance Taylor  <iant@google.com>
8457
8458         PR 10843
8459         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8460         if the input symbol index is 0, make the output symbol index 0.
8461
8462 2009-12-30  Ian Lance Taylor  <iant@google.com>
8463
8464         PR 10670
8465         * options.h (class General_options): Add -x/--discard-all.
8466         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8467         --discard-all.  If the local symbol needs a dynamic entry, check
8468         that before handling --discard-locals.
8469
8470 2009-12-30  Ian Lance Taylor  <iant@google.com>
8471
8472         PR 10450
8473         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8474         flags to PF_R.
8475         (Output_segment::add_output_section): Don't change the flags if
8476         the type is PT_TLS.
8477
8478         PR 10450
8479         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8480         GNU hash table if they need a dynamic value.  Otherwise, don't add
8481         them if they are defined in a dynamic object or are forced local.
8482
8483 2009-12-29  Ian Lance Taylor  <iant@google.com>
8484
8485         PR 10450
8486         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8487         .gnu.hash table for a 32-bit target.
8488
8489         PR 10450
8490         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8491         regular and a dynamic object only needs a dynamic symbol table
8492         entry if it is externally visible.
8493
8494         PR 10450
8495         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8496         constructor.  Add global_offset_table_ field.
8497         (Target_i386::got_section): Set global_offset_table_.
8498         (Target_i386::do_finalize_sections): Set global_offset_table_
8499         size.
8500         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8501         in constructor.  Add global_offset_table_ field.
8502         (Target_x86_64::got_section): Set global_offset_table_.
8503         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8504         size.
8505
8506         * layout.cc (Layout::Layout): Initialize increase_relro_.
8507         (Layout::get_output_section): Add is_relro, is_last_relro, and
8508         is_first_non_relro parameters.  Change all callers.
8509         (Layout::choose_output_section): Likewise.
8510         (Layout::add_output_section_data): Likewise.
8511         (Layout::make_output_section): Likewise.
8512         (Layout::set_segment_offsets): Clear increase_relro when using a
8513         linker script.
8514         * layout.h (class Layout): Add increase_relro method.  Add
8515         increase_relro_ field.  Update declarations.
8516         * output.cc (Output_section::Output_section): Initialize
8517         is_last_relro_ and is_first_non_relro_.
8518         (Output_segment::add_output_section): Group relro sections is
8519         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8520         (Output_segment::maximum_alignment): Remove relro handling.
8521         (Output_segment::set_section_addresses): Add increase_relro
8522         parameter.  Change all callers.  Add initial alignment to align
8523         relro sections on separate page.  Remove old relro handling.
8524         (Output_segment::set_section_list_addresses): Remove in_relro
8525         parameter.  Change all callers.
8526         (Output_segment::set_offset): Add increase parameter.  Change all
8527         callers.  Remove old relro handling.
8528         * output.h (class Output_section): Add new methods: is_last_relro,
8529         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8530         Add is_last_relro_ and is_first_non_relro_ fields.
8531         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8532         Create separate .got.plt section.  Call increase_relro.
8533         * x86_64.cc (Target_x86_64::got_section): Likewise.
8534         * testsuite/relro_script_test.t: Add .got.plt.
8535
8536         PR 10450
8537         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8538         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8539         (Layout::finalize): Call set_dynamic_symbol_size.
8540         (Layout::set_dynamic_symbol_size): New function.
8541         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8542         set_dynamic_symbol_size.
8543
8544         PR 10450
8545         * output.h (class Output_section): Add is_entsize_zero_ field.
8546         * output.cc (Output_section::Output_section): Initialize
8547         is_entsize_zero_.
8548         (Output_section::set_entsize): If two different entsizes are
8549         requested, force it to zero.
8550         (Output_section::add_input_section): Set flags for .debug_str
8551         before updating section flags.  Set entsize.
8552         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8553         and SHF_STRING if all input sections have those flags.
8554
8555 2009-12-29   Rafael Espindola  <espindola@google.com>
8556
8557         * main.cc (main): Fix the sys time reporting.
8558         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8559         reporting.
8560
8561 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8562
8563         * options.cc (General_options::parse_version): Allow -v to exit
8564         without an error if there is nothing to link.
8565
8566 2009-12-29  Ian Lance Taylor  <iant@google.com>
8567
8568         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8569         using a version of gcc before 4.1.
8570         * configure: Rebuild.
8571
8572 2009-12-28  Chris Demetriou  <cgd@google.com>
8573
8574         * attributes.cc (Output_attributes_section_data::do_write): Use
8575         std::vector::front rather than std::vector::data.
8576
8577 2009-12-28  Ian Lance Taylor  <iant@google.com>
8578
8579         * symtab.h (class Symbol_table): Add enum Defined.
8580         * resolve.cc (Symbol_table::should_override): Add defined
8581         parameter.  Change all callers.  Test whether object is NULL
8582         before calling a method on it.
8583         (Symbol_table::report_resolve_problem): Add defined parameter.
8584         Change all callers.
8585         (Symbol_table::should_override_with_special): Likewise.
8586         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8587         parameter.  Change all callers.
8588         (Symbol_table::do_define_in_output_data): Likewise.
8589         (Symbol_table::define_in_output_segment): Likewise.
8590         (Symbol_table::do_define_in_output_segment): Likewise.
8591         (Symbol_table::define_as_constant): Likewise.
8592         (Symbol_table::do_define_as_constant): Likewise.
8593         * script.h (class Symbol_assignment): Add is_defsym parameter to
8594         constructor; change all callers.
8595         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8596         parameter.  Change all callers.  Add is_defsym_ field.
8597         (class Parser_closure): Add parsing_defsym parameter to
8598         constructor; change all callers.  Add parsing_defsym accessor
8599         function.  Add parsing_defsym_ field.
8600
8601 2009-12-28  Ian Lance Taylor  <iant@google.com>
8602
8603         * gold.cc (queue_middle_tasks): Fix formatting.
8604         * object.cc (Relobj::is_section_name_included): Likewise.
8605
8606 2009-12-23  Ian Lance Taylor  <iant@google.com>
8607
8608         * i386.cc (Target_i386::do_calls_non_split): Recognize
8609         -fsplit-stack prologue for a function with a static chain.
8610         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8611         -fsplit-stack prologue when using %r11.
8612
8613 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8614
8615         * options.cc (General_options::parse_version): Make -v continue and do
8616         the link like GNU ld does.
8617
8618 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8619
8620         * Makefile.am (CCFILES): Add timer.cc.
8621         (HFILES): Add timer.h.
8622         * configure.ac: Check for sysconf and times.
8623         * main.cc: include timer.h.
8624         (main): Use Timer instead of get_run_time.
8625         * timer.cc: New.
8626         * timer.h: New.
8627         * workqueue.cc: include timer.h.
8628         (Workqueue::find_and_run_task):
8629         Report user, sys and wall time.
8630         * Makefile.in: Regenerate.
8631         * config.in: Regenerate.
8632         * configure: Regenerate.
8633
8634 2009-12-16  Doug Kwan  <dougkwan@google.com>
8635
8636         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8637         sections.
8638         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8639         relaxed input sections.
8640         * output.cc (Output_section::find_relaxed_input_section): Change
8641         return type to Output_relaxed_input_section pointer.  Adjust code
8642         for new type of relaxed_input_section_map_.
8643         * output.h (Output_section::find_relaxed_input_section): Change
8644         return type to Output_relaxed_input_section pointer.
8645         (Output_section::Output_relaxed_input_section_by_input_section_map):
8646         New type.
8647         (Output_section::relaxed_input_section_map_): Change type to
8648         Output_section::Output_relaxed_input_section_by_input_section_map.
8649         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8650         input section.
8651
8652 2009-12-15  Ian Lance Taylor  <iant@google.com>
8653
8654         * layout.cc (Layout::create_shstrtab): Only write out after input
8655         sections if we are compressing debug sections.
8656
8657 2009-12-15  Ian Lance Taylor  <iant@google.com>
8658
8659         * archive.cc (Archive::add_symbols): Only look up a symbol without
8660         a version if there is, in fact, a version.
8661
8662 2009-12-14  Ian Lance Taylor  <iant@google.com>
8663
8664         Revert -Wshadow changes, all changes from:
8665         2009-12-11  Doug Kwan  <dougkwan@google.com>
8666         2009-12-11  Nick Clifton  <nickc@redhat.com>
8667         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8668
8669 2009-12-11  Doug Kwan  <dougkwan@google.com>
8670
8671         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8672         due to -Wshadow.
8673         * attributes.cc (Object_attribute::size): Ditto.
8674         (Attributes_section_data::size): Ditto.
8675         (Attributes_section_data::Attributes_section_data): Ditto.
8676         (Output_attributes_section_data::do_write): Ditto.
8677         * attributes.h (Object_attribute::set_type): Ditto.
8678         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8679
8680 2009-12-11  Nick Clifton  <nickc@redhat.com>
8681
8682         * archive.cc: Fix shadowed variable warnings.
8683         * arm.cc: Likewise.
8684         * compressed_output.cc: Likewise.
8685         * compressed_output.h: Likewise.
8686         * configure: Likewise.
8687         * dwarf_reader.cc: Likewise.
8688         * dynobj.cc: Likewise.
8689         * dynobj.h: Likewise.
8690         * ehframe.cc: Likewise.
8691         * ehframe.h: Likewise.
8692         * errors.cc: Likewise.
8693         * expression.cc: Likewise.
8694         * fileread.cc: Likewise.
8695         * fileread.h: Likewise.
8696         * freebsd.h: Likewise.
8697         * i386.cc: Likewise.
8698         * icf.cc: Likewise.
8699         * incremental.h: Likewise.
8700         * layout.cc: Likewise.
8701         * layout.h: Likewise.
8702         * mapfile.cc: Likewise.
8703         * merge.cc: Likewise.
8704         * merge.h: Likewise.
8705         * object.cc: Likewise.
8706         * object.h: Likewise.
8707         * options.h: Likewise.
8708         * output.cc: Likewise.
8709         * output.h: Likewise.
8710         * parameters.cc: Likewise.
8711         * plugin.cc: Likewise.
8712         * powerpc.cc: Likewise.
8713         * reduced_debug_output.cc: Likewise.
8714         * reduced_debug_output.h: Likewise.
8715         * reloc.cc: Likewise.
8716         * reloc.h: Likewise.
8717         * resolve.cc: Likewise.
8718         * script-sections.cc: Likewise.
8719         * script.cc: Likewise.
8720         * script.h: Likewise.
8721         * sparc.cc: Likewise.
8722         * symtab.cc: Likewise.
8723         * symtab.h: Likewise.
8724         * target-select.cc: Likewise.
8725         * target-select.h: Likewise.
8726         * token.h: Likewise.
8727         * workqueue.cc: Likewise.
8728         * workqueue.h: Likewise.
8729         * x86_64.cc: Likewise.
8730
8731 2009-12-10  Doug Kwan  <dougkwan@google.com>
8732
8733         * arm.cc (attributes.h): New include.
8734         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8735         (Arm_relobj::~Arm_relobj): Delete object pointed by
8736         attributes_section_data_.
8737         (Arm_relobj::attributes_section_data): New method definition.
8738         (Arm_relobj::attributes_section_data_): New data member declaration.
8739         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8740         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8741         attributes_section_data_.
8742         (Arm_dynobj::attributes_section_data): New method definition.
8743         (Arm_dynobj::attributes_section_data_): New data member declaration.
8744         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8745         initialization value of may_use_blx_ to false.
8746         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8747         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8748         object attributes to compute results instead of hard-coding.
8749         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8750         Target_arm::get_secondary_compatible_arch,
8751         Target_arm::set_secondary_compatible_arch
8752         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8753         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8754         New method declarations.
8755         (Target_arm::get_aeabi_object_attribute): New method definition.
8756         (Target_arm::attributes_section_data_): New data member declaration.
8757         (read_arm_attributes_section): New template definition.
8758         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8759         (Arm_dynobj::do_read_symbols): Ditto.
8760         (Target_arm::do_finalize_sections): Merge attributes sections from
8761         input.  Check for BLX use after attributes section merging.
8762         Fix __exidx_start and __exidx_end visibility.  Create an
8763         .ARM.attributes section if necessary.
8764         (Target_arm::get_secondary_compatible_arch,
8765         Target_arm::set_secondary_compatible_arch,
8766         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8767         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8768         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8769         New method definitions.
8770
8771 2009-12-09  Ian Lance Taylor  <iant@google.com>
8772
8773         * plugin.cc (Plugin::load): Don't cast from void* to a function
8774         pointer.
8775
8776 2009-12-09  Ian Lance Taylor  <iant@google.com>
8777
8778         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8779         information fields.
8780
8781 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8782
8783         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8784         Replace two_file_shared_1.so with two_file_shared_2.so.
8785         * testsuite/Makefile.in: Regenerated.
8786
8787 2009-12-08  Doug Kwan  <dougkwan@google.com>
8788
8789         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8790         (HFILES): Add attributes.h and int_encoding.h.
8791         * Makefile.in: Regenerate.
8792         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8793         function definitions to int_encoding.cc
8794         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8795         prototypes to int_encoding.h
8796         * reduced_debug_output.cc (int_encoding.h): New include.
8797         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8798         function definitions to int_encoding.cc
8799         (insert_into_vector, read_from_pointer): Move template definitions to
8800         int_encoding.h
8801         * attributes.cc: New file.
8802         * attributes.h: New file.
8803         * int_encoding.cc: New file.
8804         * int_encoding.h: New file.
8805
8806 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8807
8808         PR gold/11055
8809         * incremental-dump.cc (dump_incremental_inputs): New.
8810         (main): Use dump_incremental_inputs.
8811
8812 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8813
8814         PR gold/10893
8815         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8816         checking elfcpp::STT_FUNC.
8817         (Target_i386::Relocate::relocate): Likewise.
8818         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8819
8820         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8821         symbols from shared libraries into normal FUNC symbols.
8822
8823         * symtab.h (Symbol): Add is_func and use it.
8824
8825 2009-12-05  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (Target_arm::arm_info): Initialize new fields
8828         attributes_section and attributes_vendor.
8829         * i386.cc (Target_i386::i386_info): Same.
8830         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8831         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8832         fields attributes_section and attributes_vendor.
8833         * sparc.cc (Target_sparc::sparc_info): Same.
8834         * target.h (Target::attributes_section, Target::attributes_vendor,
8835         Target::is_attributes_section, Target::attribute_arg_type,
8836         Target::attributes_order): New method definitions.
8837         (Target::Target_info::attributes_section,
8838         Target::Target_info::attributes_vendor): New fields.
8839         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8840         virtual method definitions.
8841         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8842         attributes_section and attributes_vendor.
8843         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8844
8845 2009-12-05  Doug Kwan  <dougkwan@google.com>
8846
8847         * arm.cc: Update comments about interworking and stub generation.
8848         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8849         considered as non-PIC.
8850         (Arm_relocate_functions::base_abs): Fix formatting.
8851         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8852         of function to use GOT entry address instead of offset.
8853         (Target_arm::Scan::global): Issue an error if a symbol would need a
8854         PLT does not get one because it is untyped.  Remove code to create
8855         dynamic symbols for relative branches.
8856         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8857         takes unsigned integer instead of boolean.
8858
8859 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8860
8861         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8862         (two_file_test_LDADD): Likewise.
8863         (common_test_1_LDADD): Likewise.
8864         (exception_test_LDADD) Likewise.
8865         (weak_test_LDADD): Likewise.
8866         (many_sections_test_LDADD): Likewise.
8867         (initpri1_LDADD): Likewise.
8868         (script_test_1_LDADD): Likewise.
8869         (script_test_2_LDADD): Likewise.
8870         (justsyms_LDADD): Likewise.
8871         (binary_test_LDADD): Likewise.
8872         (large_LDADD): Likewise.
8873         * testsuite/Makefile.in: Regenerated.
8874
8875 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8876
8877         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8878         (Symbol_table::override_with_special): Likewise.
8879         (Symbol_table::add_from_object): Likewise.
8880
8881 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8882
8883         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8884         Don't set the data_offset twice.
8885
8886 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8887
8888         * testsuite/Makefile.in: Regenerate.
8889
8890 2009-12-03  Doug Kwan  <dougkwan@google.com>
8891
8892         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8893         (Target_arm::do_finalize_sections): Add parameter for symbol table
8894         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8895         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8896         parameter for symbol table pointer.
8897         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8898         an additional parameter for a pointer to symbol table.
8899         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8900         parameter for a symbol table pointer.
8901         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8902         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8903         Ditto.
8904         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8905         parameter for a symbol table pointer.
8906
8907 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8908
8909         * incremental.cc (Incremental_inputs_header)
8910         (Incremental_inputs_header_write, Incremental_inputs_entry)
8911         (Incremental_inputs_entry_write): Move ...
8912         * incremental.h (Incremental_inputs_header)
8913         (Incremental_inputs_header_write, Incremental_inputs_entry)
8914         (Incremental_inputs_entry_write): here.
8915
8916 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8917
8918         * incremental.cc (make_sized_incremental_binary): Set the target.
8919         Error if it is incompatible.
8920         * output.h (Output_file): Add filename method.
8921
8922 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8923
8924         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8925         from the get_* methods.
8926
8927 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8928
8929         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8930         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8931         Write 0 for the data_offset of scripts.
8932
8933 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8934
8935         * testsuite/Makefile.am: Add the incremental_test.sh test.
8936         * testsuite/incremental_test.sh: New.
8937         * testsuite/incremental_test_1.c: New.
8938         * testsuite/incremental_test_2.c: New.
8939
8940 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8941
8942         * incremental-dump.cc (main): Fix typos.
8943
8944 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8945
8946         PR gold/11025
8947         * incremental-dump.cc (main): Use llu to print 64 bit values.
8948
8949 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8950             H.J. Lu  <hongjiu.lu@intel.com>
8951
8952         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8953         $(LIBDL).
8954         (incremental_dump_LDADD): Likewise.
8955         * Makefile.in: Regenerated.
8956
8957 2009-11-25  Doug Kwan  <dougkwan@google.com>
8958
8959         Revert:
8960
8961         2009-11-25  Doug Kwan  <dougkwan@google.com>
8962
8963                 * arm.cc (Target_arm::Target_arm): Move method definition
8964                 outside of class definition.  Add code to handle
8965                 --target1-rel, --target1-abs and --target2= options.
8966                 (Target_arm::get_reloc_reloc_type): Change method to be
8967                 non-static and const.
8968                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8969                 New data member declaration.
8970                 (Target_arm::Scan::local, Target_arm::Scan::global,
8971                 Target_arm::Relocate::relocate,
8972                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8973                 Adjust call to Target_arm::get_real_reloc_type.
8974                 (Target_arm::get_real_reloc_type): Use command line options
8975                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8976                 * options.h (--target1-rel, --target1-abs, --target2): New
8977                 ARM-only options.
8978
8979 2009-11-25  Doug Kwan  <dougkwan@google.com>
8980
8981         * arm.cc (Target_arm::Target_arm): Move method definition outside of
8982         class definition.  Add code to handle --target1-rel, --target1-abs
8983         and --target2= options.
8984         (Target_arm::get_reloc_reloc_type): Change method to be non-static
8985         and const.
8986         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
8987         member declaration.
8988         (Target_arm::Scan::local, Target_arm::Scan::global,
8989         Target_arm::Relocate::relocate,
8990         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
8991         call to Target_arm::get_real_reloc_type.
8992         (Target_arm::get_real_reloc_type): Use command line options to
8993         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8994         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
8995         options.
8996
8997 2009-11-25  Doug Kwan  <dougkwan@google.com>
8998
8999         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9000         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9001         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9002         formatting.
9003         (Arm_relocate_functions::thm_call): Replace body with a call to
9004         Arm_relocate_functions::thumb_branch_common.
9005         (Arm_relocate_functions::thm_jump24,
9006         Arm_relocate_functions::thm_xpc22): New method definitions.
9007         (Arm_relocate_functions::thumb_branch_common): New method definition.
9008         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9009         operator.
9010         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9011         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9012
9013 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9014
9015         * Makefile.am: Build incremental-dump
9016         * Makefile.in: Regenerate.
9017         * incremental-dump.cc: New.
9018         * incremental.cc (Incremental_inputs_header_data,
9019         Incremental_inputs_entry_data): Move to incremental.h
9020         * incremental.h: (Incremental_inputs_header_data,
9021         Incremental_inputs_entry_data): Move from incremental.cc
9022
9023 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9024
9025         * incremental.cc (Incremental_inputs_header,
9026         Incremental_inputs_header_write, Incremental_inputs_entry,
9027         Incremental_inputs_entry_write): Add a typedef with the data type.
9028
9029 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9030
9031         * incremental.cc (Incremental_inputs_header,
9032         Incremental_inputs_header_write, Incremental_inputs_entry,
9033         Incremental_inputs_entry_write): Update comment about which
9034         type has the filed descriptions.
9035
9036 2009-11-15  Doug Kwan  <dougkwan@google.com>
9037
9038         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9039         (Arm_relocate_functions::arm_branch_common): Change method defintion
9040         in class definition to a method declaration and update list of formal
9041         parameters.
9042         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9043         Arm_relocation_functions::jump24): Adjust call to
9044         Arm_relocate_functions::arm_branch_common.  Update list of formal
9045         parameters.
9046         (Arm_relocate_functions::xpc25): New method definition.
9047         (Arm_relocate_functions::arm_branch_common): Move method defintion
9048         out from class definition.  Use stubs for mode-switching and extending
9049         branch ranges.
9050         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9051         specially.  Change code to enable use of stubs in ARM branches.
9052
9053 2009-11-10  Doug Kwan  <dougkwan@google.com>
9054
9055         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9056         in method declaration.
9057         (Target_arm::relocate_stub): New method declaration.
9058         (Target_arm::default_target): Change to return a pointer instead of
9059         a const reference.
9060         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9061         Target_arm::default_target.
9062         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9063         method definition.
9064         (Target_arm::relocate_section): Adjust view.
9065         (Target_arm::relocate_stub): New method definition.
9066
9067 2009-11-10  Doug Kwan  <dougkwan@google.com>
9068
9069         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9070         a format warning.
9071         * incremental.cc (open_incremental_binary): Initialized local
9072         variables to avoid warnings.
9073         * object.cc (make_elf_object): Ditto.
9074         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9075         a format warning.
9076
9077 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9078
9079         PR gold/10930
9080         * testsuite/plugin_test.c: Include "config.h".
9081
9082 2009-11-09  Doug Kwan  <dougkwan@google.com>
9083
9084         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9085         (arm_symbol_value): Remove.
9086         (Arm_relocate_functions::arm_branch_common,
9087         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9088         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9089         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9090         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9091         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9092         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9093         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9094         Arm_relocate_functions::thm_mobw_abs_nc,
9095         Arm_relocate_functions::thm_mov_abs,
9096         Arm_relocate_functions::movw_prel_nc,
9097         Arm_relocate_functions::thm_movt_abs,
9098         Arm_relocate_functions::movt_prel,
9099         Arm_relocate_functions::thm_movw_prel_nc,
9100         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9101         (Target_arm::Relocate::relocate): Only decompose address into two
9102         parts if relocation type uses the thumb-bit and pass the actual
9103         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9104         calls to methods in Arm_relocate_functions for this change.
9105
9106 2009-11-08  Ian Lance Taylor  <iant@google.com>
9107
9108         PR 10925
9109         * reloc.cc: Instantiate
9110         Sized_relobj::initialize_input_to_output_maps and
9111         Sized_relobj:free_input_to_output_maps.
9112
9113 2009-11-06  Ian Lance Taylor  <iant@google.com>
9114
9115         PR 10876
9116         * defstd.cc (in_segment): Set only_if_ref true for "end".
9117
9118 2009-11-06  Doug Kwan  <dougkwan@google.com>
9119
9120         * arm.cc (class Reloc_stub): Correct a comment.
9121         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9122         (Target_arm::scan_section_for_stubs): New method declaration.
9123         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9124         Change methods from private to protected.
9125         (Target_arm::do_may_relax): New method definition.
9126         (Target_arm::do_relax, Target_arm::group_sections,
9127         Target_arm::scan_reloc_for_stub,
9128         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9129         (Target_arm::arm_input_section_map_): New data member declaration.
9130         (Target_arm::scan_reloc_for_stub,
9131         Target_arm::scan_reloc_section_for_stubs,
9132         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9133         Target_arm::do_relax): New method definitions.
9134
9135 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9136
9137         * configure.ac: Check for (struct stat)::st_mtim
9138         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9139         * config.in: Regenerate.
9140         * configure: Regenerate.
9141
9142 2009-11-05  Ian Lance Taylor  <iant@google.com>
9143
9144         PR 10910
9145         * output.cc (Output_segment::add_output_section): Add missing
9146         return statement.
9147
9148 2009-11-04  Ian Lance Taylor  <iant@google.com>
9149
9150         PR 10880
9151         * object.h (class Object): Add is_needed and set_is_needed
9152         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9153         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9154         defined in a dynamic object and referenced by a regular object,
9155         set is_needed for the dynamic object.
9156         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9157         if the file is marked with as_needed and it is not needed.
9158
9159 2009-11-04  Ian Lance Taylor  <iant@google.com>
9160
9161         PR 10887
9162         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9163         tags if data is discarded by linker script.
9164         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9165         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9166         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9167         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9168
9169 2009-11-04  Ian Lance Taylor  <iant@google.com>
9170
9171         * layout.cc (Layout::get_output_section): Add is_interp and
9172         is_dynamic_linker_section parameters.  Change all callers.
9173         (Layout::choose_output_section): Likewise.
9174         (Layout::make_output_section): Likewise.
9175         (Layout::add_output_section_data): Add is_dynamic_linker_section
9176         parameter.  Change all callers.
9177         * layout.h (class Layout): Update declarations.
9178         * output.h (class Output_section): Add is_interp, set_is_interp,
9179         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9180         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9181         generate_code_fills_at_write_ to a bitfield.
9182         * output.cc (Output_section::Output_sections): Initialize new
9183         fields.
9184         (Output_segment::add_output_section): Add do_sort parameter.
9185         Change all callers.
9186
9187 2009-11-03  Ian Lance Taylor  <iant@google.com>
9188
9189         PR 10860
9190         * options.h (class General_options): Add --warn-common.
9191         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9192         merging two common symbols.
9193         (Symbol_table::should_override): Handle --warn-common when merging
9194         a common symbol with a defined symbol.  Use report_resolve_problem
9195         for multiple definitions.
9196         (Symbol_table::report_resolve_problem): New function.
9197         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9198
9199 2009-11-03  Doug Kwan  <dougkwan@google.com>
9200
9201         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9202         stub_factory_.
9203         (Target_arm::stub_factory): New method definition.
9204         (Target_arm::new_arm_input_section,
9205         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9206         Target_arm::reloc_uses_thumb_bit): New method declarations.
9207         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9208         New type definitions.
9209         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9210         member declarations.
9211         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9212         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9213         New method definitions.
9214
9215 2009-11-03  Ian Lance Taylor  <iant@google.com>
9216
9217         * options.h (class General_options): Add --warn_constructors.
9218
9219 2009-11-03  Ian Lance Taylor  <iant@google.com>
9220
9221         PR 10893
9222         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9223         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9224
9225 2009-11-03  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 10895
9228         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9229         --msgid-bugs-address.
9230         (install-pdf): New target.
9231         (install-data_yes): Look up one directory to find mkinstalldirs.
9232
9233 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9234
9235         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9236         tree.
9237
9238 2009-10-30  Doug Kwan  <dougkwan@google.com>
9239
9240         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9241
9242 2009-10-30  Doug Kwan  <dougkwan@google.com>
9243
9244         * arm.cc (Stub_addend_reader): New struct template definition
9245         and partial specializations.
9246         (Stub_addend_reader::operator()): New method definition for a
9247         partially specialized template.
9248
9249 2009-10-30  Doug Kwan  <dougkwan@google.com>
9250
9251         * arm.cc (Arm_relobj::processor_specific_flags): New method
9252         definition.
9253         (Arm_relobj::do_read_symbols): New method declaration.
9254         (Arm_relobj::processor_specific_flags_): New data member declaration.
9255         (Arm_dynobj): New class definition.
9256         (Target_arm::do_finalize_sections): Add input_objects parameter.
9257         (Target_arm::do_adjust_elf_header): New method declaration.
9258         (Target_arm::are_eabi_versions_compatible,
9259         (Target_arm::merge_processor_specific_flags): New method declaration.
9260         (Target_arm::do_make_elf_object): New overloaded method definitions
9261         and declaration.
9262         (Arm_relobj::do_read_symbols): New method definition.
9263         (Arm_dynobj::do_read_symbols): Ditto.
9264         (Target_arm::do_finalize_sections): Add input_objects parameters.
9265         Merge processor-specific flags from all input objects.
9266         (Target_arm::are_eabi_versions_compatible,
9267         Target_arm::merge_processor_specific_flags,
9268         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9269         New method definitions.
9270         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9271         Input_objects pointer type parameter.
9272         * layout.cc (Layout::finalize): Pass input objects to target's.
9273         finalize_sections function.
9274         * output.cc (Output_file_header::do_sized_write): Set ELF file
9275         header's processor-specific flags.
9276         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9277         Input_objects pointer type parameter.
9278         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9279         * target.h (Input_objects): New forward class declaration.
9280         (Target::processor_specific_flags,
9281         Target::are_processor_specific_flags_sect): New method definitions.
9282         (Target::finalize_sections): Add input_objects parameter.
9283         (Target::Target): Initialize processor_specific_flags_ and
9284         are_processor_specific_flags_set_.
9285         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9286         parameter.
9287         (Target::set_processor_specific_flags): New method definition.
9288         (Target::processor_specific_flags_,
9289         Target::are_processor_specific_flags_set_): New data member
9290         declarations.
9291         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9292         Input_objects pointer type parameter.
9293
9294 2009-10-30  Doug Kwan  <dougkwan@google.com>
9295
9296         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9297
9298 2009-10-28  Ian Lance Taylor  <iant@google.com>
9299
9300         * object.h (class Relobj): Drop options parameter from
9301         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9302         do_scan_relocs, do_relocate.  Change all callers.
9303         (class Sized_relobj): Drop options parameters from
9304         do_gc_process_relocs, do_scan_relocs, do_relocate,
9305         do_relocate_sections, relocate_sections, emit_relocs_scan,
9306         emit_relocs_scan_reltype.  Change all callers.
9307         (struct Relocate_info): Remove options field and all references to
9308         it.
9309         * reloc.h (class Read_relocs): Remove options constructor
9310         parameter and options_ field.  Change all callers.
9311         (class Gc_process_relocs, class Scan_relocs): Likewise.
9312         (class Relocate_task): Likewise.
9313         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9314         all callers.
9315         (scan_relocatable_relocs): Likewise.
9316         * target.h (class Sized_target): Remove options parameter from
9317         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9318         all callers.
9319         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9320         callers.
9321         * arm.cc: Update functions to remove options parameters.
9322         * i386.cc: Likewise.
9323         * powerpc.cc: Likewise.
9324         * sparc.cc: Likewise.
9325         * x86_64.cc: Likewise.
9326         * testsuite/testfile.cc: Likewise.
9327
9328 2009-10-28  Doug Kwan  <dougkwan@google.com>
9329
9330         * arm.cc (Arm_relobj): New class definition.
9331         (Arm_relobj::scan_sections_for_stubs,
9332         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9333         New method definitions.
9334
9335 2009-10-28  Cary Coutant  <ccoutant@google.com>
9336
9337         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9338         (Plugin::cleanup_done_): New member.
9339         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9340         (Plugin_manager::cleanup_done_): Remove.
9341         (Plugin_manager::add_input_file): Edit error message.
9342         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9343         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9344
9345 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9346
9347         * fileread.cc: (File_read::View::~View): Use the new
9348         data_ownership_ filed.
9349         (File_read::~File_read): Dispose the new whole_file_view_.
9350         (File_read::open): Mmap the whole file if needed.
9351         (File_read::open): Use whole_file_view_ instead of contents_.
9352         (File_read::find_view): Use whole_file_view_ if applicable.
9353         (File_read::do_read): Use whole_file_view_ instead of contents_.
9354         (File_read::make_view): Use whole_file_view_ instead of contents_,
9355         update File_read::View::View call.
9356         (File_read::find_or_make_view): Update File_read::View::View
9357         call.
9358         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9359         remove contents_
9360         (File_read::View::Data_ownership): New enum.
9361         (File_read::View::View): Replace bool mapped_ with Data_ownership
9362         argument.
9363         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9364         (File_read::View::data_ownership_): New field.
9365         (File_read::contents_): Remove (replaced by whole_file_view_).
9366         (File_read::whole_file_view_): New field.
9367         * options.h (class General_options): Add --keep-files-mapped.
9368
9369 2009-10-27  Cary Coutant  <ccoutant@google.com>
9370
9371         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9372         * testsuite/Makefile.am (plugin_test_5): New test case.
9373         * testsuite/Makefile.in: Regenerate.
9374
9375 2009-10-25  Doug Kwan  <dougkwan@google.com>
9376
9377         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9378         from private to protected to allow access by child class.
9379         (Sized_relobj::do_relocate_sections): New method declaration.
9380         (Sized_relobj::relocate_sections): Virtualize.
9381         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9382         Sized_relobj::relocate_sections.  Instantiate template explicitly
9383         for different target sizes and endianity.
9384
9385 2009-10-24  Doug Kwan  <dougkwan@google.com>
9386
9387         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9388         (Arm_input_section::as_arm_input_section): New method.
9389         (Arm_output_section): New class definition.
9390         (Arm_output_section::create_stub_group,
9391         Arm_output_section::group_sections): New method definitions.
9392
9393 2009-10-22  Doug Kwan  <dougkwan@google.com>
9394
9395         * arm.cc (Arm_input_section): New class definition.
9396         (Arm_input_section::init, Arm_input_section:do_write,
9397         Arm_input_section::set_final_data_size,
9398         Arm_input_section::do_reset_address_and_file_offset): New method
9399         definitions.
9400
9401 2009-10-21  Doug Kwan  <dougkwan@google.com>
9402
9403         * arm.cc (Stub_table, Arm_input_section): New forward class
9404         declarations.
9405         (Stub_table): New class defintion.
9406         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9407         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9408         New method definition.
9409
9410 2009-10-21  Doug Kwan  <dougkwan@google.com>
9411
9412         * arm.cc: Update copyright comments.
9413         (Target_arm): New forward class template declaration.
9414         (Arm_address): New type.
9415         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9416         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9417         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9418         constants.
9419         (Insn_template): Same.
9420         (DEF_STUBS): New macro.
9421         (Stub_type): New enum type.
9422         (Stub_template): New class definition.
9423         (Stub): Same.
9424         (Reloc_stub): Same.
9425         (Stub_factory): Same.
9426         (Target_arm::Target_arm): Initialize may_use_blx_ and
9427         should_force_pic_veneer_.
9428         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9429         Target_arm::should_force_pic_veneer,
9430         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9431         Target_arm::using_thumb_only, Target_arm:;default_target): New
9432         method defintions.
9433         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9434         New data member declarations.
9435         (Insn_template::size, Insn_template::alignment): New method defintions.
9436         (Stub_template::Stub_template): New method definition.
9437         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9438         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9439         (Stub_factory::Stub_factory): New method definition.
9440         * gold.h (string_hash): New template.
9441         * output.h (Input_section_specifier::hash_value): Use
9442         gold::string_hash.
9443         (Input_section_specifier::string_hash): Remove.
9444         * stringpool.cc (Stringpool_template::string_hash): Use
9445         gold::string_hash.
9446
9447 2009-10-20  Doug Kwan  <dougkwan@google.com>
9448
9449         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9450         symbols of relaxed input sections.
9451         * output.h (Output_section::find_relaxed_input_section): Make
9452         method public.
9453
9454 2009-10-16  Doug Kwan  <dougkwan@google.com>
9455
9456         * dynobj.cc (Versions::Versions): Initialize version_script_.
9457         Only insert base version symbol definition for a shared object
9458         if version script defines any version versions.
9459         (Versions::define_base_version): New method definition.
9460         (Versions::add_def): Check that base version is not needed.
9461         (Versions::add_need): Define base version lazily.
9462         * dynobj.h (Versions::define_base_version): New method declaration.
9463         (Versions::needs_base_version_): New data member declaration.
9464         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9465         (check_DATA): Add no_version_test.stdout.
9466         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9467         New make rules.
9468         * testsuite/Makefile.in: Regenerate.
9469         * testsuite/no_version_test.c: New file.
9470         * testsuite/no_version_test.sh: Ditto.
9471
9472 2009-10-16  Doug Kwan  <dougkwan@google.com>
9473
9474         * expression.cc (class Segment_start_expression): New class definition.
9475         (Segment_start_expression::value): New method definition.
9476         (script_exp_function_segment_start): Return a new
9477         Segment_start_expression.
9478         * gold/script-c.h (script_saw_segment_start_expression): New function
9479         prototype.
9480         * script-sections.cc (Script_sections::Script_sections): Initialize
9481         SAW_SEGMENT_START_EXPRESSION_ to false.
9482         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9483         and -Tbbs options to specify section addresses if given in
9484         command line and no SEGMENT_START expression is seen in a script.
9485         * script-sections.h (Script_sections::saw_segment_start_expression,
9486         Script_sections::set_saw_segment_start_expression): New method
9487         definition.
9488         (Script_sections::saw_segment_start_expression_): New data member
9489         declaration.
9490         * script.cc (script_saw_segment_start_expression): New function.
9491         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9492         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9493         script_test_7.sh and script_test_8.sh.
9494         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9495         script_test_8.stdout.
9496         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9497         (script_test_6, script_test_6.stdout, script_test_7,
9498         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9499         * Makefile.in: Regenerate.
9500         * testsuite/script_test_6.sh: New file.
9501         * testsuite/script_test_6.t: Same.
9502         * testsuite/script_test_7.sh: Same.
9503         * testsuite/script_test_7.t: Same.
9504         * testsuite/script_test_8.sh: Same.
9505
9506 2009-10-16  Doug Kwan  <dougkwan@google.com>
9507
9508         * output.cc (Output_segment::set_section_list_address): Cast
9509         expressions to unsigned long long type to avoid format warnings.
9510
9511 2009-10-15  Ian Lance Taylor  <iant@google.com>
9512
9513         * script.cc (Script_options::add_symbol_assignment): Always add a
9514         dot assignment to script_sections_.
9515         * script-sections.cc (Script_sections::add_dot_assignment):
9516         Initialize if necessary.
9517
9518         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9519         program headers with no load segment if there is a linker script.
9520
9521         * layout.cc (Layout::set_segment_offsets): Align the file offset
9522         to the segment aligment for -N or -n with no load segment.
9523         * output.cc (Output_segment::add_output_section): Don't crash if
9524         the first section is a TLS section.
9525         (Output_segment::set_section_list_addresses): Print an error
9526         message if the address moves backward in a linker script.
9527         * script-sections.cc
9528         (Output_section_element_input::set_section_addresses): Don't
9529         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9530         (Orphan_output_section::set_section_addresses): Likewise.
9531
9532 2009-10-15  Doug Kwan  <dougkwan@google.com>
9533
9534         * layout.cc (Layout::finish_dynamic_section): Generate tags
9535         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9536         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9537         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9538
9539 2009-10-14  Ian Lance Taylor  <iant@google.com>
9540
9541         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9542         fields.
9543         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9544         data_shdr fields of relinfo.
9545         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9546         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9547         R_386_TLS_LDO_32, adjust based on section flags.
9548         (Target_i386::Relocate::fix_up_ldo): Remove.
9549
9550 2009-10-13  Ian Lance Taylor  <iant@google.com>
9551
9552         Add support for -pie.
9553         * options.h (class General_options): Add -pie and
9554         --pic-executable.
9555         (General_options::output_is_position_independent): Test -pie.
9556         (General_options::output_is_executable): Return true if not shared
9557         and not relocatable.
9558         (General_options::output_is_pie): Remove.
9559         * options.cc (General_options::finalize): Reject incompatible uses
9560         of -pie.
9561         * gold.cc (queue_middle_tasks): A -pie link is not static.
9562         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9563         * symtab.cc (Symbol::final_value_is_known): Return false if
9564         output_is_position_independent.
9565         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9566         output_is_position_independent.
9567         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9568         output_is_position_independent.
9569         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9570         output_is_position_independent.
9571         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9572         two_file_pie_test.
9573         (basic_pie_test.o, basic_pie_test): New targets.
9574         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9575         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9576         (two_file_pie_test): New target.
9577         * testsuite/Makefile.in: Rebuild.
9578         * README: Remove note saying that -pie is not supported.
9579
9580 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9581
9582         * options.h (class General_options): Add -init and -fini.
9583         * layout.cc (Layout::finish_dynamic_section): Emit
9584         given init and fini functions.
9585
9586 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9587
9588         * gc.h (gc_process_relocs): Check if icf is enabled using new
9589         function.
9590         * gold.cc (queue_initial_tasks): Likewise.
9591         (queue_middle_tasks): Likewise.
9592         * object.cc (do_layout): Likewise.
9593         * symtab.cc (is_section_folded): Likewise.
9594         * main.cc (main): Likewise.
9595         * reloc.cc (Read_relocs::run): Likewise.
9596         (Sized_relobj::do_scan_relocs): Likewise.
9597         * icf.cc (is_function_ctor_or_dtor): New function.
9598         (Icf::find_identical_sections): Check if function is ctor or dtor when
9599         safe icf is chosen.
9600         * options.h (General_options::icf): Change option to be an enum.
9601         (Icf_status): New enum.
9602         (icf_enabled): New method.
9603         (icf_safe_folding): New method.
9604         (set_icf_status): New method.
9605         (icf_status_): New variable.
9606         * (options.cc) (General_options::finalize): Set icf_status_.
9607         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9608         icf_test and icf_keep_unique_test to use the --icf enum flag.
9609         * testsuite/icf_safe_test.sh: New file.
9610         * testsuite/icf_safe_test.cc: New file.
9611
9612 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9613
9614         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9615         includes to gc.h and icf.h.
9616         * arm.cc: Include gc.h.
9617         * gold.cc: Likewise.
9618         * i386.cc: Likewise.
9619         * powerpc.cc: Likewise.
9620         * sparc.cc: Likewise.
9621         * x86_64.cc: Likewise.
9622         * gc.h: Include icf.h.
9623
9624 2009-10-11  Ian Lance Taylor  <iant@google.com>
9625
9626         * plugin.cc: Include "gold.h" before other header files.
9627
9628 2009-10-10  Chris Demetriou  <cgd@google.com>
9629
9630         * options.h (Input_file_argument::Input_file_type): New enum.
9631         (Input_file_argument::is_lib_): Replace with...
9632         (Input_file_argument::type_): New member.
9633         (Input_file_argument::Input_file_argument): Take Input_file_type
9634         'type' rather than boolean 'is_lib' as second argument.
9635         (Input_file_argument::is_lib): Use type_.
9636         (Input_file_argument::is_searched_file): New function.
9637         (Input_file_argument::may_need_search): Handle is_searched_file.
9638         * options.cc (General_options::parse_library): Support -l:filename.
9639         (General_options::parse_just_symbols): Update for Input_file_argument
9640         changes.
9641         (Command_line::process): Likewise.
9642         * archive.cc (Archive::get_file_and_offset): Likewise.
9643         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9644         * script.cc (read_script_file, script_add_file): Likewise.
9645         * fileread.cc (Input_file::Input_file): Likewise.
9646         (Input_file::will_search_for): Handle is_searched_file.
9647         (Input_file::open): Likewise.
9648         * readsyms.cc (Read_symbols::get_name): Likewise.
9649         * testsuite/Makefile.am (searched_file_test): New test.
9650         * testsuite/Makefile.in: Regenerate.
9651         * testsuite/searched_file_test.cc: New file.
9652         * testsuite/searched_file_test_lib.cc: New file.
9653
9654 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9655             Ian Lance Taylor  <iant@google.com>
9656
9657         * descriptor.cc: Include <cstdio> and "binary-io.h".
9658         (Descriptors::open): Open the files in binary mode always.
9659         * script.cc (Lex::get_token): Treat \r as whitespace.
9660
9661 2009-10-09  Ian Lance Taylor  <iant@google.com>
9662
9663         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9664
9665 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9666             Ian Lance Taylor  <iant@google.com>
9667
9668         * configure.ac: Check for readv function also.
9669         * fileread.cc (readv): Define if not HAVE_READV.
9670         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9671         does not exist.
9672         * config.in: Regenerate.
9673         * configure: Regenerate.
9674
9675 2009-10-09  Doug Kwan  <dougkwan@google.com>
9676
9677         * layout.cc (Layout::make_output_section): Call target hook to make
9678         ordinary output section.
9679         (Layout::finalize): Adjust parameter list of call the
9680         Target::may_relax().
9681         * layout.h (class Layout::section_list): New method.
9682         * merge.h (Output_merge_base::entsize): Change visibility to public.
9683         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9684         New methods.
9685         (Output_merge_string::do_is_string): New method.
9686         * object.cc (Sized_relobj::do_setup): renamed from
9687         Sized_relobj::set_up.
9688         * object.h (Sized_relobj::adjust_shndx,
9689         Sized_relobj::initializ_input_to_output_maps,
9690         Sized_relobj::free_input_to_output_maps): Change visibilities to
9691         protected.
9692         (Sized_relobj::setup): Virtualize.
9693         (Sized_relobj::do_setup): New method declaration.
9694         (Sized_relobj::invalidate_section_offset,
9695         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9696         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9697         * options.cc (parse_int): New function.
9698         * options.h (parse_int): New declaration.
9699         (DEFINE_int): New macro.
9700         (stub_group_size): New option.
9701         * output.cc (Output_section::Output_section): Initialize memebers
9702         merge_section_map_, merge_section_by_properties_map_,
9703         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9704         (Output_section::add_input_section): Handled deferred code-fill
9705         generation and remove an old comment.
9706         (Output_section::add_relaxed_input_section): New method definition.
9707         (Output_section::add_merge_input_section): Use merge section by
9708         properties map to speed to search.  Update merge section maps
9709         as appropriate.
9710         (Output_section::build_relaxation_map): New method definition.
9711         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9712         Same.
9713         (Output_section::relax_input_section): Renamed to
9714         Output_section::convert_input_sections_to_relaxed_sections and change
9715         interface to take a vector of pointers to relaxed sections.
9716         (Output_section::find_merge_section,
9717         Output_section::find_relaxed_input_section): New method definitions.
9718         (Output_section::is_input_address_mapped,
9719         Output_section::output_offset, Output_section::output_address):
9720         Use output section data maps to speed up searching.
9721         (Output_section::find_starting_output_address): Add comments.
9722         (Output_section::do_write,
9723         Output_section::write_to_postprocessing_buffer): Do code-fill
9724         generation as appropriate.
9725         (Output_section::get_input_sections): Invalidate relaxed input section
9726         map.
9727         (Output_section::restore_states): Adjust type of checkpoint .
9728         Invalidate relaxed input section map.
9729         * output.h (Output_merge_base): New class declaration.
9730         (Input_section_specifier): New class defintion.
9731         (class Output_relaxed_input_section) Change base class to
9732         Output_section_data_build.
9733         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9734         base class initializer.
9735         (Output_section::add_relaxed_input_section): New method declaration.
9736         (Output_section::Input_section): Change visibility to protected.
9737         (Output_section::Input_section::relobj,
9738         Output_section::Input_section::shndx): Handle relaxed input sections.
9739         Output_section::input_sections) Change visibility to protected.  Also
9740         define overload to return a non-const pointer.
9741         (Output_section::Merge_section_properties): New class defintion.
9742         (Output_section::Merge_section_by_properties_map,
9743         Output_section::Output_section_data_by_input_section_map,
9744         Output_section::Relaxation_map): New types.
9745         (Output_section::relax_input_section): Rename method to
9746         Output_section::convert_input_sections_to_relaxed_sections and change
9747         interface to take a vector of relaxed section pointers.
9748         (Output_section::find_merge_section,
9749         Output_section::find_relaxed_input_section,
9750         Output_section::build_relaxation_map,
9751         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9752         New method declarations.
9753         (Output_section::merge_section_map_
9754         Output_section::merge_section_by_properties_map_,
9755         Output_section::relaxed_input_section_map_,
9756         Output_section::is_relaxed_input_section_map_valid_,
9757         Output_section::generate_code_fills_at_write_): New data members.
9758         * script-sections.cc
9759         (Output_section_element_input::set_section_addresses): Call
9760         current_data_size and addralign methods of relaxed input sections.
9761         (Orphan_output_section::set_section_addresses): Call current_data_size
9762         and addralign methods of relaxed input sections.
9763         * symtab.cc (Symbol_table::compute_final_value): Extract template
9764         from the body of Symbol_table::sized_finalize_symbol.
9765         (Symbol_table::sized_finalized_symbol): Call
9766         Symbol_table::compute_final_value.
9767         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9768         (Symbol_table::compute_final_value): New templated method declaration.
9769         * target.cc (Target::do_make_output_section): New method defintion.
9770         * target.h (Target::make_output_section): New method declaration.
9771         (Target::relax): Add more parameters for input objects, symbol table
9772         and layout.  Adjust call to do_relax.
9773         (Target::do_make_output_section): New method declaration.
9774         (Target::do_relax): Add parameters for input objects, symbol table
9775         and layout.
9776
9777 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9778
9779         * pread.c: Include stdio.h.
9780
9781 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9782
9783         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9784         defined.
9785
9786 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9787
9788         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9789         Change read_shndx type to unsigned int.
9790         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9791         int.
9792         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9793         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9794         Change read_shndx type to unsigned int.
9795         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9796         int.
9797         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9798         * layout.cc (Layout::create_symtab_sections): Cast the result of
9799         local_symcount * symsize to off_t in the gold_assert.
9800
9801 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9802
9803         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9804         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9805         R_ARM_BASE_ABS.
9806         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9807         (Arm_relocate_functions::thm_abs5): New function.
9808         (Arm_relocate_functions::abs12): New function.
9809         (Arm_relocate_functions::abs16): New function.
9810         (Arm_relocate_functions::base_abs): New function.
9811         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9812         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9813         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9814         R_ARM_BASE_ABS.
9815         (Scan::global): Likewise.
9816         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9817         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9818         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9819         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9820         R_ARM_BASE_ABS.
9821
9822 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9823
9824         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9825         (Arm_relocate_functions::movt_prel): New function.
9826         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9827         (Arm_relocate_functions::thm_movt_prel): New function.
9828         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9829         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9830         (Scan::global, Relocate::relocate): Likewise.
9831         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9832
9833 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9834
9835         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9836         Incremental_checker.
9837         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9838         unsigned int.
9839         (class Incremental_inputs_header): New class.
9840         (Incremental_inputs_header_writer): Edit comment.
9841         (Incremental_inputs_entry): New class.
9842         (Incremental_inputs_entry_writer): Edit comment.
9843         (Sized_incremental_binary::do_find_incremental_inputs_section):
9844         Add *strtab_shndx parameter, fill it.
9845         (Sized_incremental_binary::do_check_inputs): New method.
9846         (Incremental_checker::can_incrementally_link_output_file): Use
9847         Sized_incremental_binary::check_inputs.
9848         (Incremental_inputs::report_command_line): Save command line in
9849         command_line_.
9850         * incremental.h:
9851         (Incremental_binary::find_incremental_inputs_section): New
9852         method.
9853         (Incremental_binary::do_find_incremental_inputs_section): Add
9854         strtab_shndx parameter.
9855         (Incremental_binary::do_check_inputs): New pure virtual method.
9856         (Sized_incremental_binary::do_check_inputs): Declare.
9857         (Incremental_checker::Incremental_checker): Add incremental_inputs
9858         parameter, use it to initialize incremental_inputs_.
9859         (Incremental_checker::incremental_inputs_): New field.
9860         (Incremental_checker::command_line): New method.
9861         (Incremental_checker::inputs): New method.
9862         (Incremental_checker::command_line_): New field.
9863
9864 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9865
9866         * incremental.cc: Include <cstdarg> and "target-select.h".
9867         (vexplain_no_incremental): New function.
9868         (explain_no_incremental): New function.
9869         (Incremental_binary::error): New method.
9870         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9871         method.
9872         (make_sized_incremental_binary): New function.
9873         (open_incremental_binary): New function.
9874         (can_incrementally_link_file): Add checks if output is ELF and has
9875         inputs section.
9876         * incremental.h: Include "elfcpp_file.h" and "output.h".
9877         (Incremental_binary): New class.
9878         (Sized_incremental_binary): New class.
9879         (open_incremental_binary): Declare.
9880         * object.cc (is_elf_object): Use
9881         elfcpp::Elf_recognizer::is_elf_file.
9882         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9883         * output.h (Output_file::filesize): New method.
9884
9885 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9886
9887         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9888         New function.
9889         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9890         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9891         function.
9892         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9893         function.
9894         (Arm_relocate_functions::movw_abs_nc): New function.
9895         (Arm_relocate_functions::movt_abs): New function.
9896         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9897         (Arm_relocate_functions::thm_movt_abs): New function.
9898         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9899         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9900         (Scan::global): Likewise.
9901         (Relocate::relocate): Likewise.
9902         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9903
9904 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9905
9906         * arm.cc (Arm_relocate_functions::got_prel) New function.
9907         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9908         (Relocate::relocate): Likewise.
9909         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9910
9911 2009-10-06  Ian Lance Taylor  <iant@google.com>
9912
9913         * options.h (class General_options): Define
9914         split_stack_adjust_size parameter.
9915         * object.h (class Object): Add uses_split_stack_ and
9916         has_no_split_stack_ fields.  Add uses_split_stack and
9917         has_no_split_stack accessor functions.  Declare
9918         handle_split_stack_section.
9919         (class Reloc_symbol_changes): Define.
9920         (class Sized_relobj): Define Function_offsets.  Declare
9921         split_stack_adjust, split_stack_adjust_reltype, and
9922         find_functions.
9923         * object.cc (Object::handle_split_stack_section): New function.
9924         (Sized_relobj::do_layout): Call handle_split_stack_section.
9925         * dynobj.cc (Sized_dynobj::do_layout): Call
9926         handle_split_stack_section.
9927         * reloc.cc (Sized_relobj::relocate_sections): Call
9928         split_stack_adjust for executable sections in split_stack
9929         objects.  Pass reloc_map to relocate_section.
9930         (Sized_relobj::split_stack_adjust): New function.
9931         (Sized_relobj::split_stack_adjust_reltype): New function.
9932         (Sized_relobj::find_functions): New function.
9933         * target-reloc.h: Include "object.h".
9934         (relocate_section): Add reloc_symbol_changes parameter.  Change
9935         all callers.
9936         * target.h (class Target): Add calls_non_split method.  Declare
9937         do_calls_non_split virtual method.  Declare match_view and
9938         set_view_to_nop.
9939         * target.cc: Include "elfcpp.h".
9940         (Target::do_calls_non_split): New function.
9941         (Target::match_view): New function.
9942         (Target::set_view_to_nop): New function.
9943         * gold.cc (queue_middle_tasks): Give an error if mixing
9944         split-stack and non-split-stack objects with -r.
9945         * i386.cc (Target_i386::relocate_section): Add
9946         reloc_symbol_changes parameter.
9947         (Target_i386::do_calls_non_split): New function.
9948         * x86_64.cc (Target_x86_64::relocate_section): Add
9949         reloc_symbol_changes parameter.
9950         (Target_x86_64::do_calls_non_split): New function.
9951         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9952         parameter.
9953         * powerpc.cc (Target_powerpc::relocate_section): Add
9954         reloc_symbol_changes parameter.
9955         * sparc.cc (Target_sparc::relocate_section): Add
9956         reloc_symbol_changes parameter.
9957         * configure.ac: Call AM_CONDITIONAL for the default target.
9958         * configure: Rebuild.
9959         * testsuite/Makefile.am (TEST_AS): New variable.
9960         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9961         (check_DATA): Add split_i386 and split_x86_64 files.
9962         (SPLIT_DEFSYMS): Define.
9963         (split_i386_[1234n].o): New targets.
9964         (split_i386_[124]): New targets.
9965         (split_i386_[1234r].stdout): New targets.
9966         (split_x86_64_[1234n].o): New targets.
9967         (split_x86_64_[124]): New targets.
9968         (split_x86_64_[1234r].stdout): New targets.
9969         (MOSTLYCLEANFILES): Add new executables.
9970         * testsuite/split_i386.sh: New file.
9971         * testsuite/split_x86_64.sh: New file.
9972         * testsuite/split_i386_1.s: New file.
9973         * testsuite/split_i386_2.s: New file.
9974         * testsuite/split_i386_3.s: New file.
9975         * testsuite/split_i386_4.s: New file.
9976         * testsuite/split_i386_n.s: New file.
9977         * testsuite/split_x86_64_1.s: New file.
9978         * testsuite/split_x86_64_2.s: New file.
9979         * testsuite/split_x86_64_3.s: New file.
9980         * testsuite/split_x86_64_4.s: New file.
9981         * testsuite/split_x86_64_n.s: New file.
9982         * testsuite/testfile.cc (Target_test): Update relocation_section
9983         function.
9984         * testsuite/Makefile.in: Rebuild.
9985
9986 2009-10-06  Ian Lance Taylor  <iant@google.com>
9987
9988         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
9989         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
9990         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
9991         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
9992         the address on ldo_addrs_.
9993         (Target_i386::Relocate::fix_up_ldo): New function.
9994
9995 2009-10-06   Rafael Espindola  <espindola@google.com>
9996
9997         * plugin.cc (add_input_library): New.
9998         (Plugin::load): Add add_input_library to tv.
9999         (Plugin_manager::add_input_file): Add the is_lib argument.
10000         (add_input_file): Update call to Plugin_manager::add_input_file.
10001         (add_input_library): New.
10002         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10003
10004 2009-09-30  Doug Kwan  <dougkwan@google.com>
10005
10006         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10007         symbol and call Symbol::may_need_copy_reloc to determine if
10008         a copy reloc is needed.
10009         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10010         nocopyreloc is given in command line.
10011         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10012         given in command line.
10013         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10014         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10015         of the removed Target_i386::may_need_copy_reloc.
10016         * options.h (copyreloc): New option with default value false.
10017         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10018         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10019         instead of the removed Target_powerpc::may_need_copy_reloc.
10020         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10021         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10022         instead of the removed Target_sparc::may_need_copy_reloc.
10023         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10024         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10025         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10026         instead of the removed Target_x86_64::may_need_copy_reloc.
10027
10028 2009-09-30  Ian Lance Taylor  <iant@google.com>
10029
10030         * object.h (class Object): Remove target_ field, and target,
10031         sized_target, and set_target methods.
10032         (Object::sized_target): Remove.
10033         (class Sized_relobj): Update declarations.  Remove sized_target.
10034         * object.cc (Sized_relobj::setup): Remove target parameter.
10035         Change all callers.
10036         (Input_objects::add_object): Don't do anything with the target.
10037         (make_elf_sized_object): Add punconfigured parameter.  Change all
10038         callers.  Set or test parameter target.
10039         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10040         Change all callers.
10041         * parameters.cc (Parameters::set_target): Change parameter type to
10042         be non-const.
10043         (Parameters::default_target): Remove.
10044         (set_parameters_target): Change parameter type to be non-const.
10045         (parameters_force_valid_target): New function.
10046         (parameters_clear_target): New function.
10047         * parameters.h (class Parameters): Update declarations.  Remove
10048         default_target method.  Add sized_target and clear_target
10049         methods.  Change target_ to be non-const.
10050         (set_parameters_target): Update declaration.
10051         (parameters_force_valid_target): Declare.
10052         (parameters_clear_target): Declare.
10053         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10054         as NULL if we aren't searching.
10055         (Add_symbols::run): Don't check for compatible target.
10056         * fileread.cc (Input_file::open_binary): Call
10057         parameters_force_valid_target.
10058         * gold.cc (queue_middle_tasks): Likewise.
10059         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10060         set_target on object.
10061         * dynobj.h (class Sized_dynobj): Update declarations.
10062         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10063         make_elf_object returns NULL.
10064         (Archive::include_member): Don't check whether object target is
10065         compatible.
10066         * output.cc (Output_section::add_input_section): Get target from
10067         parameters.
10068         (Output_section::relax_input_section): Likewise.
10069         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10070         parameters.
10071         (Sized_relobj::do_scan_relocs): Likewise.
10072         (Sized_relobj::relocate_sections): Likewise.
10073         * resolve.cc (Symbol_table::resolve): Likewise.
10074         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10075         parameter.  Change all callers.
10076         (Symbol_table::add_from_object): Get target from parameters.
10077         (Symbol_table::add_from_relobj): Don't check object target.
10078         (Symbol_table::add_from_dynobj): Likewise.
10079         (Symbol_table::define_special_symbol): Get target from
10080         parameters.
10081         * symtab.h (class Symbol_table): Update declaration.
10082         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10083         parameter.  Change all callers.  Clear parameter target.
10084         (Binary_test): Test target here.
10085         * testsuite/object_unittest.cc (gold_testsuite): Remove
10086         target_test_pointer parameter.  Change all callers.
10087         (Object_test): Test target here.
10088
10089 2009-09-26  Ian Lance Taylor  <iant@google.com>
10090
10091         * testsuite/initpri1.c: Don't try to use constructor priorities if
10092         compiling with gcc before 4.3.
10093
10094 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10095
10096         * testsuite/retain_symbols_file_test.sh (check_present): Change
10097         output file name to retain_symbols_file_test.stdout.
10098         (check_absent): Likewise.
10099
10100 2009-09-18  Craig Silverstein  <csilvers@google.com>
10101
10102         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10103         * options.cc: Include <cerrno> and <fstream>.
10104         (General_options::finalize): Parse -retain-symbols-file tag.
10105         * options.h: New flag.
10106         (General_options): New method should_retain_symbol, new
10107         variable symbols_to_retain.
10108         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10109         should_retain_symbol map.
10110         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10111         * testsuite/Makefile.in: Regenerate.
10112         * testsuite/retain_symbols_file_test.sh: New file.
10113
10114 2009-09-18  Nick Clifton  <nickc@redhat.com>
10115
10116         * po/es.po: Updated Spanish translation.
10117
10118 2009-09-17  Doug Kwan  <dougkwan@google.com>
10119
10120         * debug.h (DEBUG_RELAXATION): New constant.
10121         (DEBUG_ALL): Add DEBUG_RELAXATION.
10122         (debug_string_to_enum): Add relaxation debug option.
10123         * layout.cc
10124         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10125         Layout::Relaxation_debug_check::read_sections,
10126         Layout::Relaxation_debug_check::read_sections): New method definitions.
10127         (Layout::Layout): Initialize data members
10128         record_output_section_data_from_scrips_,
10129         script_output_section_data_list_ and relaxation_debug_check_.
10130         (Layout::save_segments, Layout::restore_segments,
10131         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10132         Layout::relaxation_loop_body): New method definitions.
10133         (Layout::finalize): Support relaxation.  Move section layout code to
10134         Layout::relaxation_loop_body.
10135         (Layout::set_asection_address_from_script): Move code for orphan
10136         section placement out.
10137         (Layout::place_orphan_sections_in_script): New method definition.
10138         * layout.h (Output_segment_headers, Output_file_header):
10139         New forward class declarations.
10140         (Layout::~Layout): Define.
10141         (Layout::new_output_section_data_from_script): New method definition.
10142         (Layout::place_orphan_sections_in_script): New method declaration.
10143         (Layout::Segment_states): New type declaration.
10144         (Layout::save_segments, Layout::restore_segments,
10145         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10146         Layout::relaxation_loop_body): New method declarations.
10147         (Layout::Output_section_data_list): New type declaration.
10148         (Layout::Relaxation_debug_check): New class definition.
10149         (Layout::record_output_section_data_from_script_,
10150         Layout::script_output_section_data_list_, Layout::segment_states_,
10151         Layout::relaxation_debug_check_): New data members.
10152         * output.cc: (Output_section_headers::do_size): New method definition.
10153         (Output_section_headers::Output_section_headers): Move size
10154         computation to Output_section_headers::do_size.
10155         (Output_segment_headers::do_size): New method definition.
10156         (Output_file_header::Output_file_header): Move size computation to
10157         Output_file_header::do_size and call it.
10158         (Output_file_header::do_size): New method definition.
10159         (Output_data_group::Output_data_group): Adjust call to
10160         Output_section_data.
10161         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10162         (Output_symtab_xindex::do_write): Add array bound check.
10163         (Output_section::Input_section::print_to_mapfile): Handle
10164         RELAXED_INPUT_SECTION_CODE.
10165         (Output_section::Output_section): Initialize data member checkpoint_.
10166         (Output_section::~Output_section): Delete checkpoint object pointed
10167         by checkpoint_.
10168         (Output_section::add_input_section): Always add an Input_section if
10169         relaxing.
10170         (Output_section::add_merge_input_section): Add assert.
10171         (Output_section::relax_input_section): New method definition.
10172         (Output_section::set_final_data_size): Set load address to zero for
10173         an unallocated section.
10174         (Output_section::do_address_and_file_offset_have_reset_values):
10175         New method definition.
10176         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10177         Handle relaxed input section.
10178         (Output_section::sort_attached_input_sections): Checkpoint input
10179         section list lazily.
10180         (Output_section::get_input_sections): Change type of input_sections to
10181         list of Simple_input_section pointers.  Checkpoint input section list
10182         lazily.  Also handle relaxed input sections.
10183         (Output_section::add_input_section_for_script): Take a reference to
10184         a Simple_input_section object instead of Relobj pointer and section
10185         index as parameter.  Handle relaxed input sections.
10186         (Output_section::save_states, Output_section::restore_states): New
10187         method definitions.
10188         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10189         (Output_data::is_data_size_fixed): New method definition.
10190         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10191         if it is fixed.
10192         (Output_data::address_and_file_offset_have_reset_values): New method
10193         definition.
10194         (Output_data::do_address_and_file_offset_have_reset_values): New method
10195         definition.
10196         (Output_data::set_data_size): Check that data size is not fixed.
10197         (Output_data::fix_data_size): New method definition.
10198         (Output_data::is_data_size_fixed_): New data member.
10199         (Output_section_headers::set_final_data_size): New method definition.
10200         (Output_section_headers::do_size): New method declaration.
10201         (Output_segment_headers::set_final_data_size): New method definition.
10202         (Output_segment_headers::do_size): New method declaration.
10203         (Output_file_header::set_final_data_size)::New method definition.
10204         (Output_file_header::do_size)::New method declaration.
10205         (Output_section_data::Output_section_data): Add new parameter
10206         is_data_size_fixed and use it to fix data size.
10207         (Output_data_const::Output_data_const): Adjust call to base class
10208         constructor and fix data size.
10209         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10210         base class constructor and fix data size.
10211         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10212         base class constructor and fix data size.
10213         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10214         class constructor and fix data size.
10215         (Output_data_group::set_final_data_size): New method definition.
10216         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10217         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10218         class constructor and fix data size.
10219         (Output_relaxed_input_section): New class definition.
10220         (Output_section::Simple_input_section): New class definition.
10221         (Output_section::get_input_sections): Adjust parameter list.
10222         (Output_section::add_input_section_for_script): Same.
10223         (Output_section::save_states, Output_section::restore_states,
10224         Output_section::do_address_and_file_offset_have_reset_values,
10225         (Output_section::Input_section::Input_section): Handle
10226         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10227         Output_relaxed_input_section.
10228         (Output_section::Input_section::is_input_section,
10229         Output_section::Input_section::set_output_section): Handle relaxed
10230         input section.
10231         (Output_section::Input_section::is_relaxed_input_section,
10232         Output_section::Input_section::output_section_data,
10233         Output_section::Input_section::relaxed_input_section): New method
10234         definitions.
10235         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10236         value.
10237         (Output_section::Input_section::u1_): Update comments.
10238         (Output_section::Input_section::u2_): Add new union member poris.
10239         (Output_section::Checkpoint_output_section): New classs definition.
10240         (Output_section::relax_input_section): New method declaration.
10241         (Output_section::checkpoint_): New data member.
10242         (Output_segment): Update comments.
10243         (Output_segment::Output_segment): Un-privatize copy constructor.
10244         (Output_segment::operator=): Un-privatize.
10245         * script-sections.cc (Output_section_element::Input_section_list):
10246         Change element type to Output_section::Simple_input_section.
10247         (Output_section_element_dot_assignment::set_section_addresses):
10248         Register output section data for relaxation clean up.
10249         (Output_data_exression::Output_data_expression): Adjust call to base
10250         constructor to fix data size.
10251         (Output_section_element_data::set_section_addresses): Register
10252         Output_data_expression object for relaxation clean up.
10253         (struct Input_section_info): Replace Relobj pointer and section index
10254         pair with Output_section::Simple_input_section and Convert struct to a
10255         class.
10256         (Input_section_sorter::operator()): Adjust access to
10257         Input_section_info data member to use accessors.
10258         (Output_section_element_input::set_section_addresses): Use layout
10259         parameter.  Adjust code to use Output_section::Simple_input_section
10260         and Input_secction_info classes.  Register filler for relaxation
10261         clean up.
10262         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10263         and section index pair with Output_section::Simple_input_section
10264         class.  Adjust code accordingly.
10265         (Phdrs_element::release_segment): New method definition.
10266         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10267         segment list.
10268         (Script_sections::release_segments): New method definition.
10269         * gold/script-sections.h (Script_sections::release_segments): New
10270         method declaration.
10271         * gold/target.h (Target::may_relax, Target::relax,
10272         Target::do_may_relax, Target::do_relax): New method definitions.
10273
10274 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10275
10276         * arm.cc (has_signed_unsigned_overflow): New function.
10277         (Arm_relocate_functions::abs8): New function.
10278         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10279         (Target_arm::Scan::global): Likewise.
10280         (Target_arm::relocate::relocate): Likewise.
10281         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10282         Likewise.
10283
10284 2009-09-16  Cary Coutant  <ccoutant@google.com>
10285
10286         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10287         * testsuite/Makefile.in: Regenerate.
10288
10289 2009-09-11  Nick Clifton  <nickc@redhat.com>
10290
10291         * po/gold.pot: Updated by the Translation project.
10292
10293 2009-09-08  Cary Coutant  <ccoutant@google.com>
10294
10295         * output.cc (Output_file::open): Add execute permission to empty file.
10296         * testsuite/Makefile.am (permission_test): New test.
10297         * testsuite/Makefile.in: Regenerate.
10298
10299 2009-09-02  Ian Lance Taylor  <iant@google.com>
10300
10301         * output.cc (Output_file::resize): Call map_no_anonymous rather
10302         than map.
10303
10304 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10305
10306         * gold.cc: Include "incremental.h".
10307         (queue_initial_tasks): Call Incremental_checker methods.
10308         * incremental.cc: Include "output.h".
10309         (Incremental_checker::can_incrementally_link_output_file): New
10310         method.
10311         * incremental.h (Incremental_checker): New class.
10312
10313         * output.cc (Output_file::open_for_modification): New method.
10314         (Output_file::map_anonymous): Changed return type to bool.  Record
10315         map in base_ field.
10316         (Output_file::map_no_anonymous): New method, broken out of map.
10317         (Output_file::map): Use map_no_anonymous and map_anonymous.
10318         * output.h (class Output_file): Update declarations.
10319
10320 2009-08-24  Cary Coutant  <ccoutant@google.com>
10321
10322         * options.h (Command_line::Pre_options): New class.
10323         (Command_line::pre_options): New member.
10324         * options.cc (gold::options::ready_to_register): New variable.
10325         (One_option::register_option): Do nothing if not registering options.
10326         Assert if same short option registered twice.
10327         (General_options::General_options): Turn off option registration when
10328         done constructing.
10329         (Command_line::Pre_options::Pre_options): New constructor.
10330
10331 2009-08-24  Cary Coutant  <ccoutant@google.com>
10332
10333         * options.h (General_options::no_keep_memory): Remove incorrect
10334         short option.
10335
10336 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10337
10338         * Makefile.am (am__skiplex, am__skipyacc): New.
10339         * Makefile.in: Regenerate.
10340
10341 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10342
10343         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10344         (INCLUDES): ... this.
10345         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10346         (AM_CPPFLAGS): Renamed from ...
10347         (INCLUDE): ... this.
10348         * Makefile.in, testsuite/Makefile.in: Regenerate.
10349
10350         * Makefile.in: Regenerate.
10351         * aclocal.m4: Likewise.
10352         * config.in: Likewise.
10353         * configure: Likewise.
10354         * testsuite/Makefile.in: Likewise.
10355
10356         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10357         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10358         * Makefile.in: Regenerate.
10359         * testsuite/Makefile.in: Regenerate.
10360
10361 2009-08-19  Cary Coutant  <ccoutant@google.com>
10362
10363         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10364         symbols in shared libraries overridden by hidden or internal symbols
10365         in the main program.
10366
10367 2009-08-19  Chris Demetriou  <cgd@google.com>
10368
10369         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10370         checking source file names in error messages.
10371
10372 2009-08-18  Doug Kwan  <dougkwan@google.com>
10373
10374         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10375         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10376         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10377         an elfcpp::Ehdr as parameter.
10378         * object.cc (Object::set_target): Remove the version that looks up
10379         a target and sets it.
10380         (Sized_relobj::setup): Take a Target object instead of
10381         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10382         (make_elf_sized_object): Find target and ask target to
10383         make an ELF object.
10384         * object.h: (Object::set_target): Remove the version that looks up
10385         a target and sets it.
10386         (Sized_relobj::setup): Take a Target object instead of
10387         an elfcpp:Ehdr as parameter.
10388         * target.cc: Include dynobj.h.
10389         (Target::do_make_elf_object_implementation): New.
10390         (Target::do_make_elf_object): New.
10391         * target.h (Target::make_elf_object): New template declaration.
10392         (Target::do_make_elf_object): New method declarations.
10393         (Target::do_make_elf_object_implementation): New template declaration.
10394
10395 2009-08-14  Ian Lance Taylor  <iant@google.com>
10396
10397         * gold.h (FUNCTION_NAME): Define.
10398         (gold_unreachable): Use FUNCTION_NAME.
10399
10400 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10401
10402         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10403         symbol in the --keep-unique list is not found.
10404
10405 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10406
10407         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10408         been maked as --keep-unique.
10409         (Icf::unfold_section): New function.
10410         * icf.h (Icf::unfold_section): New function.
10411         * options.h (General_options::keep_unique): New option.
10412         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10413         * testsuite/Makefile.in: Regenerate.
10414         * testsuite/icf_keep_unique_test.sh: New file.
10415         * testsuite/icf_keep_unique_test.cc: New file.
10416
10417 2009-08-12  Cary Coutant  <ccoutant@google.com>
10418
10419         PR 10471
10420         * resolve.cc (Symbol_table::resolve): Check for references from
10421         dynamic objects to hidden and internal symbols.
10422         * testsuite/Makefile.am (hidden_test.sh): New test.
10423         * testsuite/Makefile.in: Regenerate.
10424         * testsuite/hidden_test.sh: New script.
10425         * testsuite/hidden_test_1.c: New test source.
10426         * testsuite/hidden_test_main.c: New test source.
10427
10428 2009-08-11  Doug Kwan  <dougkwan@google.com>
10429
10430         * arm.cc: Update comments.
10431         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10432         segment to locate the .ARM.exidx section if present.
10433
10434 2009-08-09  Doug Kwan  <dougkwan@google.com>
10435
10436         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10437         patch.
10438
10439 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10440         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10441         compiler warnings.
10442
10443 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10444
10445         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10446         valid tls_segment only for non-debug-section relocations.
10447         * testsuite/Makefile.am: Add gc_tls_test.
10448         * testsuite/Makefile.in: Regenerate.
10449         * testsuite/gc_tls_test.cc: New file.
10450         * testsuite/gc_tls_test.sh: New file.
10451
10452 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10453
10454         * icf.cc: New file.
10455         * icf.h: New file.
10456         * Makefile.am (CCFILES): Add icf.cc.
10457         (HFILES): Add icf.h
10458         * Makefile.in: Regenerate.
10459         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10460         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10461         section, symbol and addend information for the relocs.
10462         * gold.cc (queue_middle_tasks): Call identical code folding.
10463         * gold.h: Add defines for multimap.
10464         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10465         to the call of finalize_local_symbols.
10466         * main.cc (main): Create object of class Icf.
10467         * object.cc (Sized_relobj::do_layout): Allow this function to be
10468         called twice during icf.
10469         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10470         to sections marked as identical by icf.
10471         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10472         when available.
10473         (Sized_relobj::do_section_entsize): New function.
10474         * object.h (Object::section_entsize): New function.
10475         (Object::do_section_entsize): New pure virtual function.
10476         (Relobj::finalize_local_symbols): Add new parameter.
10477         (Relobj::do_section_entsize): New function.
10478         * options.h (General_options::icf): New option.
10479         (General_options::icf_iterations): New option.
10480         (General_options::print_icf_sections): New option.
10481         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10482         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10483         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10484         icf.
10485         * symtab.cc (Symbol_table::is_section_folded): New function.
10486         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10487         to sections marked as identical by icf.
10488         * symtab.h (Symbol_table::set_icf): New function.
10489         (Symbol_table::icf): New function.
10490         (Symbol_table::is_section_folded): New function.
10491         (Symbol_table::icf_): New data member.
10492         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10493         * testsuite/Makefile.am: Add commands to build icf_test.
10494         * testsuite/Makefile.in: Regenerate.
10495         * testsuite/icf_test.sh: New file.
10496         * testsuite/icf_test.cc: New file.
10497
10498 2009-07-24  Chris Demetriou  <cgd@google.com>
10499
10500         * layout.cc (is_compressible_debug_section): Fix incorrect
10501         comment about compressed section names.
10502
10503 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10504
10505         PR 10419
10506         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10507
10508 2009-07-16  Ian Lance Taylor  <iant@google.com>
10509
10510         PR 10400
10511         * layout.h: #include <map>.
10512         (class Kept_section): Change from struct to class.  Add accessors
10513         and setters.  Add section size to Comdat_group mapping.  Change
10514         Comdat_group to std::map.  Add is_comdat_ field.  Add
10515         linkonce_size field in union.
10516         (class Layout): Update declaration of find_or_add_kept_section.
10517         Don't declare find_kept_object.
10518         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10519         parameter.  Add object, shndx, is_comdat, and is_group_name
10520         parameters.  Change all callers.  Adjust for new Kept_section.
10521         (Layout::find_kept_object): Remove.
10522         * object.cc (Sized_relobj::include_section_group): Update use of
10523         Kept_section.  Rename secnum to shndx.  Only record
10524         Kept_comdat_section if sections are the same size.
10525         (Sized_relobj::include_linkonce_section): Update use of
10526         Kept_section.  Only record Kept_comdat_section if sections are the
10527         same size.  Set size of linkonce section.
10528         (Sized_relobj::map_to_kept_section): Update call to
10529         get_kept_comdat_section.
10530         * object.h (class Sized_relobj): Rename fields in
10531         Kept_comdat_section to drop trailing underscores; change object
10532         field to Relobj*.  Change Kept_comdat_section_table to store
10533         struct rather than pointer.
10534         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10535         Add kept_object and kept_shndx parameters.  Change all callers.
10536         (Sized_relobj::get_kept_comdat_section): Change return type to
10537         bool.  Add kept_object and kept_shndx parameters.  Change all
10538         callers.
10539         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10540         Layout::find_or_add_kept_section.
10541
10542 2009-07-09  Ian Lance Taylor  <iant@google.com>
10543
10544         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10545         Reserve space in the hash table.
10546
10547 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10548
10549         * fileread.cc (File_read::get_mtime): New method.
10550         * fileread.h (Timespec): New structure.
10551         (File_read::get_mtime): New method.
10552         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10553         Renamed from timestamp_nsec.
10554         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10555         Elf_Xword.
10556         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10557         timestamp_nsec.
10558         (Incremental_inputs::report_archive): Save mtime; style fix.
10559         (Incremental_inputs::report_obejct): Save mtime; style fix.
10560         (Incremental_inputs::report_script): Save mtime; style fix.
10561         (Incremental_inputs::finalize_inputs): Style fix.
10562         (Incremental_inputs::finalize): Style fix.
10563         (Incremental_inputs::create_input_section_data): Store inputs
10564         mtime.
10565         * incremental.h (Incremental_inputs::report_script): Add mtime
10566         argument.
10567         (Incremental_inputs::Input_info::Input_info): Intialize only one
10568         union member.
10569         (Incremental_inputs::Input_info::archive): Move to nameless
10570         union.
10571         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10572         (Incremental_inputs::Input_info::script): Move to nameless union.
10573         (Incremental_inputs::mtime): New field.
10574         * script.cc (read_input_script): Pass file mtime to
10575         Incremental_input.
10576         * script.h (Script_info::inputs): Style fix.
10577
10578 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10579
10580         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10581         instead of 32.
10582
10583 2009-06-24  Ian Lance Taylor  <iant@google.com>
10584
10585         PR 10156
10586         * layout.cc (Layout::choose_output_section): If we find an
10587         existing section, update the flags.
10588         (Layout::create_notes): New function, broken out of
10589         Layout::finalize.
10590         (Layout::finalize): Don't create note sections.
10591         (Layout::create_note): Don't crash if linker script discards
10592         section.
10593         (Layout::create_gold_note): Likewise.
10594         (Layout::create_build_id): Likewise.  Don't set
10595         after_input_sections on the section.
10596         (Layout::create_executable_stack_info): Remove target parameter.
10597         Change caller.
10598         * layout.h (class Layout): Declare create_notes.  Update
10599         declaration of create_executable_stack_info.
10600         * gold.cc (queue_middle_tasks): Call create_notes.
10601         * output.cc (Output_section::update_flags_for_input_section): Move
10602         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10603         invalid.
10604         * output.h (Output_data::mark_address_invalid): New function.
10605         (class Output_section): Only declare, not define,
10606         update_flags_for_input_section.  Remove set_flags.
10607
10608 2009-06-24  Ian Lance Taylor  <iant@google.com>
10609
10610         * script-sections.cc (Output_section_definition::
10611         set_section_addresses): Rename shadowing local load_address to
10612         laddr.
10613
10614 2009-06-24  Ian Lance Taylor  <iant@google.com>
10615
10616         PR 10244
10617         * reloc.cc (relocate_sections): Skip empty relocation sections.
10618
10619 2009-06-23  Ian Lance Taylor  <iant@google.com>
10620
10621         PR 10156
10622         * layout.cc (Layout::create_note): Use choose_output_section
10623         rather than make_output_section.
10624
10625 2009-06-23  Ian Lance Taylor  <iant@google.com>
10626
10627         PR 10237
10628         * options.cc (General_options::parse_V): Set printed_version_.
10629         (General_options::General_options): Initialize printed_version_.
10630         * options.h (class General_options): Add printed_version_ field.
10631         * gold.cc (queue_initial_tasks): If there are no input files,
10632         don't give a fatal error if we printed the version information.
10633         (queue_middle_tasks): If using -r with a shared object, give a
10634         fatal error rather than an ordinary error.
10635
10636 2009-06-23  Ian Lance Taylor  <iant@google.com>
10637
10638         PR 10219
10639         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10640         (Layout::make_output_section): Set have_stabstr_section_ if we see
10641         a .stab*str section.
10642         (Layout::finalize): Call link_stabs_sections.
10643         (Layout::link_stabs_sections): New file.
10644         * layout.h (class Layout): Add have_stabstr_section_ field.
10645         Declare link_stabs_sections.
10646
10647 2009-06-23  Doug Kwan  <dougkwan@google.com>
10648
10649         * Makefile.am (libgold_a_LIBADD): New.
10650         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10651         * Makefile.in: Regenerate.
10652         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10653         * configure: Regenerate.
10654         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10655         * fileread.cc: Include sys/state.h
10656         * gold.h: Declare memmem and strndup if found missing.
10657         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10658
10659 2009-06-23  Ian Lance Taylor  <iant@google.com>
10660
10661         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10662         * configure: Rebuild.
10663
10664 2009-06-23  Ian Lance Taylor  <iant@google.com>
10665
10666         PR 10147
10667         * object.cc (Object::section_contents): Don't try to get a view if
10668         the section has length zero.
10669         (Object::handle_gnu_warning_section): If the section is empty, use
10670         the name of the section as the warning.
10671
10672 2009-06-23  Ian Lance Taylor  <iant@google.com>
10673
10674         PR 10133
10675         * stringpool.h (class Stringpool_template): Add optimize_ field.
10676         (Stringpool_template::set_optimize): New function.
10677         * stringpool.cc (Stringpool_template::Stringpool_template):
10678         Initialize optimize_ field.
10679         (Stringpool_template::set_string_offsets): Test local optimize
10680         fild rather than parameter.
10681         * layout.cc (Layout::Layout): Call set_optimize on the section
10682         name stringpool.
10683
10684 2009-06-22  Ian Lance Taylor  <iant@google.com>
10685
10686         PR 10030
10687         * yyscript.y: Parse TARGET.
10688         * script.cc (script_set_target): New function.
10689         * script-c.h (script_set_target): Declare.
10690         * options.cc (General_options::string_to_object_format): Rename
10691         from string_to_object_format in anonymous namespace.  Change
10692         callers.
10693         * options.h (class General_options): Declare
10694         string_to_object_format.
10695
10696 2009-06-22  Ian Lance Taylor  <iant@google.com>
10697
10698         * script-sections.cc (Script_sections::create_segments): Don't put
10699         program headers in a PT_LOAD segment if -n or -N.
10700
10701 2009-06-22  Ian Lance Taylor  <iant@google.com>
10702
10703         PR 10141
10704         * options.h (class General_options): Add -z lazy and -z now.  Sort
10705         -z options into alphabetical order.
10706         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10707
10708 2009-06-21  Ian Lance Taylor  <iant@google.com>
10709
10710         * layout.cc (Layout::make_output_section): Call
10711         Target::new_output_section.
10712         (Layout::attach_allocated_section_to_segment): Put large section
10713         sections in a separate load segment with the large segment flag
10714         set.
10715         (Layout::segment_precedes): Sort large data segments after other
10716         load segments.
10717         (align_file_offset): New static function.
10718         (Layout::set_segment_offsets): Use align_file_offset.
10719         * output.h (class Output_section): Add is_small_section_ and
10720         is_large_section_ fields.
10721         (Output_section::is_small_section): New function.
10722         (Output_section::set_is_small_section):  New function.
10723         (Output_section::is_large_section): New function.
10724         (Output_section::set_is_large_section): New function.
10725         (Output_section::is_large_data_section): New function.
10726         (class Output_segment): Add is_large_data_segment_ field.
10727         (Output_segment::is_large_data_segment): New function.
10728         (Output_segment::set_is_large_data_segment): New function.
10729         * output.cc (Output_section::Output_section): Initialize new
10730         fields.
10731         (Output_segment::Output_segment): Likewise.
10732         (Output_segment::add_output_section): Add assertion that large
10733         data sections always go in large data segments.  Force small data
10734         sections to the end of the list of data sections.  Force small BSS
10735         sections to the start of the list of BSS sections.  For large BSS
10736         sections to the end of the list of BSS sections.
10737         * symtab.h (class Symbol): Declare is_common_shndx.
10738         (Symbol::is_defined): Check Symbol::is_common_shndx.
10739         (Symbol::is_common): Likewise.
10740         (class Symbol_table): Define enum Commons_section_type.  Update
10741         declarations.  Add small_commons_ and large_commons_ fields.
10742         * symtab.cc (Symbol::is_common_shndx): New function.
10743         (Symbol_table::Symbol_table): Initialize new fields.
10744         (Symbol_table::add_from_object): Put small and large common
10745         symbols in the right list.
10746         (Symbol_table::sized_finalized_symbol): Check
10747         Symbol::is_common_shndx.
10748         (Symbol_table::sized_write_globals): Likewise.
10749         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10750         common symbol lists.  Don't call do_allocate_commons_list if the
10751         list is empty.
10752         (Symbol_table::do_allocate_commons_list): Remove is_tls
10753         parameter.  Add comons_section_type parameter.  Change all
10754         callers.  Handle small and large common symbols.
10755         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10756         Symbol::is_common_shndx.
10757         * resolve.cc (symbol_to_bits): Likewise.
10758         * target.h (Target::small_common_shndx): New function.
10759         (Target::small_common_section_flags): New function.
10760         (Target::large_common_shndx): New function.
10761         (Target::large_common_section_flags): New function.
10762         (Target::new_output_section): New function.
10763         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10764         small_common_section_flags, and large_common_section_flags
10765         fields.
10766         (Target::do_new_output_section): New virtual function.
10767         * arm.cc (Target_arm::arm_info): Initialize new fields.
10768         * i386.cc (Target_i386::i386_info): Likewise.
10769         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10770         Likewise.
10771         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10772         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10773         (Target_x86_64::do_new_output_section): New function.
10774         * configure.ac: Define conditional MCMODEL_MEDIUM.
10775         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10776         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10777         (large_LDFLAGS): Define.
10778         * testsuite/large.c: New file.
10779         * testsuite/testfile.cc (Target_test::test_target_info):
10780         Initialize new fields.
10781         * configure, testsuite/Makefile.in: Rebuild.
10782
10783 2009-06-05  Doug Kwan  <dougkwan@google.com>
10784
10785         * Makefile.am (CCFILES): Add target.cc.
10786         * Makefile.in: Regenerate.
10787         * i386.cc (class Target_i386): Define new virtual method to
10788         override do_is_local_label_name in parent.
10789         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10790         local symbols if --discard-locals or -X is given.
10791         * options.h (class General_options): Declare new options
10792         '--discard-locals' and '-X' for discarding locals.
10793         * target.h (class Target): Define new methods is_local_label_name.
10794         Declare new virtual method do_is_local_label_name.
10795         * target.cc: New file.
10796         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10797         (check_SCRIPTS): Add discard_locals_test.sh.
10798         (check_DATA): Add discard_local_tests.syms.
10799         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10800         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10801         * testsuite/Makefile.in: Regenerate.
10802         * testsuite/discard_locals_test.c: New file.
10803         * testsuite/discard_locals_test.sh: Same.
10804
10805 2009-06-05  Doug Kwan  <dougkwan@google.com>
10806
10807         * object.cc (Sized_relobj::Sized_relobj): Initialize
10808         discarded_eh_frame_shndx_ to -1U.
10809         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10810         section.
10811         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10812         a discarded .eh_frame section.
10813         (Sized_relobj::do_finalize_local_symbols): Ditto.
10814         * object.h (class Sized_relobj): Declare new member
10815         discarded_eh_frame_shndx_.
10816         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10817         (local_labels_test.o, local_labels_test): New rules.
10818         * testsuite/Makefile.in: Regenerate.
10819
10820 2009-06-04  Doug Kwan  <dougkwan@google.com>
10821
10822         * layout.cc (Layout::section_name_mapping): Add mapping for
10823         special ARM sections.
10824
10825 2009-06-03  Doug Kwan  <dougkwan@google.com>
10826
10827         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10828         (utils::has_overflow): Same.
10829
10830 2009-06-03  Ian Lance Taylor  <iant@google.com>
10831
10832         * layout.cc (Layout::section_name_mapping): New array, replacing
10833         Layout::linkonce_mapping.
10834         (Layout::section_name_mapping_count): New variable, replacing
10835         Layout::linkonce_mapping_count.
10836         (Layout::linkonce_output_name): Remove.
10837         (Layout::output_section_name): Rewrite.
10838         * layout.h (class Layout): Rename Linkonce_mapping to
10839         Section_name_mapping, linkonce_mapping to section_name_mapping,
10840         linkonce_mapping_count to section_name_mapping_count.  Don't
10841         declare linkonce_output_name.
10842
10843 2009-06-03  Doug Kwan  <dougkwan@google.com>
10844
10845         * gold/arm.cc (namespace utils): New.
10846         (Target_arm::reloc_is_non_pic): Define new method.
10847         (class Arm_relocate_functions): New.
10848         (Target_arm::Relocate::relocate): Handle relocation types used by
10849         Android.
10850
10851 2009-06-03  Ian Lance Taylor  <iant@google.com>
10852
10853         * arm.cc (Target_arm::scan::global): Use || instead of |.
10854
10855 2009-06-02  Doug Kwan  <dougkwan@google.com>
10856
10857         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10858         issued_non_pic_error_.
10859         (class Target_arm::Scan): Declare new method check_non_pic.
10860         Define new method symbol_needs_plt_entry.
10861         Declare new data member issued_non_pic_error_.
10862         (class Target_arm::Relocate): Declare new method
10863         should_apply_static_reloc.
10864         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10865         (Target_arm::Scan::check_non_pic): Define new method.
10866         (Target_arm::Scan::local): Handle a small subset of reloc types used
10867         by Android.
10868         (Target_arm::Scan::local): Same.
10869         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10870
10871 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10872
10873         * incremental.cc (Incremental_inputs::report_command_line): Filter
10874         out --incremental-* options.
10875
10876 2009-05-29  Doug Kwan  <dougkwan@google.com>
10877
10878         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10879         template class.
10880         (class Target_arm): Update comment.
10881         (Target_arm::Target_arm): Initialize new data members GOT_,
10882         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10883         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10884         and Target_arm::rel_dyn_section.
10885         Declare new_enum Target_arm::Got_type.
10886         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10887         and DYNBSS_.
10888         Update commments for member do_dynsym_value.
10889         (Target_arm::got_size, Target_arm::plt_section,
10890         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10891         new methods inside class defintion.
10892         (Target_arm::got_section): Define new method.
10893         (Target_arm::rel_dyn_section): Same.
10894         (Output_data_plt_arm): New template class.
10895         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10896         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10897         (Output_data_plt_arm::add_entry): Same.
10898         (Output_data_plt_arm::first_plt_entry): Define new
10899         static data member for PLT instruction template.
10900         (Output_data_plt_arm::plt_entry): Same.
10901         (Output_data_plt_arm::do_write): Define new method.
10902         (Target_arm::make_plt_entry): Same.
10903         (Target_arm::do_finalize_sections): Same.
10904         (Target_arm::do_dynsym_value): Same.
10905
10906 2009-05-28  Doug Kwan  <dougkwan@google.com>
10907
10908         * Makefile.am (TARGETSOURCES): Add arm.cc.
10909         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10910         * Makefile.in: Regenerate.
10911         * arm.cc: New file.
10912         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10913
10914 2009-05-26  Doug Kwan  <dougkwan@google.com>
10915
10916         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10917         (General_options::check_excluded_libs): Strip off directories in
10918         archive name before matching like GNU ld does.
10919         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10920         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10921         (exclude_libs_test_LDFLAGS): Add linker option
10922         -Wl,--exclude-libs,libexclude_libs_test_3
10923         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10924         an explicit archive without using -l.
10925         (alt/libexclude_libs_test_3.a): New make rule.
10926         * testsuite/Makefile.in: Regenerate.
10927         * testsuite/exclude_libs_test.c : Declare lib3_default().
10928         (main): Call it.
10929         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10930         * exclude_libs_test_3.c: New file.
10931
10932 2009-05-26  Nick Clifton  <nickc@redhat.com>
10933
10934         * po/id.po: New Indonesian translation.
10935         * po/gold.pot: Updated template file.
10936
10937 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10938
10939         * testsuite/Makefile.am: Add -ffunction-sections to compile
10940         gc_comdat_test files.  Add -Wl,--gc-sections to build
10941         gc_comdat_test.
10942         * testsuite/Makefile.in: Regenerate.
10943         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10944
10945 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10946
10947         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10948         kept comdat section was garbage collected.
10949         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10950         * testsuite/Makefile.in: Regenerate.
10951         * testsuite/gc_comdat_test.sh: New file.
10952         * testsuite/gc_comdat_test_1.cc: New file.
10953         * testsuite/gc_comdat_test_2.cc: New file.
10954
10955 2009-05-19  Doug Kwan  <dougkwan@google.com>
10956
10957         * archive.cc (Archive::Archive): Move constructor from archive.h
10958         to here.  Initialize no_export_.
10959         (Archive::get_elf_object_for_member): Set no_export flag of object.
10960         * archive.h (Archive::Archive): Move constructor body to
10961         archive.cc.
10962         (Archive::no_export): New method.
10963         (Archive::no_export_): New field.
10964         * object.h (Object::Object): Initialize no_export_ to false.
10965         (Object::no_export, Object::set_no_export): New methods.
10966         (Object::no_export_): New field.
10967         * options.cc (General_options::parse_exclude_libs): New method.
10968         (General_options::check_excluded_libs) Same.
10969         * options.h (exclude_libs): New option.
10970         (General_options::check_excluded_libs): New method declaration.
10971         (General_options::excluded_libs_): New field.
10972         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10973         default or protected visibility if an object has no-export flag set.
10974         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10975         (check_SCRIPTS): Add exclude_libs_test.sh.
10976         (check_DATA): Add exclude_libs_test.syms.
10977         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10978         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10979         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10980         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
10981         (exclude_libs_test.syms, libexclude_libs_test_1.a,
10982         libexclude_libs_test_2.a): New rules.
10983         * testsuite/Makefile.in: Regenerate.
10984         * testsuite/exclude_libs_test.c: New file.
10985         * testsuite/exclude_libs_test.sh: Ditto.
10986         * testsuite/exclude_libs_test_1.c: Ditto.
10987         * testsuite/exclude_libs_test_2.c: Ditto.
10988
10989 2009-05-15  Ian Lance Taylor  <iant@google.com>
10990
10991         * configure.ac: Check for declarations for cases where libiberty.h
10992         checks HAVE_DECL_xxx.
10993         * configure, config.in: Rebuild.
10994
10995 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
10996
10997         * gold.h (Incremental_argument_list): Remove (invalid) forward
10998         declaration.
10999         * incremental.cc (Incremental_inputs::report_achive): New method.
11000         (Incremental_inputs::report_object): New method.
11001         (Incremental_inputs::report_script): New method.
11002         (Incremental_inputs::finalize_inputs): New method.
11003         (Incremental_inputs::finalize): Call finalize_inputs().
11004         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11005         Create inputs entries.
11006         * incremental.h (Incremental_input_type): New enum.
11007         (Incremental_inputs::Incremental_input): Initialize new fields.
11008         (Incremental_inputs::report_inputs): New method.
11009         (Incremental_inputs::report_achive): New method.
11010         (Incremental_inputs::report_object): New method.
11011         (Incremental_inputs::report_script): New method.
11012         (Incremental_inputs::finalize_inputs): New method.
11013         (Incremental_inputs::Input_info): New struct.
11014         (Incremental_inputs::Input_info_map): New typedef.
11015         (Incremental_inputs::lock_): New field.
11016         (Incremental_inputs::Inputs_): New field.
11017         (Incremental_inputs::Inputs_map): New field.
11018         * main.cc (main): Call Incremental_input::report_inputs.
11019         * options.h (Input_argument_list): Typedef moved from
11020         Input_arguments.
11021         (Input_file_group::Files): Remove, use ::Input_argument_list.
11022         (Input_file_group::Input_argument_list): Remove, use
11023         ::Input_argument_list.
11024         * plugin.cc (Plugin_manager::add_input_file): Add error in
11025         incremental build.
11026         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11027         functions.
11028         * script.cc (read_input_script): Call
11029         Incremental_input::report_script.
11030         * script.h (Script_info): New class.
11031
11032 2009-04-27  Ian Lance Taylor  <iant@google.com>
11033
11034         * x86_64.cc (do_adjust_output_section): Set entsize to
11035         plt_entry_size.
11036
11037 2009-04-23  Elliott Hughes  <enh@google.com>
11038
11039         * output.cc (Output_file::close): After short writes, continue
11040         writing from the correct offset in the buffer being written.
11041
11042 2009-04-23  Chris Demetriou  <cgd@google.com>
11043
11044         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11045         * configure: Regenerate.
11046         * config.in: Regenerate.
11047         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11048         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11049
11050 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11051
11052         * incremental.cc (Incremental_inputs_header_data): Renamed from
11053         Incremental_input_header_data.
11054         (Incremental_inputs_header_data::data_size): New field.
11055         (Incremental_inputs_header_data::put_input_file_count): Renamed
11056         from input_file_count.
11057         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11058         from command_line_offset.
11059         (Incremental_inputs_header_data::put_reserved): Renamed from
11060         put_reserved.
11061         (Incremental_inputs_entry_data): Renamed from
11062         Incremental_input_entry_data.
11063         (Incremental_inputs_entry_data::data_size): New field.
11064         (Incremental_inputs::report_command_line): New method.
11065         (Incremental_inputs::finalize): New method.
11066         (Incremental_inputs::create_incremental_inputs_data): New method.
11067         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11068         * incremental.h: New file.
11069         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11070         (Layout::finalize): Create incremental inputs section in
11071         incremental builds.
11072         (Layout::create_incremental_info_sections): New method.
11073         * layout.h (Layout::incremental_inputs): New method.
11074         (Layout::create_incremental_info_sections): New method.
11075         (Layout::incremental_inputs_): New field.
11076         * main.cc (main): Notify Incremental_input of the command line.
11077
11078 2009-04-01  Ian Lance Taylor  <iant@google.com>
11079             Mikolaj Zalewski  <mikolajz@google.com>
11080
11081         * gold.h (reserve_unordered_map): Define, three versions, one for
11082         each version of Unordered_map.
11083         * layout.cc (Layout::Layout): Remove options parameter.  Add
11084         number_of_input_files parameter.  Don't initialize options_.
11085         Initialize number_of_input_files_ and resized_signatures_.  Move
11086         sections_are_attached_.
11087         (Layout::layout_group): Reserve space for group_signatures_.
11088         (Layout::find_or_add_kept_section): Change name parameter to be a
11089         reference.  Resize signatures_ map when it gets large enough.
11090         (Layout::layout_eh_frame): Use parameters->options() instead of
11091         this->options_.
11092         (Layout::make_output_section): Likewise.
11093         (Layout::attach_allocated_section_to_segment): Likewise.
11094         (Layout::finalize, Layout::create_executable_stack): Likewise.
11095         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11096         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11097         * layout.h (class Layout): Update declarations.  Remove options_
11098         field.  Add number_of_input_files_ and resized_signatures_
11099         fields.  Move sections_are_attached_ field.
11100         * main.cc (main): Pass number of input files to Layout
11101         constructor.  Don't pass options.
11102
11103 2009-03-30  Ian Lance Taylor  <iant@google.com>
11104
11105         * ffsll.c (ffsll): Correct implementation.
11106
11107 2009-03-27  Ian Lance Taylor  <iant@google.com>
11108
11109         * ffsll.c: New file.
11110         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11111         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11112         * ftruncate.c (ftruncate): Declare before definition.
11113         * mremap.c (mremap): Likewise.
11114         * pread.c (pread): Likewise.
11115         * configure, Makefile.in, config.in: Rebuild.
11116
11117         * mremap.c: New file.
11118         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11119         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11120         (mremap): Declare if HAVE_MREMAP is not defined.
11121         * configure, Makefile.in, config.in: Rebuild.
11122
11123 2009-03-27  Cary Coutant  <ccoutant@google.com>
11124
11125         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11126         position independent.
11127         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11128         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11129
11130 2009-03-24  Cary Coutant  <ccoutant@google.com>
11131
11132         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11133         an executable.
11134         (needs_dynamic_reloc): Likewise.
11135
11136 2009-03-24  Ian Lance Taylor  <iant@google.com>
11137
11138         * yyscript.y (file_cmd): Recognize EXTERN.
11139         (extern_name_list, extern_name_list_body): New nonterminals.
11140         * script.cc (script_add_extern): Define.
11141         * script-c.h (script_add_extern): Declare.
11142
11143 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11144
11145         * object.cc (is_elf_object): Define.
11146         * object.h (is_elf_object): Declare.
11147         * archive.cc (Archive::get_elf_object_for_member): Call
11148         is_elf_object.
11149         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11150
11151 2009-03-24  Elliott Hughes  <enh@google.com>
11152
11153         * output.cc (Output_file::map_anonymous): Define.
11154         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11155         try an anonymous one.  Report the size if the mmap fails.
11156         * output.h (class Output_file): Declare map_anonymous.
11157
11158 2009-03-24  Ian Lance Taylor  <iant@google.com>
11159
11160         * target-select.cc (instantiate_target): Don't acquire the lock if
11161         the instantiated_target_ field has already been set.
11162
11163 2009-03-23  Ian Lance Taylor  <iant@google.com>
11164
11165         * gold-threads.h (class Initialize_lock): Define.
11166         * gold-threads.cc (class Initialize_lock_once): Define.
11167         (initialize_lock_control): New static variable.
11168         (initialize_lock_pointer): New static variable.
11169         (initialize_lock_once): New static function.
11170         (Initialize_lock::Initialize_lock): Define.
11171         (Initialize_lock::initialize): Define.
11172         * target-select.h: Include "gold-threads.h".
11173         (class Target_selector): Add lock_ and initialize_lock_ fields.
11174         Don't define instantiate_target, just declare it.
11175         * target-select.cc (Target_selector::Target_selector): Initialize
11176         new fields.
11177         (Target_selector::instantiate_target): Define.
11178         * descriptors.h: Include "gold-threads.h".
11179         (class Descriptors): Add initialize_lock_ field.
11180         * descriptors.cc (Descriptors::Descriptors): Initialize new
11181         field.
11182         (Descriptors::open): Use initialize_lock_ field
11183         * errors.h (class Errors): Add initialize_lock_ field.
11184         * errors.cc (Errors::Errors): Initialize new field.
11185         (Errors::initialize_lock): Use initialize_lock_ field.
11186         * powerpc.cc (class Target_selector_powerpc): Remove
11187         instantiated_target_ field.  In do_recognize call
11188         instantiate_target rather than do_instantiate_target.  In
11189         do_instantiate_target just allocate a new target.
11190         * sparc.cc (class Target_selector_sparc): Likewise.
11191
11192         * freebsd.h: New file.
11193         * i386.cc: Include "freebsd.h".
11194         (Target_i386): Derive from Target_freebsd rather than
11195         Sized_target.
11196         (Target_selector_i386): Derive from Target_selector_freebsd rather
11197         than Target_selector.
11198         * x86_64.cc: Include "freebsd.h".
11199         (Target_x86_64): Derive from Target_freebsd rather than
11200         Sized_target.
11201         (Target_selector_x86_64): Derive from Target_selector_freebsd
11202         rather than Target_selector.
11203         * target.h (class Target): Add adjust_elf_header and
11204         do_adjust_elf_header.
11205         * output.cc (Output_file_header:: do_sized_write): Call target
11206         adjust_elf_header routine.
11207         * configure.tgt: Set targ_osabi.
11208         * configure.ac: Define GOLD_DEFAULT_OSABI.
11209         * parameters.cc (Parameters::default_target): Pass
11210         GOLD_DEFAULT_OSABI to select_target.
11211         * target-select.h (class Target_selector): Make instantiate_target
11212         protected rather than private.
11213         * Makefile.am (HFILES): Add freebsd.h.
11214         * configure, Makefile.in, config.in: Rebuild.
11215
11216         * merge.cc (do_add_input_section): Correct pend value.  Change
11217         message about last entry not being null terminated from error to
11218         warning.
11219
11220 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11221
11222         * incremental.cc: New file.
11223         * Makefile.am (CCFILES): Add incremental.cc.
11224         * Makefile.in: Rebuild.
11225
11226 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11227
11228         * layout.cc (Layout::output_section_name): Preserve names
11229         of '.note.' sections.
11230
11231 2009-03-19  Ian Lance Taylor  <iant@google.com>
11232
11233         * descriptors.cc (Descriptors::open): Check that the options are
11234         valid before using them.
11235
11236 2009-03-18  Ian Lance Taylor  <iant@google.com>
11237
11238         * script-sections.h: Include <list>.
11239         (class Script_sections): Change Sections_elements from std::vector
11240         to std::list.  Typedef public Elements_iterator.  Add
11241         orphan_section_placement_, data_segment_align_start_, and
11242         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11243         field.
11244         * script-sections.cc (class Orphan_section_placement): New class.
11245         (class Sections_element): Add virtual functions is_relro and
11246         orphan_section_init.  Remove virtual function place_orphan_here.
11247         (class Output_section_definition): Add is_relro and
11248         orphan_section_init.  Remove place_orphan_here.
11249         (class Orphan_output_section): Likewise.
11250         (Script_sections::Script_sections): Update for field changes.
11251         (Script_sections::data_segment_align): Set saw_data_segment_align_
11252         and data_segment_align_start_, not data_segment_align_index.
11253         (Script_sections::data_segment_relro_end): Check
11254         saw_data_segment_align_.  Use data_segment_align_start_ rather
11255         than data_segment_align_index_.
11256         (Script_sections::place_orphan): Rewrite to use
11257         Orphan_section_placement.
11258
11259 2009-03-17  Ian Lance Taylor  <iant@google.com>
11260
11261         * archive.cc (Archive::add_symbols): Check for a version attached
11262         to the symbol name in the archive map.
11263         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11264         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11265         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11266         (ver_test_11.a): New target.
11267         * testsuite/Makefile.in: Rebuild.
11268
11269         * configure.ac: Check for chsize and posix_fallocate.  Replace
11270         ftruncate.
11271         * ftruncate.c: New file, from gnulib.
11272         * output.cc (posix_fallocate): Define dummy version if not
11273         HAVE_POSIX_FALLOCATE.
11274         (Output_file::map): Call posix_fallocate rather than lseek and
11275         write.
11276         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11277         * configure, Makefile.in, config.in: Rebuild.
11278
11279 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11280
11281         * layout.h (Layout::create_note): Add section_name parameter.
11282         * layout.cc (Layout::create_note): Likewise.
11283         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11284
11285 2009-03-17  Ian Lance Taylor  <iant@google.com>
11286
11287         * descriptors.cc: Include "options.h".
11288         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11289         (Descriptors::open): Always use O_CLOEXEC when opening a new
11290         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11291         then set FD_CLOEXEC.
11292
11293         * sparc.cc (class Target_sparc): Add has_got_section.
11294         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11295         make sure we have a GOT section.
11296
11297         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11298         (Target_sparc::Scan::local): Likewise.
11299         (Target_sparc::Scan::global): Likewise.
11300         (Target_sparc::Relocate::relocate): Likewise.
11301         (Target_sparc::Relocate::relocate_tls): Likewise.
11302
11303         * symtab.cc (Symbol_table::define_default_version): New function,
11304         broken out of add_from_object.
11305         (Symbol_table::add_from_object): Call define_default_version.
11306         (Symbol_table::define_special_symbol): Add resolve_oldsym
11307         parameter.  Change all callers.  If the version for a symbol comes
11308         from a version script, resolve it with the symbol with the same
11309         name with no version.  Also add the symbol without a version if
11310         appropriate.
11311         (do_define_in_output_data): If resolving with oldsym, don't delete
11312         sym.
11313         (do_define_in_output_segment): Likewise.
11314         (do_define_as_constant): Likewise.
11315         * symtab.h (class Symbol_table): Update declarations.
11316
11317 2009-03-13  Ian Lance Taylor  <iant@google.com>
11318
11319         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11320         (Read_symbols::requeue): New function.
11321         (Read_symbols::do_read_symbols): If make_elf_object fails because
11322         the target type is not configured, and the file was searched for,
11323         issue a warning and retry with the next directory.
11324         (Add_symbols::run): If the file has an incompatible format, and
11325         it was searched for, requeue the Read_symbols task.  On error,
11326         release the object.
11327         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11328         dirindex parameter to constructor.  Change all callers.  Declare
11329         incompatible_warning and requeue.
11330         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11331         input_argument_ and input_group_ fields.  Add them to
11332         constructor.  Change all callers.
11333         (class Read_script): Add dirindex_ field.  Add it to constructor.
11334         Change all callers.
11335         * archive.cc (Archive::setup): Remove input_objects parameter.
11336         Change all callers.
11337         (Archive::get_file_and_offset): Likewise.
11338         (Archive::read_all_symbols): Likewise.
11339         (Archive::read_symbols): Likewise.
11340         (Archive::get_elf_object_for_member): Remove input_objects
11341         parameter.  Add punconfigured parameter.  Change all callers.
11342         (Archive::add_symbols): Change return type to bool.  Check return
11343         value of include_member.
11344         (Archive::include_all_members): Likewise.
11345         (Archive::include_member): Change return type to bool.  Return
11346         false if first included object has incompatible target.  Set
11347         included_member_ field.
11348         (Add_archive_symbols::run): If add_symbols returns false, requeue
11349         Read_symbols task.
11350         * archive.h (class Archive): Add included_member_ field.
11351         Initialize it in constructor.  Add input_file and searched_for
11352         methods.  Update declarations.
11353         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11354         input_argument_ fields.  Add them to constructor.  Change all
11355         callers.
11356         * script.cc: Include "target-select.h".
11357         (class Parser_closure): Add skip_on_incompatible_target_ and
11358         found_incompatible_target_ fields.  Add
11359         skip_on_incompatible_target parameter to constructor.  Change all
11360         callers.  Add methods skip_on_incompatible_target,
11361         clear_skip_on_incompatible_target, found_incompatible_target, and
11362         set_found_incompatible_target.
11363         (read_input_script): Add dirindex parameter.  Change all callers.
11364         If parser finds an incompatible target, requeue Read_symbols
11365         task.
11366         (script_set_symbol): Clear skip_on_incompatible_target in
11367         closure.
11368         (script_add_assertion, script_parse_option): Likewise.
11369         (script_start_sections, script_add_phdr): Likewise.
11370         (script_check_output_format): New function.
11371         * script.h (read_input_script): Update declaration.
11372         * script-c.h (script_check_output_format): Declare.
11373         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11374         (ignore_cmd): Remove OUTPUT_FORMAT.
11375         * fileread.cc (Input_file::Input_file): Add explicit this.
11376         (Input_file::will_search_for): New function.
11377         (Input_file::open): Add pindex parameter.  Change all callers.
11378         * fileread.h (class Input_file): Add input_file_argument method.
11379         Declare will_search_for.  Update declarations.
11380         * object.cc (make_elf_object): Add punconfigured parameter.
11381         Change all callers.
11382         * object.h (class Object): Make input_file public.  Add
11383         searched_for method.
11384         (make_elf_object): Update declaration.
11385         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11386         restart search.
11387         * dirsearch.h (class Dirsearch): Update declaration.
11388         * options.h (class General_options): Add --warn-search-mismatch.
11389         * parameters.cc (Parameters::is_compatible_target): New function.
11390         * parameters.h (class Parameters): Declare is_compatible_target.
11391         * workqueue.cc (Workqueue::add_blocker): New function.
11392         * workqueue.h (class Workqueue): Declare add_blocker.
11393
11394         * fileread.cc (Input_file::open): Remove options parameter.
11395         Change all callers.
11396         (Input_file::open_binary): Likewise.
11397         * script.cc (read_input_script): Likewise.
11398         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11399         options parameter from constructor.  Change all callers.
11400         (class Read_script): Likewise.
11401         * fileread.h (class Input_file): Update declarations.
11402         * script.h (read_input_script): Update declaration.
11403
11404 2009-03-10  Nick Clifton  <nickc@redhat.com>
11405
11406         * po/es.po: New Spanish translation.
11407
11408 2009-03-06  Cary Coutant  <ccoutant@google.com>
11409
11410         * options.cc (parse_short_option): Keep dash_z from registering itself.
11411
11412 2009-03-03  Ian Lance Taylor  <iant@google.com>
11413
11414         PR 9918
11415         * target-reloc.h (relocate_section): Pass output_section to
11416         relocate.
11417         * i386.cc (Target_i386::should_apply_static_reloc): Add
11418         output_section parameter.  Change all callers.
11419         (Target_i386::Relocate::relocate): Add output_section parameter.
11420         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11421         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11422         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11423         * testsuite/two_file_shared.sh: New script.
11424         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11425         (check_DATA): Add two_file_shared.dbg.
11426         (two_file_shared.dbg): New target.
11427         * testsuite/Makefile.in: Rebuild.
11428
11429 2009-03-01  Ian Lance Taylor  <iant@google.com>
11430
11431         * configure.ac: Check for byteswap.h.
11432         * configure: Rebuild.
11433         * config.in: Rebuild.
11434
11435 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11436
11437         * layout.cc (Layout::find_or_add_kept_section): New function.
11438         (Layout::add_comdat): Removed.
11439         * layout.h (struct Kept_section): Move out of class Layout.
11440         Remove trailing underscores from field names.  Add group_sections
11441         field.  Rename group_ field to is_group.  Change all uses.
11442         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11443         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11444         comdat_groups_ field.
11445         (Sized_relobj::include_section_group): Use
11446         find_or_add_kept_section and Kept_section::group_sections.
11447         (Sized_relobj::include_linkonce_section): Likewise.
11448         * object.cc (class Sized_relobj): Don't define Comdat_group or
11449         Comdat_group_table.  Remove find_comdat_group and
11450         add_comdat_group.  Remove comdat_groups_ field.
11451         * plugin.cc (include_comdat_group): Use
11452         Layout::find_or_add_kept_section.
11453
11454 2009-02-28  Ian Lance Taylor  <iant@google.com>
11455
11456         * README: --gc-sections and map files are now supported.  Document
11457         some build requirements.
11458
11459         PR 6992
11460         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11461         relocatable link set the value of the section symbol to zero.
11462         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11463         relocatable link don't include the section address in the local
11464         symbol value.
11465
11466 2009-02-27  Ian Lance Taylor  <iant@google.com>
11467
11468         PR 6811
11469         * options.h (class Search_directory): Add is_system_directory.
11470         (class General_options): Declare is_in_system_directory.
11471         * options.cc (get_relative_sysroot): Make static.
11472         (get_default_sysroot): Make static.
11473         (General_optoins::is_in_system_directory): New function.
11474         * fileread.cc (Input_file::is_in_system_directory): New function.
11475         * fileread.h (class Input_file): Declare is_in_system_directory.
11476         * object.h (class Object): Add is_in_system_directory.
11477         (class Input_objects): Remove system_library_directory_ field.
11478         * object.cc (Input_objects::add_object): Don't set
11479         system_library_directory_.
11480         (input_objects::found_in_system_library_directory): Remove.
11481         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11482         parameter.  Change all callers.
11483         (Symbol_table::sized_write_globals): Likewise.
11484         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11485         Call Object::is_in_system_directory.
11486         * symtab.h (class Symbol_table): Update declarations.
11487
11488         PR 5990
11489         * descriptors.h (Open_descriptor): Add is_on_stack field.
11490         * descriptors.cc (Descriptors::open): If the descriptor is on the
11491         top of the stack, remove it.  Initialize is_on_stack field.
11492         (Descriptors::release): Only add pod to stack if it is not on the
11493         stack already.
11494         (Descriptors::close_some_descriptor): Clear stack_next and
11495         is_on_stack fields.
11496
11497         PR 7091
11498         * output.cc (Output_section::find_starting_output_address): Rename
11499         from starting_output_address; add PADDR parameter; change return
11500         type.
11501         * output.h (class Output_section): Declare
11502         find_starting_output_address instead of starting_output_address.
11503         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11504         section symbol for which we can't find a merge section.
11505
11506         PR 9836
11507         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11508         hidden or internal, force the symbol to be local.
11509         * resolve.cc (Symbol::override_visibility): Define.
11510         (Symbol::override_base): Use override_visibility.
11511         (Symbol_table::resolve): Likewise.
11512         (Symbol::override_base_with_special): Likewise.
11513         (Symbol_table::override_with_special): If the visibility is hidden
11514         or internal, force the symbol to be local.
11515         * symtab.h (class Symbol): Add set_visibility and
11516         override_visibility.
11517         * testsuite/ver_test_1.sh: New file.
11518         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11519         (check_DATA): Add ver_test_1.syms.
11520         (ver_test_1.syms): New target.
11521         * testsuite/Makefile.in: Rebuild.
11522
11523 2009-02-25  Cary Coutant  <ccoutant@google.com>
11524
11525         * layout.cc (Layout::choose_output_section): Don't rename sections
11526         when using a linker script that has a SECTIONS clause.
11527         * Makefile.in: Regenerate.
11528
11529         * testsuite/Makefile.am (script_test_5.sh): New test case.
11530         * testsuite/Makefile.in: Regenerate.
11531         * testsuite/script_test_5.cc: New file.
11532         * testsuite/script_test_5.sh: New file.
11533         * testsuite/script_test_5.t: New file.
11534
11535 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11536
11537         * archive.cc (Archive::include_member): Update calls to add_symbols.
11538         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11539         the Layout argument.
11540         * dynobj.h (do_add_symbols): Add the Layout argument.
11541         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11542         Layout argument.
11543         * object.h (Object::add_symbols): Add the Layout argument.
11544         (Object::do_add_symbols): Add the Layout argument.
11545         (Sized_relobj::do_add_symbols): Add the Layout argument.
11546         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11547         Unify the two versions.
11548         (Add_plugin_symbols): Remove.
11549         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11550         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11551         (Add_plugin_symbols): Remove.
11552         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11553         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11554         (Add_symbols::run): Make it work with Pulginobj.
11555
11556 2009-02-06  Ian Lance Taylor  <iant@google.com>
11557
11558         * object.cc (Sized_relobj::do_layout): Make info message start
11559         with lower case letter.
11560
11561 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11562
11563         * binary.cc: Fix file comment.
11564
11565         * options.h (enum Incremental_disposition): Define.
11566         (class General_options): Add new options: --incremental,
11567         --incremental_changed, --incremental_unchanged,
11568         --incremental_unknown.  Add incremental_disposition_ and
11569         implicit_incremental_ fields.
11570         (General_options::incremental_disposition): New function.
11571         (class Position_dependent_options): Add incremental_disposition
11572         option.
11573         (Position_dependent_options::copy_from_options): Set incremental
11574         dispositions.
11575         * options.cc (General_options::parse_incremental_changed): New
11576         function.
11577         (General_options::parse_incremental_unchanged): New function.
11578         (General_options::parse_incremental_unknown): New function.
11579         (General_options::General_options): Initialize new fields
11580         incremental_disposition_ and implicit_incremental_.
11581         (General_options::finalize): Check for uasge of --incremental-*
11582         without --incremental.
11583
11584 2009-02-06  Chris Demetriou  <cgd@google.com>
11585
11586         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11587         pointer and to report location as the file name associated with
11588         the symbol.
11589         (gold_undefined_symbol_at_location): New function to replace the
11590         old gold_undefined_symbol functionality.
11591         * target-reloc.h (relocate_section): Update to use
11592         gold_undefined_symbol_at_location.
11593         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11594         Call gold_undefined_symbol function rather than gold_error.
11595         * errors.h (Errors::undefined_symbol): Take location as a
11596         string, rather than calculating it from a relocation.
11597         * errors.cc (Errors::fatal): Print "fatal error:" before the
11598         formatted message.
11599         (Errors::error, Errors::error_at_location): Print "error: "
11600         before the formatted message.
11601         (Errors::undefined_symbol): Take location as a string, rather
11602         than calculating it from a relocation.
11603         (gold_undefined_symbol_at_location): New function akin to
11604         old gold_undefined_symbol, calculates location from relocation.
11605         (gold_undefined_symbol): Change to take only a Symbol pointer
11606         and to report location as the file name associated with the symbol.
11607         * testsuite/debug_msg.sh: Update for changed error messages.
11608         * testsuite/undef_symbol.sh: Likewise.
11609
11610 2009-02-04  Duncan Sands  <baldrick@free.fr>
11611
11612         PR 9812
11613         * reduced_debug_output.h
11614         (Output_reduced_debug_abbrev_section::failed): Use format for
11615         gold_warning.
11616         (Output_reduced_debug_info_section::faild): Likewise.
11617
11618 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11619
11620         * script.cc (Lazy_demangler): New class.
11621         (Version_script_info::get_symbol_version_helper): Demangle a
11622         symbol only once.
11623
11624 2009-01-29  Cary Coutant  <ccoutant@google.com>
11625
11626         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11627         to __tls_get_addr.
11628         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11629
11630 2009-01-28  Ian Lance Taylor  <iant@google.com>
11631
11632         * version.cc (version_string): Bump to 1.9.
11633
11634         * gold.h: Include <cstring> and <stdint.h>.
11635         * version.cc: Include <cstdio>.
11636         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11637         warning.
11638         * reduced_debug_output.cc (insert_into_vector): Rename from
11639         Insert_into_vector; change all callers.  Use Swap_unaligned to
11640         avoid aliasing issue; remove union since it is unnecessary.
11641
11642 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11643
11644         * Makefile.am (CCFILES): Add gc.cc.
11645         (HFILES): Add gc.h.
11646         * Makefile.in: Regenerate.
11647         * gold.cc (Gc_runner): New class.
11648         (queue_initial_tasks): Call garbage collection related tasks
11649         when corresponding options are invoked.
11650         (queue_middle_gc_tasks): New function.
11651         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11652         processed early before laying out sections during garbage collection.
11653         * gold.h (queue_middle_gc_tasks): New function.
11654         (is_prefix_of): Move from "layout.cc".
11655         * i386.cc (Target_i386::gc_process_relocs): New function.
11656         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11657         * main.cc (main): Create object of class "Garbage_collection".
11658         * object.cc (Relobj::copy_symbols_data): New function.
11659         (Relobj::is_section_name_included): New function.
11660         (Sized_relobj::do_layout): Allow this function to be called twice
11661         during garbage collection and defer layout of section during the
11662         first call.
11663         * object.h (Relobj::get_symbols_data): New function.
11664         (Relobj::is_section_name_included): New function.
11665         (Relobj::copy_symbols_data): New function.
11666         (Relobj::set_symbols_data): New function.
11667         (Relobj::get_relocs_data): New function.
11668         (Relobj::set_relocs_data): New function.
11669         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11670         (Relobj::gc_process_relocs): New function.
11671         (Relobj::do_gc_process_relocs): New pure virtual function.
11672         (Relobj::sd_): New data member.
11673         (Sized_relobj::is_output_section_offset_invalid): New function.
11674         (Sized_relobj::do_gc_process_relocs): New function.
11675         * options.h (General_options::gc_sections): Modify to not be a no-op.
11676         (General_options::print_gc_sections): New option.
11677         * plugin.cc (Plugin_finish::run): Remove function call to
11678         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11679         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11680         * reloc.cc (Read_relocs::run): Add task to process relocs and
11681         determine unreferenced sections when doing garbage collection.
11682         (Gc_process_relocs): New class.
11683         (Sized_relobj::do_gc_process_relocs): New function.
11684         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11685         sections that are garbage collected.
11686         * reloc.h (Gc_process_relocs): New class.
11687         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11688         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11689         symbols whose corresponding sections are garbage collected.
11690         (Symbol_table::Symbol_table): Add new parameter for the garbage
11691         collection object.
11692         (Symbol_table::gc_mark_undef_symbols): New function.
11693         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11694         (Symbol_table::gc_mark_dyn_syms): New function.
11695         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11696         as garbage.
11697         (Symbol_table::add_from_object): Likewise.
11698         (Symbol_table::add_from_relobj): When building shared objects, do not
11699         treat externally visible symbols as garbage.
11700         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11701         table information for static and relocatable links.
11702         * symtab.h (Symbol_table::set_gc): New function.
11703         (Symbol_table::gc): New function.
11704         (Symbol_table::gc_mark_undef_symbols): New function.
11705         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11706         (Symbol_table::gc_mark_dyn_syms): New function.
11707         (Symbol_table::gc_): New data member.
11708         * target.h (Sized_target::gc_process_relocs): New pure virtual
11709         function.
11710         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11711         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11712
11713 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11714
11715         * options.h (General_options::gc_sections): Define as a no-op for now.
11716         (General_options::no_keep_memory): Ditto.
11717         (General_options::Bshareable): Define.
11718         * options.cc (General_options::finalize): Honor -Bshareable.
11719
11720 2009-01-20  Andreas Schwab  <schwab@suse.de>
11721
11722         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11723         read the value in the contents, since we don't use it.  Use the
11724         template endianness when writing.
11725         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11726
11727 2009-01-19  Andreas Schwab  <schwab@suse.de>
11728
11729         * configure.tgt (powerpc64-*): Fix targ_obj.
11730
11731 2009-01-15  Ian Lance Taylor  <iant@google.com>
11732
11733         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11734         local symbols when stripping all symbols.
11735
11736 2009-01-14  Cary Coutant  <ccoutant@google.com>
11737
11738         * output.cc (Output_reloc): Add explicit instantiations.
11739
11740 2009-01-14  Cary Coutant  <ccoutant@google.com>
11741
11742         * archive.cc (Archive::get_elf_object_for_member): Remove call
11743         to File_read::claim_for_plugin.
11744         * descriptors.cc (Descriptors::open): Remove reference to
11745         is_claimed.
11746         (Descriptors::claim_for_plugin): Remove.
11747         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11748         (Descriptors::is_claimed): Remove.
11749         (claim_descriptor_for_plugin): Remove.
11750         * fileread.cc (File_read::claim_for_plugin): Remove.
11751         * fileread.h (File_read::claim_for_plugin): Remove.
11752         (File_read::descriptor): Reopen descriptor if necessary.
11753         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11754         (Plugin_manager::all_symbols_read): Add task parameter. Change
11755         all callers.
11756         (Plugin_manager::get_input_file): New function.
11757         (Plugin_manager::release_input_file): New function.
11758         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11759         corresponding data member.
11760         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11761         and pass to base constructor. Change all callers.
11762         (get_input_file, release_input_file): New functions.
11763         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11764         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11765         (Plugin_manager::all_symbols_read): Add task parameter.
11766         (Plugin_manager::get_input_file): New function.
11767         (Plugin_manager::release_input_file): New function.
11768         (Plugin_manager::task_): New data member.
11769         (Pluginobj::Pluginobj): Add filesize parameter.
11770         (Pluginobj::filename): New function.
11771         (Pluginobj::descriptor): New function.
11772         (Pluginobj::filesize): New function.
11773         (Pluginobj::filesize_): New data member.
11774         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11775         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11776         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11777
11778         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11779         with archive libraries.
11780         * testsuite/Makefile.in: Regenerate.
11781         * testsuite/plugin_test.c (struct sym_info): New type.
11782         (get_input_file, release_input_file): New static variables.
11783         (onload): Capture new transfer vector entries.
11784         (claim_file_hook): Stop reading at end of file according to filesize.
11785         Factor out parsing of readelf output into separate function.
11786         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11787         APIs and get the source file name from the symbol table.  Convert
11788         source file name to corresponding object file name.  Print info
11789         message when adding new input files.
11790         (parse_readelf_line): New function.
11791         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11792         * testsuite/plugin_test_2.sh: Likewise.
11793         * testsuite/plugin_test_3.sh: Likewise.
11794         * testsuite/plugin_test_4.sh: New test case.
11795
11796 2009-01-07  Ian Lance Taylor  <iant@google.com>
11797
11798         * version.cc (version_string): Bump to 1.8.
11799
11800 2008-12-23  Cary Coutant  <ccoutant@google.com>
11801
11802         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11803         * plugin.cc (Plugin_manager::finish): Rename as
11804         layout_deferred_objects.  Move cleanup to separate function.
11805         (Plugin_manager::cleanup): New function.
11806         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11807         separately.
11808         * plugin.h (Plugin_manager::finish): Rename as
11809         layout_deferred_objects.
11810         (Plugin_manager::cleanup): New function.
11811         (Plugin_manager::cleanup_done): New field.
11812
11813 2008-12-23  Cary Coutant  <ccoutant@google.com>
11814
11815         * plugin.cc (is_visible_from_outside): New function.
11816         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11817         so we don't return "IR only" status for exported symbols or -r links.
11818
11819         * testsuite/Makefile.am (plugin_test_3): New test case.
11820         * testsuite/Makefile.in: Regenerate.
11821         * testsuite/plugin_test_3.sh: New file.
11822
11823 2008-12-22  Cary Coutant  <ccoutant@google.com>
11824
11825         * object.cc (Sized_relobj::layout_section): New function.
11826         (Sized_relobj::do_layout): Defer layout of input sections until after
11827         plugin has provided replacement files.
11828         (Sized_relobj::do_layout_deferred_sections): New function.
11829         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11830         (Relobj::layout_deferred_sections): New function.
11831         (Relobj::do_layout_deferred_sections): New function.
11832         (Sized_relobj::do_layout_deferred_sections): New function.
11833         (Sized_relobj::layout_section): New function.
11834         (Sized_relobj::Deferred_layout): New structure.
11835         (Sized_relobj::deferred_layout_): New field.
11836         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11837         Change all callers.  Layout deferred sections.
11838         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11839         references.
11840         (Plugin_hook::run): Move code from do_plugin_hook inline.
11841         (Plugin_hook::do_plugin_hook): Remove.
11842         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11843         (Plugin_manager::finish): Renamed, was cleanup.
11844         (Plugin_manager::should_defer_layout): New function.
11845         (Plugin_manager::add_deferred_layout_object): New function.
11846         (Plugin_manager::Deferred_layout_list): New type.
11847         (Plugin_manager::deferred_layout_objects_): New field.
11848         (Plugin_hook::do_plugin_hook): Remove.
11849
11850 2008-12-17  Ian Lance Taylor  <iant@google.com>
11851
11852         * options.h (class General_options): Add --no case for
11853         --export-dynamic.
11854
11855 2008-12-16  Cary Coutant  <ccoutant@google.com>
11856
11857         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11858         vector.
11859         (Plugin_manager::claim_file): Create plugin object even if
11860         plugin did not call the add_symbols callback.
11861         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11862         asking for more symbols than were added.
11863         * testsuite/Makefile.am (plugin_test_1): Add test case with
11864         no global symbols.
11865         (empty.syms): New target.
11866         * testsuite/Makefile.in: Regenerate.
11867         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11868         message. Don't call add_symbols if no globals.
11869         (all_symbols_read_hook): Don't provide replacement for empty
11870         claimed file.
11871
11872 2008-12-12  Ian Lance Taylor  <iant@google.com>
11873
11874         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11875         r_type == 0 for a local symbol with r_sym == 0.
11876         (scan_relocatable_relocs): Pass r_sym to
11877         local_non_section_strategy.
11878         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11879         r_sym parameter.
11880
11881         * configure.ac: Update test for TLS descriptors: they are
11882         supported as of glibc 2.9.
11883         * configure: Rebuild.
11884
11885 2008-12-11  Ian Lance Taylor  <iant@google.com>
11886
11887         PR 7091
11888         * target-reloc.h (Default_scan_relocatable_relocs): For each
11889         function, map r_type == 0 to RELOC_DISCARD.
11890
11891 2008-12-10  Cary Coutant  <ccoutant@google.com>
11892
11893         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11894         object to override a kept COMDAT group from a plugin object.
11895
11896 2008-12-09  Ian Lance Taylor  <iant@google.com>
11897
11898         PR 7088
11899         * yyscript.y (file_cmd): Handle INPUT.
11900
11901         * testsuite/initpri1.c: Change all declarations to be full
11902         prototypes by adding void, to avoid compiler warnings.
11903
11904 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11905
11906         * options.cc (General_options::parse_plugin_opt): New.
11907         (General_options::add_plugin): The argument now is just the filename.
11908         (General_options::add_plugin_option): New.
11909         * options.h (plugin_opt): New.
11910         (add_plugin): Change argument name.
11911         (add_plugin_option): New.
11912         * plugin.cc (Plugin::load): Don't parse the plugin option.
11913         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11914         (Plugin::add_option): New.
11915         (Plugin::args_): Change type.
11916         (Plugin::filename_): New.
11917         (Plugin_manager::add_plugin_option): New.
11918         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11919         * testsuite/Makefile.in: Regenerate.
11920
11921 2008-12-05  Cary Coutant  <ccoutant@google.com>
11922
11923         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11924         Handle --strip-lto-sections option.
11925         * options.h (strip_lto_sections): New option.
11926
11927 2008-12-01  Cary Coutant  <ccoutant@google.com>
11928
11929         * plugin.cc (ld_plugin_message): Change format parameter to const.
11930         Fix mismatch between new[] and delete.
11931
11932 2008-11-14  Cary Coutant  <ccoutant@google.com>
11933
11934         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11935         instead of -1U.
11936
11937 2008-11-05  Craig Silverstein  <csilvers@google.com>
11938
11939         * options.cc (General_options::parse_dynamic_list): New function.
11940         * options.h (General_options): New flags dynamic_list,
11941         dynamic_list_data, dynamic_list_cpp_new, and
11942         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11943         (General_options::in_dynamic_list): New function.
11944         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11945         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11946         (Lex::can_continue_name): Likewise.
11947         (yylex): Likewise.
11948         (read_script_file): New parameter script_options.
11949         (read_dynamic_list): New function.
11950         (Script_options::define_dynamic_list): New function.
11951         (dynamic_list_keyword_parsecodes): New variable.
11952         (dynamic_list_keywords): New variable.
11953         * script.h (Script_options::define_dynamic_list): New function
11954         prototype.
11955         (read_dynamic_list): New function prototype.
11956         * symtab.cc (strprefix): New macro.
11957         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11958         dynamic_list_data, dynamic_list_cpp_new, and
11959         dynamic_list_cpp_typeinfo.
11960         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11961         (dynamic_list_expr): New rule.
11962         (dynamic_list_nodes): Likewise.
11963         (dynamic_list_node): Likewise.
11964         * testsuite/Makefile.am (dynamic_list): New test.
11965         * testsuite/Makefile.in: Regenerated.
11966         * testsuite/dynamic_list.t: New file.
11967         * testsuite/dynamic_list.sh: New file.
11968
11969 2008-11-05  Craig Silverstein  <csilvers@google.com>
11970
11971         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11972         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11973         (t11_last): Likewise.
11974         * testsuite/ver_test_6.c (main): Likewise.
11975
11976 2008-10-07  Cary Coutant  <ccoutant@google.com>
11977
11978         * options.c (General_options::finalize): Add check for -static and
11979         -shared.
11980         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
11981         is not empty.
11982
11983 2008-10-02  Cary Coutant  <ccoutant@google.com>
11984
11985         * plugin.cc (make_sized_plugin_object): Fix conditional
11986         compilation to work when not all targets are enabled.
11987
11988 2008-09-29  Cary Coutant  <ccoutant@google.com>
11989
11990         * archive.cc (Archive::get_file_and_offset): Use filename instead
11991         of name to get library path.
11992         (Archive::include_member): Unlock external member of a thin archive.
11993
11994         * testsuite/Makefile.am (TEST_AR): New variable.
11995         (thin_archive_test_1): New test.
11996         (thin_archive_test_2): New test.
11997         * testsuite/Makefile.in: Regenerate.
11998         * testsuite/thin_archive_main.cc: New file.
11999         * testsuite/thin_archive_test_1.cc: New file.
12000         * testsuite/thin_archive_test_2.cc: New file.
12001         * testsuite/thin_archive_test_3.cc: New file.
12002         * testsuite/thin_archive_test_4.cc: New file.
12003
12004 2008-09-29  Cary Coutant  <ccoutant@google.com>
12005
12006         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12007         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12008         instead of -1U.
12009         (Sized_relobj::do_finalize_local_symbols): Likewise.
12010         (Sized_relobj::map_to_kept_section): Likewise.
12011         * object.h (Sized_relobj::invalid_address): New constant.
12012         (Sized_relobj::do_output_section_offset): Check for invalid_address
12013         and return -1ULL.
12014         * output.cc (Output_reloc::local_section_offset): Use constant
12015         invalid_address instead of -1U.
12016         (Output_reloc::get_address): Likewise.
12017         (Output_section::output_address): Change -1U to -1ULL.
12018         * output.h (Output_reloc::invalid_address): New constant.
12019         * reloc.cc (Sized_relobj::write_sections): Use constant
12020         invalid_address instead of -1U.
12021         (Sized_relobj::relocate_sections): Likewise.
12022         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12023         values for merge sections.
12024         * target-reloc.h (relocate_for_relocatable): Use constant
12025         invalid_address instead of -1U.
12026
12027 2008-09-19  Cary Coutant  <ccoutant@google.com>
12028
12029         Add plugin functionality for link-time optimization (LTO).
12030         * configure.ac (plugins): Add --enable-plugins option.
12031         * configure: Regenerate.
12032         * config.in: Regenerate.
12033         * Makefile.am (LIBDL): New variable.
12034         (CCFILES): Add plugin.cc.
12035         (HFILES): Add plugin.h.
12036         (ldadd_var): Add LIBDL.
12037         * Makefile.in: Regenerate.
12038
12039         * archive.cc: Include "plugin.h".
12040         (Archive::setup): Don't preread archive symbols when using a plugin.
12041         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12042         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12043         files.
12044         (Archive::include_member): Add symbols from plugin objects.
12045         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12046         * descriptors.cc (Descriptors::open): Check for file descriptors
12047         abandoned by plugins.
12048         (Descriptors::claim_for_plugin): New function.
12049         * descriptors.h (Descriptors::claim_for_plugin): New function.
12050         (Open_descriptor::is_claimed): New field.
12051         (claim_descriptor_for_plugin): New function.
12052         * fileread.cc (File_read::claim_for_plugin): New function.
12053         * fileread.h (File_read::claim_for_plugin): New function.
12054         (File_read::descriptor): New function.
12055         * gold.cc: Include "plugin.h".
12056         (queue_initial_tasks): Add task to call plugin hooks for generating
12057         new object files.
12058         * main.cc: Include "plugin.h".
12059         (main): Load plugin libraries.
12060         * object.h (Pluginobj): Declare.
12061         (Object::pluginobj): New function.
12062         (Object::do_pluginobj): New function.
12063         (Object::set_target): New function.
12064         * options.cc: Include "plugin.h".
12065         (General_options::parse_plugin): New function.
12066         (General_options::General_options): Initialize plugins_ field.
12067         (General_options::add_plugin): New function.
12068         * options.h (Plugin_manager): Declare.
12069         (General_options): Add --plugin option.
12070         (General_options::has_plugins): New function.
12071         (General_options::plugins): New function.
12072         (General_options::add_plugin): New function.
12073         (General_options::plugins_): New field.
12074         * plugin.cc: New file.
12075         * plugin.h: New file.
12076         * readsyms.cc: Include "plugin.h".
12077         (Read_symbols::do_read_symbols): Check for archive before checking
12078         for ELF file.  Call plugin hooks to claim files.
12079         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12080         from a real object file; force override when processing replacement
12081         files.
12082         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12083         (Symbol::init_base_object): Likewise.
12084         (Symbol::init_base_output_data): Likewise.
12085         (Symbol::init_base_output_segment): Likewise.
12086         (Symbol::init_base_constant): Likewise.
12087         (Symbol::init_base_undefined): Likewise.
12088         (Symbol::output_section): Assert that object is not a plugin.
12089         (Symbol_table::add_from_pluginobj): New function.
12090         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12091         undefined.
12092         (Symbol_table::sized_write_globals): Likewise.
12093         (Symbol_table::add_from_pluginobj): Instantiate template.
12094         * symtab.h (Sized_pluginobj): Declare.
12095         (Symbol::in_real_elf): New function.
12096         (Symbol::set_in_real_elf): New function.
12097         (Symbol::in_real_elf_): New field.
12098         (Symbol_table::add_from_pluginobj): New function.
12099
12100         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12101         (LIBDL): New variable.
12102         (LDADD): Add LIBDL.
12103         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12104         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12105         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12106         (MOSTLYCLEANFILES): Likewise.
12107         * testsuite/Makefile.in: Regenerate.
12108         * testsuite/plugin_test.c: New file.
12109         * testsuite/plugin_test_1.sh: New file.
12110         * testsuite/plugin_test_2.sh: New file.
12111
12112 2008-09-16  Ian Lance Taylor  <iant@google.com>
12113
12114         * target-reloc.h (relocate_section): Check whether a symbol is
12115         defined by the ABI before reporting an undefined symbol error.
12116         * target.h (Target::is_defined_by_abi): Make parameter const.
12117         (Target::do_is_defined_by_abi): Likewise.
12118         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12119         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12120         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12121         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12122         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12123         * testsuite/Makefile.in: Rebuild.
12124
12125         * fileread.cc (make_view): Add casts to avoid warning.
12126
12127 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12128
12129         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12130         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12131
12132 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12133
12134         * options.h (General_options::output_is_executable): New.
12135         (General_options::output_is_pie): New.
12136         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12137         for shared libraries.
12138         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12139
12140 2008-09-11  Chris Demetriou  <cgd@google.com>
12141
12142         * options.h (origin): New -z option.
12143         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12144         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12145         in DT_FLAGS_1.
12146
12147 2008-09-05  Cary Coutant  <ccoutant@google.com>
12148
12149         * fileread.cc (File_read::make_view): Add check for attempt to map
12150         beyond end of file.
12151
12152 2008-09-05  Cary Coutant  <ccoutant@google.com>
12153
12154         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12155         explicit instantiations.
12156
12157 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12158
12159         PR gold/6858
12160         * options.cc (General_options::finalize): Allow undefined symbols
12161         in shlibs if linking -shared.
12162
12163         PR gold/6859
12164         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12165         symbols as not needing a dynsym entry.
12166
12167 2008-08-20  Craig Silverstein  <csilvers@google.com>
12168
12169         * fileread.cc (File_read::open): Do not lock the file unless it
12170         was successfully opened.
12171
12172 2008-08-14  Cary Coutant  <ccoutant@google.com>
12173
12174         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12175         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12176         * testsuite/tls_test.cc (struct int128): 128-bit struct
12177         for testing TLS relocs with non-zero addend.
12178         (v12): New TLS variable.
12179         (t12): New test.
12180         (t_last): Add check for v12.
12181         * testsuite/tls_test.h (t12): New function.
12182         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12183
12184 2008-08-13  Ian Lance Taylor  <iant@google.com>
12185
12186         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12187         set tls_segment_ or relro_segment_.
12188         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12189         when appropriate.
12190         * output.h (Output_section::clear_is_relro): New function.
12191         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12192         sections specially even when output_data_ is empty.
12193         (Output_segment::maximum_alignment): When first section is relro,
12194         only force alignment for PT_LOAD segments.
12195         * script.cc (script_data_segment_align): New function.
12196         (script_data_segment_relro_end): New function.
12197         * script-c.h (script_data_segment_align): Declare.
12198         (script_data_segment_relro_end): Declare.
12199         * script-sections.h (class Script_sections): Declare
12200         data_segment_align and data_segment_relro_end.  Add fields
12201         segment_align_index_ and saw_relro_end_.
12202         * script-sections.cc (class Sections_element): Add set_is_relro
12203         virtual function.  Add new bool* parameter to place_orphan_here.
12204         Add get_output_section virtual function.
12205         (class Output_section_definition): Add set_is_relro.  Add new
12206         bool* parameter to place_orphan_here.  Add get_output_section.
12207         Add is_relro_ field.
12208         (Output_section_definition::Output_section_definition): Initialize
12209         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12210         and is_relro_ fields.
12211         (Output_section_definition::place_orphan_here): Add is_relro
12212         parameter.
12213         (Output_section_definition::set_section_addresses): Set relro for
12214         output section.
12215         (Output_section_definition::alternate_constraint): Likewise.
12216         (class Orphan_output_section): Add new bool* parameter to
12217         place_orphan_here.  Add get_output_section.
12218         (Orphan_output_section::place_orphan_here): Add is_relro
12219         parameter.
12220         (Script_sections::Script_sections): Initialize
12221         data_segment_align_index_ and saw_relro_end_.
12222         (Script_sections::data_segment_align): New function.
12223         (Script_sections::data_segment_relro_end): New function.
12224         (Script_sections::place_orphan): Set or clear is_relro.
12225         (Script_sections::set_section_addresses): Force alignment of first
12226         TLS section.
12227         * yyscript.y (exp): Call script_data_segment_align and
12228         script_data_segment_relro_end.
12229         * testsuite/relro_script_test.t: New file.
12230         * testsuite/relro_test.cc (using_script): Declare.
12231         (t1, t2): Test using_script.
12232         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12233         (relro_script_test_SOURCES): Define.
12234         (relro_script_test_DEPENDENCIES): Define.
12235         (relro_script_test_LDFLAGS): Define.
12236         (relro_script_test_LDADD): Define.
12237         (relro_script_test.so): New target.
12238         * testsuite/Makefile.in: Rebuild.
12239
12240 2008-08-06  Cary Coutant <ccoutant@google.com>
12241
12242         * archive.cc (Archive::total_archives, Archive::total_members)
12243         (Archive::total_members_loaded): New variables.
12244         (Archive::setup): Add parameter.  Add option to preread
12245         archive symbols.
12246         (Archive::read_armap): Add counter.
12247         (Archive::get_file_and_offset): New function.
12248         (Archive::get_elf_object_for_member): New function.
12249         (Archive::read_all_symbols): New function.
12250         (Archive::read_symbols): New function.
12251         (Archive::add_symbols): Add counters.
12252         (Archive::include_all_members): Use armap to find members if it's
12253         already built.
12254         (Archive::include_member): Skip reading symbols if already read.
12255         Factored code into Archive::get_file_and_offset and
12256         Archive::get_elf_object_for_member.  Changed call to
12257         Mapfile::report_include_archive_member.
12258         (Archive::print_stats): New function.
12259         * archive.h: Declare Object and Read_symbols_data classes.
12260         (Archive::Archive): Add initializers for new members.
12261         (Archive::setup): Add parameter.
12262         (Archive::print_stats): New function.
12263         (Archive::total_archives, Archive::total_members)
12264         (Archive::total_members_loaded): New variables.
12265         (Archive::get_file_and_offset): New function.
12266         (Archive::get_elf_object_for_member): New function.
12267         (Archive::read_all_symbols): New function.
12268         (Archive::read_symbols): New function.
12269         (Archive::Archive_member): New class.
12270         (Archive::members_): New member.
12271         (Archive::num_members_): New member.
12272         * main.cc: Include archive.h.
12273         (main): Call Archive::print_stats.
12274         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12275         archive parameter; member_name is now the fully-decorated name.
12276         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12277         * options.h: (General_options): Add --preread-archive-symbols option.
12278         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12279         Archive::setup.
12280
12281 2008-08-04  Ian Lance Taylor  <iant@google.com>
12282
12283         * symtab.h (Symbol::use_plt_offset): New function.
12284         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12285         * powerpc.cc (Relocate::relocate): Likewise.
12286         * sparc.cc (Relocate::relocate): Likewise.
12287         * x86_64.cc (Relocate::relocate): Likewise.
12288         * testsuite/weak_plt.sh: New test.
12289         * testsuite/weak_plt_main.cc: New test.
12290         * testsuite/weak_plt_shared.cc: New test.
12291         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12292         (check_PROGRAMS): Add weak_plt.
12293         (check_DATA): Add weak_plt_shared.so.
12294         (weak_plt_main_pic.o, weak_plt): New targets.
12295         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12296         * testsuite/Makefile.in: Rebuild.
12297
12298         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12299         gcctestdir/ld.
12300         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12301         * testsuite/Makefile.in: Rebuild.
12302
12303 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12304
12305         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12306         * Makefile.in: Regenerate.
12307         * po/POTFILES.in: Regenerate.
12308
12309 2008-07-29  Ian Lance Taylor  <iant@google.com>
12310
12311         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12312         symbols before other symbols.
12313         * testsuite/script_test_2.cc (test_addr): Declare.
12314         (test_addr_alias): Declare.
12315         (main): Check that test_addr and test_addr_alias have the right
12316         values.
12317         * testsuite/script_test_2.t: Define test_addr_alias and
12318         test_addr.
12319
12320 2008-07-24  Ian Lance Taylor  <iant@google.com>
12321
12322         PR 5990
12323         * descriptors.cc: New file.
12324         * descriptors.h: New file.
12325         * gold-threads.h (class Hold_optional_lock): New class.
12326         * fileread.cc: Include "descriptors.h".
12327         (File_read::~File_read): Release descriptor rather than closing
12328         it.
12329         (File_read::open) [file]: Call open_descriptor rather than open.
12330         Set is_descriptor_opened_.
12331         (File_read::open) [memory]: Assert that descriptor is not open.
12332         (File_read::reopen_descriptor): New function.
12333         (File_read::release): Release descriptor.
12334         (File_read::do_read): Make non-const.  Reopen descriptor.
12335         (File_read::read): Make non-const.
12336         (File_read::make_view): Reopen descriptor.
12337         (File_read::do_readv): Likewise.
12338         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12339         Update declarations.
12340         * layout.cc: Include "descriptors.h".
12341         (Layout::create_build_id): Use open_descriptor rather than open.
12342         * output.cc: Include "descriptors.h".
12343         (Output_file::open): Use open_descriptor rather than open.
12344         * archive.cc (Archive::const_iterator): Change Archive to be
12345         non-const.
12346         (Archive::begin, Archive::end): Make non-const.
12347         (Archive::count_members): Likewise.
12348         * archive.h (class Archive): Update declarations.
12349         * object.h (Object::read): Make non-const.
12350         * Makefile.am (CCFILES): Add descriptors.cc.
12351         (HFILES): Add descriptors.h.
12352         * Makefile.in: Rebuild.
12353
12354         PR 6716
12355         * gold.h: Always include <clocale>.  Add Solaris workarounds
12356         following code in binutils/sysdep.h.
12357
12358         PR 6048
12359         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12360         this->eh_frame_hdr_ is NULL before using it.
12361
12362         * dynobj.cc (Versions::Versions): Update comment.
12363
12364         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12365         the base version name.
12366
12367         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12368         array size plus one.
12369         (Stringpool_template::set_string_offsets): Subtract one from key
12370         before using it as an array index.
12371         (Stringpool_template::get_offset_with_length): Likewise.
12372         (Stringpool_template::write_to_buffer): Likewise.
12373         * stringpool.h (Stringpool_template::get_offset_from_key):
12374         Likewise.
12375
12376 2008-07-23  Ian Lance Taylor  <iant@google.com>
12377
12378         PR 6658
12379         * object.h (Merged_symbol_value::value): Do our best to handle a
12380         negative addend.
12381
12382         PR 6647
12383         * script.cc (Version_script_info::get_versions): Don't add empty
12384         version tag to return value.
12385         (Version_script_info::get_symbol_version_helper): Change return
12386         type to bool.  Add pversion parameter.  Change all callers.
12387         (script_register_vers_node): Don't require a non-NULL tag.
12388         * script.h (class Version_script_info): Update declarations.
12389         (Version_script_info::get_symbol_version): Change return type to
12390         bool.  Add version parameter.  Change all callers.
12391         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12392         handling.  Handle an empty version from a version script.
12393         (Symbol_table::define_special_symbol): Likewise.
12394         * testsuite/ver_test_10.script: New file.
12395         * testsuite/ver_test_10.sh: New file.
12396         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12397         (check_DATA): Add ver_test_10.syms.
12398         (ver_test_10.syms, ver_test_10.so): New target.
12399         * testsuite/Makefile.in: Rebuild.
12400
12401 2008-07-23  Simon Baldwin  <simonb@google.com>
12402
12403         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12404         to zero for undefined symbols from dynamic libraries.
12405
12406 2008-07-23  Ian Lance Taylor  <iant@google.com>
12407
12408         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12409         Change all callers.
12410         * symtab.h (class Symbol_table): Update declaration.
12411         * testsuite/ver_test_9.cc: New file.
12412         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12413         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12414         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12415         (ver_test_9.so, ver_test_9.o): New targets.
12416         * testsuite/Makefile.in: Rebuild.
12417
12418 2008-07-22  Ian Lance Taylor  <iant@google.com>
12419
12420         * options.h (class General_options): Define --check-sections.
12421         * layout.cc (Layout::set_segment_offsets): Handle
12422         --check-sections.
12423
12424         * options.h (class General_options): Define -n/--nmagic and
12425         -N/--omagic.
12426         * options.cc (General_options::finalize): For -n/--nmagic or
12427         -N/--omagic, set -static.
12428         * layout.cc (Layout::attach_allocated_section_to_segment): If
12429         -N/--omagic, don't put read-only and read-write sections in
12430         different segments.
12431         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12432         finding a read-only segment.
12433         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12434         don't set the minimum segment alignment to the common page size,
12435         and don't set the file offset to the address modulo the page size.
12436         * script-sections.cc (Script_sections::create_segments): If
12437         -n/--omagic, don't put read-only and read-write sections in
12438         different segments.
12439
12440         * cref.cc: New file.
12441         * cref.h: New file.
12442         * options.h (class General_options): Add --print-symbol-counts.
12443         * main.cc (main): Issue defined symbol report if requested.
12444         * archive.cc (Archive::interpret_header): Make into a const member
12445         function.
12446         (Archive::add_symbols): Call Input_objects::archive_start and
12447         archive_stop.
12448         (Archive::const_iterator): Define new class.
12449         (Archive::begin, Archive::end): New functions.
12450         (Archive::include_all_members): Rewrite to use iterator.
12451         (Archive::count_members): New function.
12452         * archive.h (class Archive): Update declarations.
12453         (Archive::filename): New function.
12454         * object.cc: Include "cref.h".
12455         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12456         (Sized_relobj::do_get_global_symbol_counts): New function.
12457         (Input_objects::add_object): Add object to cross-referencer.
12458         (Input_objects::archive_start): New function.
12459         (Input_objects::archive_stop): New function.
12460         (Input_objects::print_symbol_counts): New function.
12461         * object.h: Declare Cref and Archive.
12462         (Object::get_global_symbol_counts): New function.
12463         (Object::do_get_global_symbol_counts): New pure virtual function.
12464         (class Sized_relobj): Add defined_count_ field.  Update
12465         declarations.
12466         (class Input_objects): Add cref_ field.  Update constructor.
12467         Update declarations.
12468         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12469         defined_count_.
12470         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12471         symbol counts.
12472         (Sized_dynobj::do_get_global_symbol_counts): New function.
12473         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12474         defined_count_.  Update declarations.  Define Symbols typedef.
12475         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12476         parameter.  Change all callers.
12477         (Symbol_table::add_from_dynobj): Add sympointers and defined
12478         parameters.  Change all callers.
12479         * symtab.h (class Symbol_table): Update declarations.
12480         * Makefile.am (CCFILES): Add cref.cc.
12481         (HFILES): Add cref.h.
12482         * Makefile.in: Rebuild.
12483
12484 2008-07-22  Simon Baldwin  <simonb@google.com>
12485
12486         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12487         to zero when writing undefined symbols.
12488
12489 2008-07-22  Ian Lance Taylor  <iant@google.com>
12490
12491         * output.cc (Output_section::add_input_section): Don't try to
12492         merge empty merge sections.
12493
12494 2008-07-21  Craig Silverstein  <csilvers@google.com>
12495
12496         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12497         Include symbol version in error message.
12498
12499 2008-07-20  Chris Demetriou  <cgd@google.com>
12500
12501         * configure.ac (gold_cv_c_random_seed): New configured variable.
12502         (RANDOM_SEED_CFLAGS): New substituted variable.
12503         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12504         * configure: Rebuild.
12505         * Makefile.in: Likewise.
12506         * testsuite/Makefile.in: Likewise.
12507
12508 2008-07-18  Ian Lance Taylor  <iant@google.com>
12509
12510         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12511         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12512         * testsuite/ver_test_main.cc (main): Call t4.
12513         (t4, t4_2a): Define.
12514         * testsuite/ver_test_2.cc (t4_2): Define.
12515         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12516         * testsuite/ver_test_4.cc (t4_2a): Define.
12517         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12518         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12519
12520 2008-07-17  Ian Lance Taylor  <iant@google.com>
12521
12522         * dynobj.cc (Versions::add_def): If we give an error about a
12523         missing version, go ahead and create the version anyhow.
12524
12525 2008-07-10  Ian Lance Taylor  <iant@google.com>
12526
12527         Handle output sections with more than 0x7fffffff bytes.
12528         * object.h (class Relobj): Change map_to_output_ to
12529         output_sections_, and just keep a section pointer.  Change all
12530         uses.  Move comdat group support to Sized_relobj.
12531         (Relobj::is_section_specially_mapped): Remove.
12532         (Relobj::output_section): Remove poff parameter.  Change all
12533         callers.
12534         (Relobj::output_section_offset): New function.
12535         (Relobj::set_section_offset): Rewrite.
12536         (Relobj::map_to_output): Remove.
12537         (Relobj::output_sections): New function.
12538         (Relobj::do_output_section_offset): New pure virtual function.
12539         (Relobj::do_set_section_offset): Likewise.
12540         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12541         group support from Relobj.  Update declarations.
12542         (Sized_relobj::get_output_section_offset): New function.
12543         (Sized_relobj::do_output_section_offset): New function.
12544         (Sized_relobj::do_set_section_offset): New function.
12545         * object.cc (Relobj::output_section_address): Remove.
12546         (Sized_relobj::Sized_relobj): Initialize new fields.
12547         (Sized_relobj::include_section_group): Cast find_kept_object to
12548         Sized_relobj.
12549         (Sized_relobj::include_linkonce_section): Likewise.
12550         (Sized_relobj::do_layout): Use separate arrays for output section
12551         and output offset.
12552         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12553         output_sections.
12554         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12555         output_sections and section_offsets.
12556         (Sized_relobj::write_local_symbols): Likewise.
12557         (map_to_kept_section): Compute output address directly.
12558         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12559         output_sections and section_offsets.
12560         (Sized_relobj::write_sections): Likewise.
12561         (Sized_relobj::relocate_sections): Likewise.
12562         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12563         * output.h (class Output_reloc): Update declarations.  Change
12564         u2_.relobj to Sized_relobj*.
12565         (class Output_data_reloc): Change add functions to use
12566         Sized_relobj*.
12567         * output.cc (Output_reloc::Output_reloc): Change relobj to
12568         Sized_relobj*.
12569         (Output_reloc::local_section_offset): Change return type to
12570         Elf_Addr.  Use get_output_section_offset.
12571         (Output_reloc::get_address): Likewise.
12572         (Output_section::is_input_address_mapped): Don't call
12573         is_section_specially_mapped.
12574         (Output_section::output_offset): Likewise.
12575         (Output_section::output_address): Likewise.
12576         (Output_section::starting_output_address): Likewise.
12577         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12578         parameter to Sized_relobj*.
12579         (Copy_relocs::need_copy_reloc): Likewise.
12580         (Copy_relocs::save): Likewise.
12581         * copy-relocs.h (class Copy_relocs): Update declarations.
12582         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12583         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12584         * target-reloc.h (relocate_for_relocatable): Change
12585         offset_in_output_section type to Elf_Addr.  Change code that uses
12586         it as well.
12587         * layout.cc (Layout::layout): Always set *off.
12588         * mapfile.cc (Mapfile::print_input_section): Use
12589         output_section_offset.
12590         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12591         Sized_relobj*.
12592         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12593         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12594         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12595
12596 2008-07-03  Ian Lance Taylor  <iant@google.com>
12597
12598         * layout.cc (Layout::include_section): Do not discard unrecognized
12599         SHT_STRTAB sections.
12600
12601 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12602
12603         * script.cc (Lex::can_continue_name): Make '?' allowable in
12604         version-script names.
12605         * testsuite/version_script.map: Change glob pattern to use '?'
12606
12607 2008-06-30  Manish Singh  <yosh@gimp.org>
12608
12609         PR 6585
12610         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12611         Correct typo.
12612
12613 2008-06-30  Ian Lance Taylor  <iant@google.com>
12614
12615         PR 6660
12616         PR 6682
12617         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12618         versions]: Don't try to read the value in the contents, since we
12619         don't use it.  Use the template endianness when writing.
12620
12621 2008-06-25  Cary Coutant  <ccoutant@google.com>
12622
12623         * fileread.cc (File_read::make_view): Assert on zero-length view.
12624         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12625         symbol table when there are no symbols to read.
12626
12627 2008-06-23  Craig Silverstein  <csilvers@google.com>
12628
12629         * version.cc (version_string): Bump to 1.7
12630
12631 2008-06-18  Craig Silverstein  <csilvers@google.com>
12632
12633         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12634         constant 0xFFFF to type Valtype.
12635         (Powerpc_relocate_functions::rel16_ha): Likewise.
12636
12637 2008-06-17  Ian Lance Taylor  <iant@google.com>
12638
12639         * output.h (Output_section::Input_section): Initialize p2align_ to
12640         zero for Output_section_data constructors.
12641         (Output_section::Input_section::addralign): If not an input
12642         section, return the alignment of the Output_section_data.
12643         * testsuite/copy_test.cc: New file.
12644         * testsuite/copy_test_1.cc: New file.
12645         * testsuite/copy_test_2.cc: New file.
12646         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12647         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12648         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12649         (copy_test_1_pic.o, copy_test_1.so): New targets.
12650         (copy_test_2_pic.o, copy_test_2.so): New targets.
12651         * testsuite/Makefile.in: Rebuild.
12652
12653         * script-sections.cc (Script_sections::place_orphan): Initialize
12654         local variable exact.
12655
12656 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12657
12658         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12659
12660 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12661             David S. Miller  <davem@davemloft.net>
12662
12663         * powerpc.cc: New file.
12664         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12665         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12666         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12667         * Makefile.in: Rebuild.
12668
12669 2008-06-09  Ian Lance Taylor  <iant@google.com>
12670
12671         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12672         <exception>.
12673         (throwing, orig_terminate): New static variables.
12674         (terminate_handler): New static function.
12675         (t2): Set terminate handler.
12676
12677 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12678
12679         PR 6584
12680         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12681         alignment.
12682
12683 2008-05-30  Cary Coutant  <ccoutant@google.com>
12684
12685         * archive.cc (Archive::include_all_members) Correct to step
12686         over symbol table and extended name table in thin archives.
12687
12688 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12689
12690         PR 6407
12691         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12692         calculation.
12693
12694 2008-05-28  Caleb Howe  <cshowe@google.com>
12695
12696         * reduced_debug_output.cc: New file.
12697         * reduced_debug_output.h: New file.
12698         * options.h (class General_options): Add --strip-debug-non-line.
12699         * options.cc (General_options::finalize): Add strip_debug_non_line
12700         to the strip heirarchy.
12701         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12702         fields.
12703         * layout.cc: Include "reduced_debug_output.h".
12704         (Layout::Layout): Initialize new fields.
12705         (line_only_debug_sections): New static array.
12706         (is_lines_only_debug_sections): New static inline function.
12707         (Layout::include_section): Handle --strip-debug-non-line.
12708         (Layout::make_output_section): If --strip-debug-non-line, build
12709         new output sections for .debug_abbrev and .debug_info.
12710         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12711         gold.  Warn about possible overflow.
12712         (read_signed_LEB_128): Likewise.
12713         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12714         (read_signed_LEB_128): Declare.
12715         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12716         (HFILES): Add reduced_debug_output.h.
12717         * Makefile.in: Rebuild.
12718
12719 2008-05-21  Ian Lance Taylor  <iant@google.com>
12720
12721         * mapfile.cc: New file.
12722         * mapfile.h: New file.
12723         * options.h (class General_options): Add -M/--print-map and -Map.
12724         * options.cc (General_options::finalize): Make -M equivalent to
12725         -Map -.
12726         * main.cc: Include <cstdio> and "mapfile.h".
12727         (main): Open mapfile if requested.
12728         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12729         constructor.  Change caller.
12730         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12731         (queue_middle_tasks): Likewise.
12732         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12733         declarations.
12734         * archive.cc: Include "mapfile.h".
12735         (Archive::add_symbols): Add mapfile parameter.  Change all
12736         callers.  Pass mapfile, symbol, and reason to include_member.
12737         (Archive::include_all_members): Add mapfile parameter.  Change all
12738         callers.
12739         (Archive::include_member): Add mapfile, sym, and why parameters.
12740         Change all callers.  Report inclusion to map file.
12741         * archive.h: Include "fileread.h".
12742         (class Archive): Update declarations.
12743         (Archive::file): New const method.
12744         (class Add_archive_symbols): Add mapfile_ field.  Update
12745         constructor.  Change all callers.
12746         * readsyms.h (class Read_symbols): Likewise.
12747         (class Finish_group): Likewise.
12748         (class Read_script): Likewise.
12749         * common.cc: Include "mapfile.h".
12750         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12751         all callers.
12752         (Symbol_table::do_allocate_commons): Likewise.
12753         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12754         symbol allocation to mapfile.
12755         * common.h (class Allocate_commons_task): Add mapfile_ field.
12756         Update constructor.  Change all callers.
12757         * symtab.h (class Symbol_table): Update declarations.
12758         * layout.cc: Include "mapfile.h".
12759         (Layout_task_runner::run): Print information to mapfile.
12760         (Layout::create_gold_note): Change Output_data_fixed_space to
12761         Output_data_zero_fill.
12762         (Layout::create_build_id): Likewise.
12763         (Layout::print_to_mapfile): New function.
12764         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12765         constructor.  Change caller.
12766         (class Layout): Declare print_to_mapfile.
12767         * output.cc (Output_section::Input_section::print_to_mapfile): New
12768         function.
12769         (Output_section::add_input_section): If producing a map, always
12770         add to input_sections_ list.
12771         (Output_section::do_print_to_mapfile): New function.
12772         (Output_segment::print_sections_to_mapfile): New function.
12773         (Output_segment::print_section_list_to_mapfile): New function.
12774         * output.h: Include "mapfile.h".
12775         (Output_data::print_to_mapfile): New function.
12776         (Output_data::do_print_to_mapfile): New virtual function.
12777         (Output_segment_headers::do_print_to_mapfile): New function.
12778         (Output_file_header::do_print_to_mapfile): New function.
12779         (Output_data_const::do_print_to_mapfile): New function.
12780         (class Output_data_const_buffer): Add map_name_ field.  Update
12781         constructor.  Change all callers.  Add do_print_to_mapfile
12782         function.
12783         (class Output_data_fixed_space): Likewise.
12784         (class Output_data_space): Likewise.
12785         (class Output_data_zero_fill): New class.
12786         (Output_data_strtab::do_print_to_mapfile): New function.
12787         (Output_data_reloc_base::do_print_to_mapfile): New function.
12788         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12789         (Output_data_group::do_print_to_mapfile): New function.
12790         (Output_data_got::do_print_to_mapfile): New function.
12791         (Output_data_dynamic::do_print_to_mapfile): New function.
12792         (Output_symtab_xindex::do_print_to_mapfile): New function.
12793         (class Output_section): Declare do_print_to_mapflie.  Declare
12794         print_to_mapfile in Input_section.
12795         (class Output_segment): Declare new functions.
12796         * object.h (Sized_relobj::symbol_count): New function.
12797         * script-sections.cc
12798         (Output_section_element_dot_assignment::set_section_addresses):
12799         Change Output_data_fixed_space to Output_data_zero_fill.
12800         (Output_data_expression::do_print_to_mapfile): New function.
12801         * script.cc (read_input_script): Add mapfile parameter.  Change
12802         all callers.
12803         * script.h (read_input_script): Update declaration.
12804         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12805         (Eh_frame::do_print_to_mapfile): New function.
12806         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12807         (Output_merge_string::do_print_to_mapfile): New function.
12808         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12809         function.
12810         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12811         function.
12812         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12813         function.
12814         * Makefile.am (CCFILES): Add mapfile.cc.
12815         (HFILES): Add mapfile.h.
12816         * Makefile.in: Rebuild.
12817
12818 2008-05-19  Ian Lance Taylor  <iant@google.com>
12819
12820         * options.h (class General_options): Add -z relro.
12821         * layout.cc (Layout::Layout): Initialize relro_segment_.
12822         (Layout::add_output_section_data): Return the output section.
12823         (Layout::make_output_section): Rcognize relro sections and mark
12824         them appropriately.
12825         (Layout::attach_allocated_section_to_segment): Put relro sections
12826         in a PT_GNU_RELRO segment.
12827         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12828         section as relro.
12829         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12830         PT_TLS segments.
12831         (Layout::linkonce_mapping): Map d.rel.ro.local to
12832         .data.rel.ro.local.
12833         (Layout::output_section_name): Us .data.rel.ro.local for any
12834         section which begins with that.
12835         * layout.h (class Layout): Update add_output_section_data
12836         declaration.  Add relro_segment_ field.
12837         * output.cc (Output_section::Output_section): Initialize is_relro_
12838         and is_relro_local_ fields.
12839         (Output_segment::add_output_section): Group relro sections.
12840         (Output_segment::is_first_section_relro): New function.
12841         (Output_segment::maximum_alignment): If there is a relro section,
12842         align the segment to the common page size.
12843         (Output_segment::set_section_addresses): Track whether we are
12844         looking at relro sections.  If the last section is a relro
12845         section, align to the common page size.
12846         (Output_segment::set_section_list_addresses): Add in_relro
12847         parameter.  Change all callers.  Align to the page size when
12848         moving from relro to non-relro section.
12849         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12850         segment.
12851         * output.h (class Output_section): Add is_relro_ and
12852         is_relro_local_ fields.
12853         (Output_section::is_relro): New function.
12854         (Output_section::set_is_relro): New function.
12855         (Output_section::is_relro_local): New function.
12856         (Output_section::set_is_relro_local): New function.
12857         (class Output_segment): Update declarations.
12858         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12859         * sparc.cc (Target_sparc::got_section): Likewise.
12860         * x86_64.cc (Target_x86_64::got_section): Likewise.
12861         * testsuite/relro_test_main.cc: New file.
12862         * testsuite/relro_test.cc: New file.
12863         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12864         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12865         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12866         (relro_test.so, relro_test_pic.o): New targets.
12867         * testsuite/Makefile.in: Rebuild.
12868
12869 2008-05-16  Ian Lance Taylor  <iant@google.com>
12870
12871         * output.cc (Output_segment::add_output_section): Remove front
12872         parameter.
12873         * output.h (class Output_segment): Remove
12874         add_initial_output_section and overloaded add_output_section.
12875         Update declaration of remaining add_output_section.
12876         * layout.cc (Layout::create_interp): Call add_output_section
12877         rather than add_initial_output_section.
12878         (Layout::finish_dynamic_section): Likewise.
12879
12880         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12881         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12882         know the dynamic type.
12883         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12884         field.  Initialize it in constructor.
12885         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12886         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12887         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12888         reloc.
12889
12890         * output.cc (Output_reloc::get_address): Change return type to
12891         Elf_Addr.
12892         * output.h (class Output_reloc): Update get_address declaration.
12893         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12894         for section addresses.
12895
12896 2008-05-09  Ian Lance Taylor  <iant@google.com>
12897
12898         PR 6493
12899         * gold.cc (gold_nomem): Use return value of write.
12900
12901 2008-05-08  Ian Lance Taylor  <iant@google.com>
12902
12903         * symtab.c (Symbol::init_base_output_data): Add version
12904         parameter.  Change all callers.
12905         (Symbol::init_base_output_segment): Likewise.
12906         (Symbol::init_base_constant): Likewise.
12907         (Symbol::init_base_undefined): Likewise.
12908         (Sized_symbol::init_output_data): Likewise.
12909         (Sized_symbol::init_output_segment): Likewise.
12910         (Sized_symbol::init_constant): Likewise.
12911         (Sized_symbol::init_undefined): Likewise.
12912         (Symbol_table::do_define_in_output_data): If the new symbol has a
12913         version, mark it as the default.
12914         (Symbol_table::do_define_in_output_segment): Likewise.
12915         (Symbol_table::do_define_as_constant): Likewise.
12916         * symtab.h (class Symbol): Update declarations.
12917         (class Sized_symbol): Likewise.
12918         * resolve.cc (Symbol::override_version): New function.
12919         (Symbol::override_base): Call override_version.
12920         (Symbol::override_base_with_special): Likewise.
12921         * testsuite/ver_script_8.script: New file.
12922         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12923         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12924         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12925         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12926
12927 2008-05-06  Ian Lance Taylor  <iant@google.com>
12928
12929         PR 6049
12930         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12931         functions.
12932         (class General_options): Remove existing --undefined, and add
12933         --no-undefined instead.  Add new --undefined as synonym for -u.
12934         * archive.cc (Archive::add_symbols): Check whether symbol was
12935         named with -u.
12936         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12937         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12938         all uses.  Add IS_UNDEFINED.  Update declarations to split
12939         different versions of init_base.  Declare init_base_undefined.
12940         (Symbol::is_defined): Handle IS_UNDEFINED.
12941         (Symbol::is_undefined): Likewise.
12942         (Symbol::is_weak_undefined): Call is_undefined.
12943         (Symbol::is_absolute): Handle IS_CONSTANT.
12944         (class Sized_symbol): Update declarations to split different
12945         versions of init.  Declare init_undefined.
12946         (class Symbol_table): Declare new functions.
12947         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12948         Change all callers.
12949         (Symbol::init_base_output_data): Likewise.
12950         (Symbol::init_base_output_segment): Likewise.
12951         (Symbol::init_base_constant): Likewise.
12952         (Symbol::init_base_undefined): New function.
12953         (Sized_symbol::init_object): Rename from init.  Change all
12954         callers.
12955         (Sized_symbol::init_output_data): Likewise.
12956         (Sized_symbol::init_output_segment): Likewise.
12957         (Sized_symbol::init_constant): Likewise.
12958         (Sized_symbol::init_undefined): New function.
12959         (Symbol_table::add_undefined_symbols_from_command_line): New
12960         function.
12961         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12962         function.
12963         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12964         (Symbol::output_section): Likewise.
12965         (Symbol::set_output_section): Likewise.
12966         (Symbol_table::sized_finalize_symbol): Likewise.
12967         (Symbol_table::sized_write_globals): Likewise.
12968         * resolve.cc (Symbol_table::should_override): Likewise.
12969         (Symbol::override_base_with_special): Likewise.
12970
12971         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12972         symbol, change it to have default visibility.
12973         * testsuite/protected_1.cc: New file.
12974         * testsuite/protected_2.cc: New file.
12975         * testsuite/protected_3.cc: New file.
12976         * testsuite/protected_main_1.cc: New file.
12977         * testsuite/protected_main_2.cc: New file.
12978         * testsuite/protected_main_3.cc: New file.
12979         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12980         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
12981         (protected_1_LDFLAGS, protected_1_LDADD): Define.
12982         (protected_1.so): New target.
12983         (protected_1_pic.o, protected_2_pic.o): New targets.
12984         (protected_3_pic.o): New target.
12985         (check_PROGRAMS): Add protected_2.
12986         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
12987         (protected_2_LDFLAGS, protected_2_LDADD): Define.
12988         * testsuite/Makefile.in: Rebuild.
12989
12990         * options.h (DEFINE_var): Add set_user_set_##varname__.
12991         (DEFINE_bool_alias): New macro.
12992         (class General_options): Define -Bstatic using DEFINE_bool_alias
12993         rather than DEFINE_special.  Add --undefined as an alias for -z
12994         defs.
12995         * options.cc (General_options::parse_Bstatic): Remove.
12996
12997         * options.h (class General_options): Add --fatal-warnings.
12998         * main.cc (main): Implement --fatal-warnings.
12999         * errors.h (Errors::warning_count): New function.
13000
13001         * options.h (class General_options): Add -Bsymbolic-functions.
13002         * symtab.h (Symbol::is_preemptible): Check for
13003         -Bsymbolic-functions.
13004
13005 2008-05-05  Ian Lance Taylor  <iant@google.com>
13006
13007         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13008         as noVARNAME rather than no-VARNAME.
13009         (class General_options): Add option -z combreloc.
13010         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13011         get_address.
13012         (Output_reloc::sort_before) [SHT_REL]: New function.
13013         (Output_reloc::sort_before) [SHT_RELA]: New function.
13014         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13015         Sort_relocs_comparison.
13016         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13017         parameter.  Change all callers.
13018         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13019         sort_relocs parameter.  Change all callers.
13020         * output.cc (Output_reloc::get_address): New function, broken out
13021         of write_rel.
13022         (Output_reloc::write_rel): Call it.
13023         (Output_reloc::compare): New function.
13024         (Output_data_reloc_base::do_write): Optionally sort relocs.
13025
13026         * configure.ac: If targ_extra_obj is set, link it in.
13027         * configure.tgt: Initialize all variables.
13028         (x86_64*): Set targ_extra_obj and targ_extra_size.
13029         * configure: Rebuild.
13030
13031         * object.cc (Sized_relobj::include_section_group): Adjust section
13032         indexes read from group data.  Build vector to pass to
13033         layout_group.
13034         * layout.cc (Layout::layout_group): Add flags and shndxes
13035         parameters.  Remove contents parameter.  Change caller.  Update
13036         explicit instantiations.
13037         * layout.h (class Layout): Update layout_group declaration.
13038         * output.cc (Output_data_group::Output_data_group): Add flags and
13039         input_shndxes parameters.  Remove contents parameter.  Change
13040         caller.
13041         (Output_data_group::do_write): Change input_sections_ to
13042         input_shndxes_.
13043         * output.h (class Output_data_group): Update constructor
13044         declaration.  Rename input_sections_ to input_shndxes_.
13045         * testsuite/many_sections_test.cc: Add template.
13046
13047 2008-04-30  Cary Coutant  <ccoutant@google.com>
13048
13049         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13050
13051         * layout.cc (Layout::include_section): Refactored check for debug
13052         info section.
13053         (Layout::add_comdat): Add new parameters.  Change type
13054         of signature parameter.  Add object and shndx to signatures table.
13055         (Layout::find_kept_object): New function.
13056         * layout.h: Include <cstring>.
13057         (Layout::is_debug_info_section): New function.
13058         (Layout::add_comdat): Add new parameters.
13059         (Layout::find_kept_object): New function.
13060         (Layout::Kept_section): New struct.
13061         (Layout::Signatures): Change type of map range.
13062         * object.cc (Relobj::output_section_address): New function.
13063         (Sized_relobj::include_section_group): Add new parameters.  Change
13064         calls to Layout::add_comdat.  Change to build table of kept comdat
13065         groups and table mapping discarded sections to kept sections.
13066         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13067         (Sized_relobj::do_layout): Change calls to include_section_group and
13068         include_linkonce_section.
13069         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13070         value to zero when section is discarded.
13071         (Sized_relobj::map_to_kept_section): New function.
13072         * object.h (Relobj::output_section_address): New function.
13073         (Relobj::Comdat_group): New type.
13074         (Relobj::find_comdat_group): New function.
13075         (Relobj::Comdat_group_table): New type.
13076         (Relobj::Kept_comdat_section): New type.
13077         (Relobj::Kept_comdat_section_table): New type.
13078         (Relobj::add_comdat_group): New function.
13079         (Relobj::set_kept_comdat_section): New function.
13080         (Relobj::get_kept_comdat_section): New function.
13081         (Relobj::comdat_groups_): New field.
13082         (Relobj::kept_comdat_sections_): New field.
13083         (Symbol_value::input_value): Update comment.
13084         (Sized_relobj::map_to_kept_section) New function.
13085         (Sized_relobj::include_linkonce_section): Add new parameter.
13086         * target-reloc.h (Comdat_behavior): New type.
13087         (get_comdat_behavior): New function.
13088         (relocate_section): Add code to map a discarded section to the
13089         corresponding kept section when applying a relocation.
13090
13091 2008-04-30  Craig Silverstein  <csilvers@google.com>
13092
13093         * dwarf_reader.cc (next_generation_count): New static var.
13094         (Addr2line_cache_entry): New struct.
13095         (addr2line_cache): New static var.
13096         (Dwarf_line_info::one_addr2line): Added caching.
13097         (Dwarf_line_info::clear_addr2line_cache): New function.
13098         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13099         cache-size parameter.
13100         (Dwarf_line_info::one_addr2line_cache): New function.
13101         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13102         new cache-size argument to one_addr2line(), and clear cache.
13103
13104 2008-04-28  Cary Coutant  <ccoutant@google.com>
13105
13106         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13107         R_386_PC8 relocations.
13108
13109 2008-04-23  Ian Lance Taylor  <iant@google.com>
13110
13111         * object.cc (Sized_relobj::include_section_group): Check for
13112         invalid section group.
13113
13114         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13115         header size.
13116
13117         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13118         than read for file header.
13119         * archive.cc (Archive::include_member): Likewise.
13120
13121 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13122
13123         * aclocal.m4: Regenerate.
13124         * configure: Regenerate.
13125
13126 2008-04-19  Ian Lance Taylor  <iant@google.com>
13127
13128         * version.cc (version_string): Bump to 1.6.
13129
13130         * testsuite/Makefile.am (many_sections_r_test): New target.
13131         (many_sections_r_test_SOURCES): Remove.
13132         (many_sections_r_test_DEPENDENCIES): Remove.
13133         (many_sections_r_test_LDFLAGS): Remove.
13134         (many_sections_r_test_LDADD): Remove.
13135
13136         * object.cc (Sized_relobj::do_add_symbols): Always pass
13137         local_symbol_count_ to add_from_relobj.
13138
13139         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13140         every thousand variables.
13141         * testsuite/Makefile.in: Rebuild.
13142
13143         * object.cc (Xindex::initialize_symtab_xindex): New function.
13144         (Xindex::read_symtab_xindex): New function.
13145         (Xindex::sym_xindex_to_shndx): New function.
13146         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13147         available.
13148         (Sized_relobj::do_initialize_xindex): New function.
13149         (Sized_relobj::do_read_symbols): Adjust section links.
13150         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13151         parameter.  Change all callers.
13152         (Sized_relobj::include_section_group): Adjust section links and
13153         symbol section indexes.
13154         (Sized_relobj::do_layout): Adjust section links.
13155         (Sized_relobj::do_count_local_symbols): Adjust section links and
13156         symbol section indexes.
13157         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13158         ordinary and special symbols.
13159         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13160         dynsym_xindex parameters.  Change all callers.  Adjust section
13161         links.  Use SHN_XINDEX when needed.
13162         (Sized_relobj::get_symbol_location_info): Adjust section links.
13163         Don't get fooled by special symbols.
13164         * object.h (class Xindex): Define.
13165         (class Object): Add xindex_ parameter.  Declare virtual functoin
13166         do_initialize_xindex.
13167         (Object::adjust_sym_shndx): New function.
13168         (Object::set_xindex): New protected function.
13169         (class Symbol_value): Add is_ordinary_shndx_ field.
13170         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13171         (Symbol_value::value): Assert ordinary section.
13172         (Symbol_value::initialize_input_to_output_map): Likewise.
13173         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13174         Change all callers.
13175         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13176         all callers.
13177         (class Sized_relobj): Update declarations.
13178         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13179         parameter.  Change all callers.
13180         (Sized_relobj::adjust_shndx): New function.
13181         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13182         field.
13183         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13184         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13185         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13186         (Sized_dynobj::read_dynsym_section): Adjust section links.
13187         (Sized_dynobj::read_dynamic): Likewise.
13188         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13189         section links.
13190         (Sized_dynobj::do_initialize_xindex): New function.
13191         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13192         do_initialize_xindex.
13193         (Sized_dynobj::adjust_shndx): New function.
13194         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13195         dynsym_xindex_ fields.
13196         (Layout::finalize): Add a call to set_section_indexes before
13197         creating the symtab sections.
13198         (Layout::set_section_indexes): Don't do anything if the section
13199         already has a section index.
13200         (Layout::create_symtab_sections): Add shnum parameter.  Change
13201         caller.  Create .symtab_shndx section if needed.
13202         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13203         caller.
13204         (Layout::allocated_output_section_count): New function.
13205         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13206         needed.
13207         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13208         fields.  Update declarations.
13209         (Layout::symtab_xindex): New function.
13210         (Layout::dynsym_xindex): New function.
13211         (class Write_symbols_task): Add layout_ field.
13212         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13213         Change caller.
13214         * output.cc (Output_section_headers::Output_section_headers): Add
13215         shstrtab_section parameter.  Change all callers.
13216         (Output_section_headers::do_sized_write): Store overflow values
13217         for section count and section string table section index in
13218         section header zero.
13219         (Output_file_header::do_sized_write): Check for overflow of
13220         section count and section string table section index.
13221         (Output_symtab_xindex::do_write): New function.
13222         (Output_symtab_xindex::endian_do_write): New function.
13223         * output.h (class Output_section_headers): Add shstrtab_section_.
13224         Update declarations.
13225         (class Output_symtab_xindex): Define.
13226         (Output_section::has_out_shndx): New function.
13227         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13228         field.
13229         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13230         Change all callers.
13231         (Sized_symbol::init): Likewise.
13232         (Symbol::output_section): Check for ordinary symbol.
13233         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13234         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13235         callers.
13236         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13237         Change all callers.  Simplify handling of symbols from sections
13238         not included in the link.
13239         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13240         distinction.
13241         (Weak_alias_sorter::operator()): Assert that symbols are
13242         ordinary.
13243         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13244         distinction.
13245         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13246         parameters.  Change all callers.
13247         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13248         symbol distinction.  Use SHN_XINDEX when needed.
13249         (Symbol_table::write_section_symbol): Add symtab_xindex
13250         parameter.  Change all callers.
13251         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13252         SHN_XINDEX when needed.
13253         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13254         declarations.
13255         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13256         (Symbol::is_defined): Check is_ordinary.
13257         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13258         (Symbol::is_absolute, Symbol::is_common): Likewise.
13259         (class Sized_symbol): Update declarations.
13260         (class Symbol_table): Update declarations.
13261         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13262         parameters.  Change all callers.
13263         (Sized_symbol::override): Likewise.
13264         (Symbol_table::override): Likewise.
13265         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13266         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13267         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13268         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13269         to be in an ordinary section.
13270         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13271         object and is_ordinary parameters.  Change all callers.
13272         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13273         Change all callers.  Don't add undefined or non-ordinary symbols
13274         to reloc_map_.
13275         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13276         Change all callers.
13277         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13278         declarations.
13279         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13280         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13281         (Sized_relobj::relocate_sections): Likewise.
13282         * target-reloc.h (scan_relocs): Adjust section symbol index.
13283         (scan_relocatable_relocs): Likewise.
13284         * i386.cc (Scan::local): Check for ordinary symbols.
13285         * sparc.cc (Scan::local): Likewise.
13286         * x86_64.cc (Scan::local): Likewise.
13287         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13288         to symbol_section_and_value.
13289         * testsuite/many_sections_test.cc: New file.
13290         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13291         (check_PROGRAMS): Add many_sections_test.
13292         (many_sections_test_SOURCES): Define.
13293         (many_sections_test_DEPENDENCIES): Define.
13294         (many_sections_test_LDFLAGS): Define.
13295         (BUILT_SOURCES): Add many_sections_define.h.
13296         (many_sections_define.h): New target.
13297         (BUILT_SOURCES): Add many_sections_check.h.
13298         (many_sections_check.h): New target.
13299         (check_PROGRAMS): Add many_sections_r_test.
13300         (many_sections_r_test_SOURCES): Define.
13301         (many_sections_r_test_DEPENDENCIES): Define.
13302         (many_sections_r_test_LDFLAGS): Define.
13303         (many_sections_r_test_LDADD): Define.
13304         (many_sections_r_test.o): New target.
13305         * testsuite/Makefile.in: Rebuild.
13306
13307 2008-04-17  Cary Coutant  <ccoutant@google.com>
13308
13309         * errors.cc (Errors::info): New function.
13310         (gold_info): New function.
13311         * errors.h (Errors::info): New function.
13312         * gold.h (gold_info): New function.
13313         * object.cc (Input_objects::add_object): Print trace output.
13314         * options.cc (options::parse_set): New function.
13315         (General_options::parse_wrap): Deleted.
13316         (General_options::General_options): Deleted initializer.
13317         * options.h (options::String_set): New typedef.
13318         (options::parse_set): New function.
13319         (DEFINE_set): New macro.
13320         (General_options::wrap): Changed to use DEFINE_set. Changed
13321         callers of any_wrap_symbols and is_wrap_symbol.
13322         (General_options::trace, General_options::trace_symbol):
13323         New options.
13324         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13325         (General_options::wrap_symbols_): Deleted.
13326         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13327
13328 2008-04-17  David S. Miller  <davem@davemloft.net>
13329
13330         * options.cc (General_options::parse_V): New function.
13331         * options.h: Add entries for -V and -Qy.
13332
13333 2008-04-17  Ian Lance Taylor  <iant@google.com>
13334
13335         * common.cc (Symbol_table::allocate_commons): Remove options
13336         parameter.  Change caller.
13337         (Symbol_table::do_allocate_commons): Remove options parameter.
13338         Change caller.  Just call do_allocate_commons_list twice.
13339         (Symbol_table::do_allocate_commons_list): New function, broken out
13340         of do_allocate_commons.
13341         * common.h (class Allocate_commons_task): Remove options_ field.
13342         Update constructor.
13343         * symtab.cc (Symbol_table::Symbol_table): Initialize
13344         tls_commons_.
13345         (Symbol_table::add_from_object): Put TLS common symbols on
13346         tls_commons_ list.
13347         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13348         which are IN_OUTPUT_DATA.
13349         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13350         allocate_commons and do_allocate_commons declarations.  Declare
13351         do_allocate_commons_list.
13352         * gold.cc (queue_middle_tasks): Update creation of
13353         Allocate_commons_task to not pass options.
13354         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13355         (TLS_TEST_C_FLAGS): New variable.
13356         (tls_test_c_pic.o): New target.
13357         (tls_test_shared.so): Link in tls_test_c_pic.o.
13358         (tls_test_c_pic_ie.o): New target.
13359         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13360         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13361         (tls_test_c.o): New target.
13362         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13363         (tls_pic_test_LDADD): Likewise.
13364         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13365         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13366         (tls_test_c_gnu2.o): New target.
13367         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13368         tls_test_c_gnu2.o.
13369         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13370         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13371         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13372         * testsuite/tls_test.cc: Include "config.h".
13373         (t_last): Call t11_last.
13374         * testsuite/tls_test.h (t11, t11_last): Declare.
13375         * testsuite/tls_test_c.c: New file.
13376         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13377         * configure.ac: Check for OpenMP support.
13378         * configure, config.in, Makefile.in: Rebuild.
13379         * testsuite/Makefile.in: Rebuild.
13380
13381 2008-04-16  Cary Coutant  <ccoutant@google.com>
13382
13383         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13384         (Target_i386::tls_base_symbol_defined_): New field.
13385         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13386         (Target_i386::Scan::global): Likewise.
13387         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13388         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13389         (Target_x86_64::tls_base_symbol_defined_): New field.
13390         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13391         (Target_x86_64::Scan::global): Likewise.
13392
13393 2008-04-16  Cary Coutant  <ccoutant@google.com>
13394
13395         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13396         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13397         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13398         building shared libraries.
13399         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13400         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13401         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13402         * testsuite/Makefile.in: Rebuild.
13403         * testsuite/weak_undef.h: New file.
13404         * testsuite/weak_undef_file1.cc: Add extra test cases.
13405         * testsuite/weak_undef_file2.cc: Likewise.
13406         * testsuite/weak_undef_test.cc: Likewise.
13407
13408 2008-04-16  David S. Miller  <davem@davemloft.net>
13409
13410         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13411         Add issued_non_pic_error_ field.  Declare check_non_pic.
13412         (Target_sparc::Scan::check_non_pic): New function.
13413         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13414         (Target_sparc::Scan::global): Likewise.
13415
13416         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13417         * configure: Rebuild.
13418
13419         * options.h (DEFINE_enable): New macro.
13420         (new_dtags): New enable option.
13421         (initfirst, interpose, loadfltr, nodefaultlib,
13422         nodelete, nodlopen, nodump): New -z options.
13423         * layout.cc (Layout:finish_dynamic_section): If new
13424         dtags enabled, emit DT_RUNPATH.  Also, emit a
13425         DT_FLAGS_1 containing any specified -z flags.
13426
13427 2008-04-16  Ian Lance Taylor  <iant@google.com>
13428
13429         * copy-relocs.cc: New file.
13430         * copy-relocs.h: New file.
13431         * reloc.cc: Remove Copy_relocs code.
13432         * reloc.h: Likewise.
13433         * reloc-types.h (struct Reloc_types) [both versions]: Add
13434         get_reloc_addend_noerror.
13435         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13436         variants of add_global which take an addend which must be zero.
13437         * i386.cc: Include "copy-relocs.h".
13438         (class Target_i386): Change type of copy_relocs_ to variable,
13439         update initializer.
13440         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13441         Change all callers.
13442         (Target_i386::do_finalize_sections): Change handling of
13443         copy_relocs_.
13444         * sparc.cc: Include "copy-relocs.h".
13445         (class Target_sparc): Change type of copy_relocs_ to variable,
13446         update initializer.
13447         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13448         Change all callers.
13449         (Target_sparc::do_finalize_sections): Change handling of
13450         copy_relocs_.
13451         * x86_64.cc: Include "copy-relocs.h".
13452         (class Target_x86_64): Change type of copy_relocs_ to variable,
13453         update initializer.
13454         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13455         class.  Change all callers.
13456         (Target_x86_64::do_finalize_sections): Change handling of
13457         copy_relocs_.
13458         * Makefile.am (CCFILES): Add copy-relocs.cc.
13459         (HFILES): Add copy-relocs.h.
13460
13461         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13462
13463         * testsuite/script_test_4.sh: Permit leading zeroes.
13464
13465 2008-04-15  Ian Lance Taylor  <iant@google.com>
13466
13467         * script-sections.cc (Script_sections::create_segments): Use
13468         header_size_adjustment even when there is enough room for the
13469         headers.
13470         * testsuite/script_test_4.sh: New file.
13471         * testsuite/script_test_4.t: New file.
13472         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13473         (check_DATA): Add script_test_4.stdout.
13474         (MOSTLYCLEANFILES): Likewise.
13475         (script_test_4): New target.
13476         (script_test_4.stdout): New target.
13477         * testsuite/Makefile.in: Rebuild.
13478
13479         * sparc.cc: Add definitions for Output_data_plt_sparc class
13480         constants.
13481
13482 2008-04-14  David S. Miller  <davem@davemloft.net>
13483
13484         * sparc.cc: New file.
13485         * Makefile.am (TARGETSOURCES): Add sparc.cc
13486         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13487         * configure.tgt: Document targ_extra_size and
13488         targ_extra_big_endian.  Add entries for sparc-* and
13489         sparc64-*.
13490         * configure.ac: Handle targ_extra_size and
13491         targ_extra_big_endian.
13492         * Makefile.in: Rebuild.
13493         * configure: Likewise.
13494         * po/POTFILES.in: Likewise.
13495         * po/gold.pot: Likewise.
13496
13497 2008-04-14  Ian Lance Taylor  <iant@google.com>
13498
13499         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13500         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13501         in the name/type/flags to section mapping.  Don't call
13502         allocate_output_section.
13503         (Layout::choose_output_section): Change parameter from adjust_name
13504         to is_input_section.  Don't permit input sections after sections
13505         are attached to segments.  Don't call allocate_output_section.
13506         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13507         not write_enable_output_section.
13508         (Layout::make_output_section): Don't push to
13509         unattached_section_list_ nor call attach_to_segment.  Call
13510         attach_section_to_segment if sections are attached.
13511         (Layout::attach_sections_to_segments): New function.
13512         (Layout::attach_section_to_segment): New function.
13513         (Layout::attach_allocated_section_to_segment): Rename from
13514         attach_to_segment.  Remove flags parameter.
13515         (Layout::allocate_output_section): Remove function.
13516         (Layout::write_enable_output_section): Remove function.
13517         * layout.h (class Layout): Update for above changes.  Add new
13518         field sections_are_attached_.
13519         * output.h (Output_section::update_flags_for_input_section): New
13520         function.
13521         * output.cc (Output_section::add_input_section): Call
13522         update_flags_for_input_section.
13523         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13524
13525 2008-04-11  Cary Coutant  <ccoutant@google.com>
13526
13527         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13528         thought unnecessary.
13529         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13530
13531 2008-04-11  Ian Lance Taylor  <iant@google.com>
13532
13533         * output.h (class Output_section_data): Remove inline definition
13534         of set_addralign.
13535         * output.cc (Output_section_data::set_addralign): New function.
13536
13537 2008-04-11  Cary Coutant  <ccoutant@google.com>
13538
13539         Add support for TLS descriptors for i386 and x86_64.
13540         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13541         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13542         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13543         GOT_TYPE_TLS_DESC.
13544         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13545         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13546         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13547         relocations.
13548         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13549         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13550         Fix problem with initial-exec relocations.
13551         (Target_i386::Relocate::relocate_tls): Likewise.
13552         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13553         relaxation.
13554         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13555         support for section-plus-offset dynamic table entries.
13556         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13557         (Output_data_dynamic::Dynamic_entry): Add support for
13558         section-plus-offset dynamic table entries.
13559         (Output_data_dynamic::Classification): Likewise.
13560         (Output_data_dynamic::classification_): Renamed offset_.
13561         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13562         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13563         (Target_x86_64::make_plt_section): New function.
13564         (Target_x86_64::reserve_tlsdesc_entries): New function.
13565         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13566         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13567         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13568         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13569         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13570         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13571         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13572         add extra PLT entry for TLS descriptors.
13573         (Output_data_plt_x86_64::got_): New field.
13574         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13575         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13576         fields.
13577         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13578         descriptors.
13579         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13580         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13581         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13582         R_386_TLS_DESC_CALL relocations.
13583         (Target_x86_64::Scan::global): Likewise.
13584         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13585         for TLS descriptors.
13586         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13587         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13588         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13589         GD-to-IE relaxation.
13590         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13591         and TLS_DESCRIPTORS.
13592         * Makefile.in: Rebuild.
13593         * configure: Rebuild.
13594         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13595         (tls_test_shared2.so): New target.
13596         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13597         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13598         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13599         (tls_shared_gd_to_ie_test_LDADD): New variable.
13600         (tls_shared_gnu2_gd_to_ie_test): New target.
13601         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13602         New targets.
13603         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13604         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13605         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13606         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13607         (tls_shared_gnu2_test): New target.
13608         (tls_test_gnu2_shared.so): New target.
13609         (tls_shared_gnu2_test_SOURCES): New variable.
13610         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13611         (tls_shared_gnu2_test_LDFLAGS): New variable.
13612         (tls_shared_gnu2_test_LDADD): New variable.
13613         * testsuite/Makefile.in: Rebuild.
13614         * testsuite/Makefile.
13615
13616 2008-04-11  Ian Lance Taylor  <iant@google.com>
13617
13618         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13619         justsyms.t.
13620         * testsuite/Makefile.in: Rebuild.
13621
13622         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13623         long.
13624         * testsuite/script_test_2.cc (main): Adjust test.
13625
13626 2008-04-11  David S. Miller  <davem@davemloft.net>
13627             Ian Lance Taylor  <iant@google.com>
13628
13629         * options.h (General_options): Add entries for '-Y' and
13630         '-relax'.
13631         * options.cc (General_options:finalize): If -Y was used, add those
13632         entries to the library path instead of the default "/lib" and
13633         "/usr/lib".
13634
13635 2008-04-11  David S. Miller  <davem@davemloft.net>
13636
13637         * testsuite/justsyms.t: Start at 0x100.
13638         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13639         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13640         long.
13641         * testsuite/script_test_2.cc: Adjust string and section length
13642         checks.
13643
13644 2008-04-09  Ian Lance Taylor  <iant@google.com>
13645
13646         PR gold/5996
13647         * script-sections.cc (Sections_element::allocate_to_segment): Add
13648         orphan parameter.
13649         (Output_section_definition::allocate_to_segment): Likewise.
13650         (Orphan_output_section::allocate_to_segment): Likewise.
13651         (Script_sections::attach_sections_using_phdrs_clause): Don't
13652         propagate non-PT_LOAD segments to orphan sections.
13653         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13654         readelf rather than objdump.
13655         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13656         .interp section and PT_INTERP segment are the same size.
13657         * testsuite/Makefile.in: Rebuild.
13658
13659         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13660         aliases for symbols defined in the same object.
13661         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13662         (weak_alias_test_SOURCES): New variable.
13663         (weak_alias_test_DEPENDENCIES): New variable.
13664         (weak_alias_test_LDFLAGS): New variable.
13665         (weak_alias_test_LDADD): New variable.
13666         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13667         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13668         (weak_alias_test_3.o): New target.
13669         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13670         * testsuite/weak_alias_test_main.cc: New file.
13671         * testsuite/weak_alias_test_1.cc: New file.
13672         * testsuite/weak_alias_test_2.cc: New file.
13673         * testsuite/weak_alias_test_3.cc: New file.
13674
13675 2008-04-08  Ian Lance Taylor  <iant@google.com>
13676
13677         * options.h (class General_options): Add --noinhibit-exec option.
13678         * main.cc (main): Check --noinhibit-exec.
13679
13680         * options.h (class General_options): Define --wrap as a special
13681         option.  Add wrap_symbols_ field.
13682         (General_options::any_wrap_symbols): New function.
13683         (General_options::is_wrap_symbol): New function.
13684         * options.cc (General_options::parse_wrap): New function.
13685         (General_options::General_options): Initialize wrap_symbols_.
13686         * symtab.cc (Symbol_table::wrap_symbol): New function.
13687         (Symbol_table::add_from_object): Handle --wrap.
13688         * symtab.h (class Symbol_table): Declare wrap_symbol.
13689         * target.h (Target::wrap_char): New function.
13690         (Target::Target_info): Add wrap_char field.
13691         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13692         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13693         * testsuite/testfile.cc (Target_test::test_target_info):
13694         Likewise.
13695
13696         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13697         there is one.
13698
13699         * layout.h (class Layout): Add added_eh_frame_data_ field.
13700         * layout.cc (Layout::Layout): Initialize new field.
13701         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13702         output section until we find a section we merged successfully.
13703         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13704         that the size be non-zero.
13705
13706         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13707         qualifier.
13708
13709 2008-04-08  Craig Silverstein  <csilvers@google.com>
13710
13711         * configure.ac: Export new conditional variable HAVE_ZLIB.
13712         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13713         on HAVE_ZLIB.
13714         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13715         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13716
13717 2008-04-07  Ian Lance Taylor  <iant@google.com>
13718
13719         * version.cc (version_string): Set to "1.5".
13720
13721         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13722         Add issued_non_pic_error_ field.  Declare check_non_pic.
13723         (Target_x86_64::Scan::check_non_pic): New function.
13724         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13725         (Target_x86_64::Scan::global): Likewise.
13726
13727         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13728         addend parameter.  Change caller.  Handle merge sections.
13729         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13730         Address to Addend.  Don't add in the result of
13731         local_section_offset, pass down the addend and use the returned
13732         value.
13733         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13734         Update declarations of local_section_offset and symbol_value.
13735         * testsuite/two_file_test_1.cc (t18): New function.
13736         * testsuite/two_file_test_2.cc (f18): New function.
13737         * testsuite/two_file_test_main.cc (main): Call t18.
13738         * testsuite/two_file_test.h (t18, f18): Declare.
13739
13740         * configure.ac: Don't test for objdump, c++filt, or readelf.
13741         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13742         conditionals.
13743         (TEST_READELF): New variable.
13744         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13745         (check_PROGRAMS): Add two_file_strip_test.
13746         (two_file_strip_test): New target.
13747         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13748         (two_file_same_shared_strip_test_SOURCES): New variable.
13749         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13750         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13751         (two_file_same_shared_strip_test_LDADD): New variable.
13752         (two_file_shared_strip.so): New target.
13753         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13754         (ver_test_5.syms, ver_test_7.syms): Likewise.
13755         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13756         (strip_test_3.stdout): Use TEST_OBJDUMP.
13757         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13758
13759 2008-04-04  Cary Coutant  <ccoutant@google.com>
13760
13761         * symtab.h (Symbol::is_weak_undefined): New function.
13762         (Symbol::is_strong_undefined): New function.
13763         (Symbol::is_absolute): New function.
13764         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13765         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13766         absolute symbols.
13767         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13768         (weak_undef_test): New target.
13769         * testsuite/Makefile.in: Rebuild.
13770         * testsuite/weak_undef_file1.cc: New file.
13771         * testsuite/weak_undef_file2.cc: New file.
13772         * testsuite/weak_undef_test.cc: New file.
13773
13774 2008-04-03  Craig Silverstein  <csilvers@google.com>
13775
13776         * compressed_output.h (class Output_compressed_section): Use
13777         unsigned buffer.
13778         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13779         add zlib header.
13780         (zlib_compressed_suffix): Removed.
13781         (Output_compressed_section::set_final_data_size): Use unsigned
13782         buffers.
13783         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13784         Fix linker invocation.
13785         (flagstest_o_specialfile_and_compress_debug_sections):
13786         Likewise.
13787         * testsuite/Makefile.in: Regenerated.
13788
13789 2008-04-02  David S. Miller  <davem@davemloft.net>
13790
13791         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13792         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13793
13794 2008-04-02  Craig Silverstein  <csilvers@google.com>
13795
13796         * TODO: New file.
13797
13798 2008-04-02  Ian Lance Taylor  <iant@google.com>
13799
13800         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13801         parameters.  Update for new key type to views_.  Change all
13802         callers.
13803         (File_read::read): Adjust for byteshift in returned view.
13804         (File_read::add_view): New function, broken out of
13805         find_and_make_view.
13806         (File_read::make_view): New function, broken out of
13807         find_and_make_view.
13808         (File_read::find_or_make_view): Add offset and aligned
13809         parameters.  Rewrite accordingly.  Change all callers.
13810         (File_read::get_view): Add offset and aligned parameters.  Adjust
13811         for byteshift in return value.
13812         (File_read::get_lasting_view): Likewise.
13813         * fileread.h (class File_read): Update declarations.
13814         (class File_read::View): Add byteshift_ field.  Add byteshift to
13815         constructor.  Add byteshift method.
13816         * archive.h (Archive::clear_uncached_views): New function.
13817         (Archive::get_view): Add aligned parameter.  Change all callers.
13818         * object.h (Object::get_view): Add aligned parameter.  Change all
13819         callers.
13820         (Object::get_lasting_view): Likewise.
13821
13822         * fileread.cc (File_read::release): Don't call clear_views if
13823         there are multiple objects.
13824         * fileread.h (File_read::clear_uncached_views): New function.
13825         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13826         on the archive.
13827
13828 2008-03-31  Cary Coutant  <ccoutant@google.com>
13829
13830         Add thin archive support.
13831         * archive.cc (Archive::armagt): New const.
13832         (Archive::setup): Remove task parameter and calls to unlock.
13833         (Archive::unlock_nested_archives): New function.
13834         (Archive::read_header): Add nested_off parameter. Change
13835         all callers.
13836         (Archive::interpret_header): Likewise.
13837         (Archive::include_all_members): Change to handle thin
13838         archives.
13839         (Archive::include_member): Likewise.
13840         * archive.h (Archive::Archive): Add new parameters and
13841         initializers.
13842         (Archive::armagt): New const.
13843         (Archive::setup): Remove task parameter.
13844         (Archive::unlock_nested_archives): New function.
13845         (Archive::read_header): Add nested_off parameter.
13846         (Archive::interpret_header): Likewise.
13847         (Archive::Nested_archive_table): New typedef.
13848         (Archive::is_thin_archive_): New field.
13849         (Archive::nested_archives_): New field.
13850         (Archive::options_): New field.
13851         (Archive::dirpath_): New field.
13852         (Archive::task_): New field.
13853         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13854         for thin archives.  Pass additional parameters to
13855         Archive::Archive.  Unlock the archive file after calling
13856         Archive::setup.
13857
13858 2008-03-29  Ian Lance Taylor  <iant@google.com>
13859
13860         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13861         version symbol to be local.
13862         * testsuite/ver_test_4.sh: New file.
13863         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13864         (check_DATA): Add ver_test_4.syms.
13865         (ver_test_4.syms): New target.
13866         * testsuite/Makefile.in: Rebuild.
13867
13868         * output.cc
13869         (Output_section::Input_section_sort_entry::has_priority): New
13870         function.
13871         (Output_section::Input_section_sort_entry::match_file_name): New
13872         function.
13873         (Output_section::Input_section_sort_entry::match_section_name):
13874         Remove.
13875         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13876         Remove.
13877         (Output_section::Input_section_sort_entry::match_section_file):
13878         Remove.
13879         (Output_section::Input_section_sort_compare::operator()): Rewrite
13880         using new Input_section_sort_entry functions.  Sort crtbegin and
13881         crtend first.  Sort sections with no priority before sections with
13882         a priority.
13883         * testsuite/initpri1.c (d3): Check j != 4.
13884         (cd5): New constructor/destructor function.
13885         (main): Check j != 2.
13886
13887         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13888         new symbol when resolving, don't call set_is_default.
13889         * testsuite/ver_test_7.cc: New file.
13890         * testsuite/ver_test_7.sh: New file.
13891         * testsuite/Makefile.am (ver_test_7.so): New target.
13892         (ver_test_7.o): New target.
13893         (check_SCRIPTS): Add ver_test_7.sh.
13894         (check_DATA): Add ver_test_7.syms.
13895         (ver_test_7.syms): New target.
13896
13897 2008-03-28  Ian Lance Taylor  <iant@google.com>
13898
13899         * layout.cc (Layout::layout): If we see an input section with a
13900         name that needs sorting, set the must_sort flag for the output
13901         section.
13902         (Layout::make_output_section): If the name of the output section
13903         indicates that it might require sorting, set the may_sort flag.
13904         * output.h (Output_section::may_sort_attached_input_sections): New
13905         function.
13906         (Output_section::set_may_sort_attached_input_sections): New
13907         function.
13908         (Output_section::must_sort_attached_input_sections): New
13909         function.
13910         (Output_section::set_must_sort_attached_input_sections): New
13911         function.
13912         (class Output_section): Declare Input_section_sort_entry.  Define
13913         Input_section_sort_compare.  Declare
13914         sort_attached_input_sections.  Add new fields:
13915         may_sort_attached_input_sections_,
13916         must_sort_attached_input_sections_,
13917         attached_input_sections_are_sorted_.
13918         * output.cc (Output_section::Output_section): Initialize new
13919         fields.
13920         (Output_section::add_input_section): Add an entry to
13921         input_sections_ if may_sort or must_sort are true.
13922         (Output_section::set_final_data_size): Call
13923         sort_attached_input_sections if necessary.
13924         (Output_section::Input_section_sort_entry): Define new class.
13925         (Output_section::Input_section_sort_compare::operator()): New
13926         function.
13927         (Output_section::sort_attached_input_sections): New function.
13928         * configure.ac: Check whether the compiler supports constructor
13929         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13930         * testsuite/initpri1.c: New file.
13931         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13932         CONSTRUCTOR_PRIORITY.
13933         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13934         (initpri1_LDFLAGS): New variable.
13935         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13936
13937 2008-03-27  Ian Lance Taylor  <iant@google.com>
13938
13939         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13940         * testsuite/common_test_1.c: New file.
13941         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13942         (common_test_1_SOURCES): New variable.
13943         (common_test_1_DEPENDENCIES): New variable.
13944         (common_test_1_LDFLAGS): New variable.
13945
13946         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13947         and commons_ correctly when NAME/VERSION does not override
13948         NAME/NULL.
13949         * testsuite/ver_test_6.c: New file.
13950         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13951         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13952         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13953
13954 2008-03-26  Ian Lance Taylor  <iant@google.com>
13955
13956         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13957         of an undefined symbol from a version script.
13958         * testsuite/Makefile.am (ver_test_5.so): New target.
13959         (ver_test_5.o): New target.
13960         (check_SCRIPTS): Add ver_test_5.sh.
13961         (check_DATA): Add ver_test_5.syms.
13962         (ver_test_5.syms): New target.
13963         * testsuite/ver_test_5.cc: New file.
13964         * testsuite/ver_test_5.script: New file.
13965         * testsuite/ver_test_5.sh: New file.
13966         * Makefile.in, testsuite/Makefile.in: Rebuild.
13967
13968         PR gold/5986
13969         Fix problems building gold with gcc 4.3.0.
13970         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13971         (gold_error_at_location, gold_warning_at_location): Use it.
13972         * configure.ac: Check whether we can compile and use a template
13973         function with a printf attribute.
13974         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13975         when jumping over bytes.
13976         * object.cc: Instantiate Object::read_section_data.
13977         * debug.h: Include <cstring>
13978         * dwarf_reader.cc: Include <algorithm>
13979         * main.cc: Include <cstring>.
13980         * options.cc: Include <cstring>.
13981         * output.cc: Include <cstring>.
13982         * script.cc: Include <cstring>.
13983         * script.h: Include <string>.
13984         * symtab.cc: Include <cstring> and <algorithm>.
13985         * target-select.cc: Include <cstring>.
13986         * version.cc: Include <string>.
13987         * testsuite/testmain.cc: Include <cstdlib>.
13988         * configure, config.in: Rebuild.
13989
13990 2008-03-25  Ian Lance Taylor  <iant@google.com>
13991
13992         * options.cc: Include "../bfd/bfdver.h".
13993         (options::help): Print bug reporting address.
13994
13995         * version.cc (print_version): Adjust output for current value of
13996         BFD_VERSION_STRING.
13997
13998         * NEWS: New file.
13999
14000         * options.cc (options::help): Print list of supported targets.
14001         * target-select.h: Include <vector>.
14002         (class Target_selector): Make machine_, size_, and is_big_endian_
14003         fields const.  Add bfd_name_ and instantiated_target_ fields.
14004         (Target_selector::Target_selector): Add bfd_name parameter.
14005         (Target_selector::recognize): Make non-virtual, call
14006         do_recognize.
14007         (Target_selector::recognize_by_name): Make non-virtual, call
14008         do_recognize_by_name.
14009         (Target_selector::supported_names): New function.
14010         (Target_selector::bfd_name): New function.
14011         (Target_selector::do_instantiate_target): New pure virtual
14012         function.
14013         (Target_selector::do_recognize): New virtual function.
14014         (Target_selector::do_recognize_by_name): New virtual function.
14015         (Target_selector::instantiate_target): New private function.
14016         (supported_target_names): Declare.
14017         * target-select.cc (Target_selector::Target_selector): Update for
14018         new parameter and fields.
14019         (select_target_by_name): Check that the name matches before
14020         calling recognize_by_name.
14021         (supported_target_names): New function.
14022         * i386.cc (class Target_selector_i386): Update Target_selector
14023         constructor call.  Remove recognize and recognize_by_name.  Add
14024         do_instantiate_target.
14025         * x86_64.cc (class Target_selector_x86_64): Likewise.
14026         * testsuite/testfile.cc (class Target_selector_test): Update for
14027         changes to Target_selector.
14028
14029         * README: Rewrite, with some notes on unsupported features.
14030
14031 2008-03-24  Cary Coutant  <ccoutant@google.com>
14032
14033         * i386.cc (Target_i386::Got_type): New enum declaration.
14034         (Target_i386::Scan::local): Updated callers of Output_data_got
14035         member functions.
14036         (Target_i386::Scan::global): Likewise.
14037         (Target_i386::Relocate::relocate): Likewise.
14038         (Target_i386::Relocate::relocate_tls): Likewise.
14039         * object.h (Got_offset_list): New class.
14040         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14041         (Sized_relobj::local_got_offset): Likewise.
14042         (Sized_relobj::set_local_got_offset): Likewise.
14043         (Sized_relobj::local_has_tls_got_offset): Removed.
14044         (Sized_relobj::local_tls_got_offset): Removed.
14045         (Sized_relobj::set_local_tls_got_offset): Removed.
14046         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14047         * output.cc (Output_data_got::add_global): Added got_type parameter.
14048         (Output_data_got::add_global_with_rel): Likewise.
14049         (Output_data_got::add_global_with_rela): Likewise.
14050         (Output_data_got::add_global_pair_with_rel): New function.
14051         (Output_data_got::add_global_pair_with_rela): New function.
14052         (Output_data_got::add_local): Added got_type parameter.
14053         (Output_data_got::add_local_with_rel): Likewise.
14054         (Output_data_got::add_local_with_rela): Likewise.
14055         (Output_data_got::add_local_pair_with_rel): New function.
14056         (Output_data_got::add_local_pair_with_rela): New function.
14057         (Output_data_got::add_global_tls): Removed.
14058         (Output_data_got::add_global_tls_with_rel): Removed.
14059         (Output_data_got::add_global_tls_with_rela): Removed.
14060         (Output_data_got::add_local_tls): Removed.
14061         (Output_data_got::add_local_tls_with_rel): Removed.
14062         (Output_data_got::add_local_tls_with_rela): Removed.
14063         * output.h (Output_data_got::add_global): Added got_type parameter.
14064         (Output_data_got::add_global_with_rel): Likewise.
14065         (Output_data_got::add_global_with_rela): Likewise.
14066         (Output_data_got::add_global_pair_with_rel): New function.
14067         (Output_data_got::add_global_pair_with_rela): New function.
14068         (Output_data_got::add_local): Added got_type parameter.
14069         (Output_data_got::add_local_with_rel): Likewise.
14070         (Output_data_got::add_local_with_rela): Likewise.
14071         (Output_data_got::add_local_pair_with_rel): New function.
14072         (Output_data_got::add_local_pair_with_rela): New function.
14073         (Output_data_got::add_global_tls): Removed.
14074         (Output_data_got::add_global_tls_with_rel): Removed.
14075         (Output_data_got::add_global_tls_with_rela): Removed.
14076         (Output_data_got::add_local_tls): Removed.
14077         (Output_data_got::add_local_tls_with_rel): Removed.
14078         (Output_data_got::add_local_tls_with_rela): Removed.
14079         * resolve.cc (Symbol::override_base_with_special): Removed
14080         reference to has_got_offset_ field.
14081         * symtab.cc (Symbol::init_fields): Replaced initialization
14082         of got_offset_ with got_offsets_.  Removed initialization
14083         of has_got_offset_
14084         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14085         (Symbol::got_offset): Likewise.
14086         (Symbol::set_got_offset): Likewise.
14087         (Symbol::has_tls_got_offset): Removed.
14088         (Symbol::tls_got_offset): Removed.
14089         (Symbol::set_tls_got_offset): Removed.
14090         (Symbol::got_offset_): Removed.
14091         (Symbol::tls_mod_got_offset_): Removed.
14092         (Symbol::tls_pair_got_offset_): Removed.
14093         (Symbol::got_offsets_): New field.
14094         (Symbol::has_got_offset): Removed.
14095         (Symbol::has_tls_mod_got_offset): Removed.
14096         (Symbol::has_tls_pair_got_offset): Removed.
14097         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14098         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14099         member functions.
14100         (Target_x86_64::Scan::global): Likewise.
14101         (Target_x86_64::Relocate::relocate): Likewise.
14102         (Target_x86_64::Relocate::relocate_tls): Likewise.
14103
14104 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14105
14106         * yyscript.y: Fix spelling error in comment.
14107
14108 2008-03-24  Ian Lance Taylor  <iant@google.com>
14109
14110         * options.h (class General_options): Define build_id option.
14111         * layout.h (class Layout): Declare write_build_id, create_note,
14112         create_build_id.  Add build_id_note_ member.
14113         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14114         "libiberty.h", "md5.h", "sha1.h".
14115         (Layout::Layout): Initialize eh_frame_data_,
14116         eh_frame_hdr_section_, and build_id_note_.
14117         (Layout::finalize): Call create_build_id.
14118         (Layout::create_note): New function, broken out of
14119         Layout::create_gold_note.
14120         (Layout::create_gold_note): Call create_note.
14121         (Layout::create_build_id): New function.
14122         (Layout::write_build_id): New function.
14123         (Close_task_runner::run): Call write_build_id.
14124
14125         * x86_64.cc: Correct license to GPLv3.
14126
14127 2008-03-23  Ian Lance Taylor  <iant@google.com>
14128
14129         * options.cc: Include "demangle.h".
14130         (parse_optional_string): New function.
14131         (parse_long_option): Handle takes_optional_argument.
14132         (parse_short_option): Update dash_z initializer.  Handle
14133         takes_optional_argument.
14134         (General_options::General_options): Initialize do_demangle_.
14135         (General_options::finalize): Set do_demangle_.  Handle demangling
14136         style.
14137         * options.h (parse_optional_string): Declare.
14138         (struct One_option): Add optional_arg field.  Update constructor.
14139         Update call constructor calls.  Add takes_optional_argument
14140         function.
14141         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14142         (DEFINE_optional_string): Define.
14143         (General_options::demangle): Change from DEFINE_bool to
14144         DEFINE_optional_string.
14145         (General_options::no_demangle): New function.
14146         (General_options::do_demangle): New function.
14147         (General_options::set_do_demangle): New function.
14148         (General_options::execstack_status_): Move definition to end of
14149         class definition.
14150         (General_options::static_): Likewise.
14151         (General_options::do_demangle_): New field.
14152         * object.cc (big_endian>::get_symbol_location_info): Call
14153         Options::do_demangle, not Options::demangle.
14154         * symtab.cc (demangle): Likewise.
14155
14156 2008-03-22  Ian Lance Taylor  <iant@google.com>
14157
14158         * gold.h: Include <cstddef> and <sys/types.h>
14159         * options.h: Include <cstring>.
14160
14161 2008-03-21  Ian Lance Taylor  <iant@google.com>
14162
14163         * Added source code to GNU binutils.