gold/
[external/binutils.git] / gold / ChangeLog
1 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2
3         * testsuite/binary_unittest.cc (read_all): New function.
4         (Sized_binary_test): Use it instead of ::read.
5         * fileread.cc (do_read): Don't assume pread always reads the whole
6         amount in a single call.
7
8 2012-12-10  Alan Modra  <amodra@gmail.com>
9
10         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
11         Set EM_PPC64 or EM_PPC here.
12         (Target_selector_powerpc::do_recognize): Delete.
13
14 2012-12-10  Alan Modra  <amodra@gmail.com>
15
16         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
17         stub_table_.
18         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
19
20 2012-12-07  Roland McGrath  <mcgrathr@google.com>
21
22         * testsuite/binary_unittest.cc (Sized_binary_test):
23         Use open_descriptor rather than ::open.
24
25 2012-12-07  Alan Modra  <amodra@gmail.com>
26
27         * powerpc.cc (Stub_table::do_write): Delete redundant Address
28         typedef and invalid_address constant.
29         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
30         instantiate constants.
31
32 2012-12-06  Roland McGrath  <mcgrathr@google.com>
33
34         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
35         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
36         * aclocal.m4: Regenerate.
37         * configure: Regenerate.
38         * Makefile.in: Regenerate.
39         * testsuite/Makefile.in: Regenerate.
40
41 2012-12-07  Alan Modra  <amodra@gmail.com>
42
43         * options.h (General_options): Add no_toc_optimize.
44         * powerpc.cc (ok_lo_toc_insn): New function.
45         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
46
47 2012-12-06  Alan Modra  <amodra@gmail.com>
48
49         * options.h (General_options): Add plt_align, plt_static_chain,
50         plt_thread_safe.  Update stub_group_size help text.
51         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
52         for new plt_thread_safe_ var.
53         (use_plt_offset): Correct comments.
54         (Target_powerpc::do_relax): Look for thread creation symbols to
55         determine default plt_thread_safe value.  Clear plt call stubs
56         as well as branch stubs each iteration.
57         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
58         insn constants.
59         (l, hi, ha, write_insn): Move earlier.
60         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
61         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
62         plt stubs too.
63         (Stub_table::update_size): Adjust.
64         (Stub_table::prev_size, set_prev_size): Delete.
65         (Stub_table::stub_align): Let --plt-align affect result.
66         (Stub_table::plt_call_size): Calculate sizes for various stubs.
67         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
68         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
69         (Stub_table::do_write): Support more stub variants.
70
71 2012-12-04  Alan Modra  <amodra@gmail.com>
72
73         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
74         (Target_powerpc::do_define_standard_symbols): New function.
75
76 2012-12-03  Alan Modra  <amodra@gmail.com>
77
78         * output.h: Formatting, whitespace.
79
80 2012-12-03  Alan Modra  <amodra@gmail.com>
81
82         * layout.h (Layout::get_executable_sections): Declare.
83         * layout.cc (Layout::get_executable_sections): New function.
84         * arm.cc (Target_arm::group_sections): Use it.
85         (Arm_output_section::group_sections): Delete now redundant test.
86         * output.cc (Output_reloc::Output_reloc): Add is_relative.
87         param to handle relative relocs.
88         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
89         (Output_data_reloc::add_absolute): Adjust.
90         (Output_data_reloc::add_relative): New function.
91         (Output_data::reset_data_size): New function.
92         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
93         (Output_section::set_addralign): New function.
94         (Output_section::checkpoint_set_addralign): New function.
95         (Output_section::clear_section_offsets_need_adjustment): New function.
96         (Output_section::input_sections): Make public.
97         * powerpc.cc (class Output_data_brlt_powerpc): New.
98         (class Stub_table, class Stub_control): New.
99         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
100         stub_table_, set_stub_table, stub_table): New vectors and accessor
101         functions.
102         (Target_powerpc::do_may_relax, do_relax, push_branch,
103         new_stub_table, stub_tables, brlt_section, group_sections,
104         add_branch_lookup_table, find_branch_lookup_table,
105         write_branch_lookup_table, make_brlt_section): New functions.
106         (Target_powerpc::struct Sort_sections, class Branch_info): New.
107         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
108         branch_info_): New vars.
109         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
110         make call stubs here.
111         (Output_data_glink): Remove all call stub handling from this class.
112         (Target_powerpc::Scan::local, global): Save interesting branch
113         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
114         (Target_powerpc::do_finalize_sections): Only make reg save/restore
115         functions on final link.
116         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
117         Handle long branch destinations too.
118         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
119         do_plt_address_for_local): Adjust lookup of plt call stubs.
120
121 2012-11-30  Alan Modra  <amodra@gmail.com>
122
123         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
124         relocs against protected symbols when building 32-bit shared libs.
125
126 2012-11-30  Alan Modra  <amodra@gmail.com>
127
128         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
129         param.  Call got_section() to make .got.  Update all callers
130         and their callers and so on.
131
132 2012-11-30  Alan Modra  <amodra@gmail.com>
133
134         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
135         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
136         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
137         value if it already exists.
138
139 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
140
141         PR gold/14858
142         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
143
144 2012-11-14  Roland McGrath  <mcgrathr@google.com>
145
146         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
147         than bfc instruction for data sandboxing.
148
149 2012-11-08  Alan Modra  <amodra@gmail.com>
150
151         * po/POTFILES.in: Regenerate.
152
153 2012-11-05  Alan Modra  <amodra@gmail.com>
154
155         * configure.ac: Apply 2012-09-10 change to config.in here.
156         * configure: Regenerate.
157
158 2012-11-05  Alan Modra  <amodra@gmail.com>
159
160         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
161         (struct Opd_ent): Use "Address" rather than "Offset".
162         (Output_data_got_powerpc::got_base_offset): Return Valtype.
163         (Target_powerpc::got_section): Make public.
164         (Target_powerpc::scan_relocs): Move code setting symbols..
165         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
166         Create _SDA_BASE_ only when referenced.
167
168 2012-11-02  Roland McGrath  <mcgrathr@google.com>
169
170         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
171         from last change.
172
173 2012-11-01  Roland McGrath  <mcgrathr@google.com>
174
175         * target.h (Sized_target::relocate_relocs): Use Elf_Off
176         for offset_in_output_section parameter.
177         (Sized_target::relocate_special_relocatable): Likewise.
178         * arm.cc (Target_arm::relocate_relocs): Likewise.
179         (Target_arm::relocate_special_relocatable): Likewise.
180         * i386.cc (Target_i386::relocate_relocs): Likewise.
181         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
182         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
183         * target-reloc.h (relocate_relocs): Likewise.
184         * testsuite/testfile.cc (Target_test): Likewise.
185         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
186         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
187
188         * system.h: Move inclusion of <clocale> to after <libintl.h> in
189         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
190
191         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
192         parameter, which is unused in the [!F_SETFD] case.
193
194         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
195         SYMNDX to off_t before comparing it to this->data_size().
196         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
197         * incremental.cc (Output_section_incremental_inputs::do_write):
198         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
199
200         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
201
202 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
203
204         * gold.cc (Target_arm::do_adjust_elf_header): Add the
205         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
206         in EABI_VER5.
207
208 2012-10-29  Cary Coutant  <ccoutant@google.com>
209
210         * dwp.cc (usage): Add file and exit status parameters;
211         add --help and --version options.
212         (print_version): New function.
213         (main): Add --help and --version options.
214
215 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
216
217         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
218         final_layout_sequence.txt.
219         * testsuite/Makefile.in: Regenerated.
220
221 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
222
223         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
224         COMPILE generated by automake.
225         (LINK1): Likewise.
226         (CXXCOMPILE1): Likewise.
227         (CXXLINK1): Likewise.
228         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
229         (LINK): Likewise.
230         (CXXCOMPILE): Likewise.
231         (CXXLINK): Likewise.
232         * testsuite/Makefile.in: Regenerated.
233
234 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
235
236         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
237         on bad fwrite return.
238
239 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
240
241         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
242         on val.
243
244 2012-10-23  Cary Coutant  <ccoutant@google.com>
245
246         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
247         * testsuite/Makefile.in: Regenerate.
248         * testsuite/dwp_test.h: New source file.
249         * testsuite/dwp_test_1.cc: New source file.
250         * testsuite/dwp_test_1.s: New source file.
251         * testsuite/dwp_test_1.sh: New source file.
252         * testsuite/dwp_test_1b.cc: New source file.
253         * testsuite/dwp_test_1b.s: New source file.
254         * testsuite/dwp_test_2.cc: New source file.
255         * testsuite/dwp_test_2.s: New source file.
256         * testsuite/dwp_test_2.sh: New source file.
257         * testsuite/dwp_test_main.cc: New source file.
258         * testsuite/dwp_test_main.s: New source file.
259
260 2012-10-23  Cary Coutant  <ccoutant@google.com>
261
262         * dwp.h: New header file.
263         * dwp.cc: New source file.
264         * gold.h: Move shared declarations to system.h.
265         * system.h: New header file.
266         * Makefile.am: Add dwp.
267         * Makefile.in: Regenerate.
268
269 2012-10-23  Cary Coutant  <ccoutant@google.com>
270
271         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
272         Dwarf_info_reader::read_from_pointer.
273         (Dwarf_pubnames_table::read_header): Likewise.
274         (Dwarf_pubnames_table::next_name): Likewise.
275         (Dwarf_die::read_attributes): Likewise.
276         (Dwarf_die::skip_attributes): Likewise.
277         (Dwarf_info_reader::read_from_pointer): New function template.
278         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
279         (Dwarf_pubnames_table): Likewise.
280         (Dwarf_info_reader::read_from_pointer): New function template.
281         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
282         Dwarf_pubnames_table ctor.
283
284 2012-10-23  Cary Coutant  <ccoutant@google.com>
285
286         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
287         abbrev_shndx.
288         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
289         abbrev_shndx_.
290         (Dwarf_info_reader::set_abbrev_shndx): New method.
291         (Dwarf_info_reader::abbrev_shndx_): New data member.
292
293 2012-10-23  Cary Coutant  <ccoutant@google.com>
294
295         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
296         from object, not parameters.
297         (Dwarf_info_reader::parse): Likewise.
298         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
299         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
300         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
301         methods.
302
303 2012-10-23  Cary Coutant  <ccoutant@google.com>
304
305         * fileread.cc (Input_file::Input_file): New constructor.
306         * fileread.h (class Input_file): Add new constructor.
307
308 2012-10-18  Alan Modra  <amodra@gmail.com>
309
310         PR gold/14727
311         * object.cc (Relobj::is_section_name_included): Also match
312         .sdata personality section.
313
314 2012-10-18  Alan Modra  <amodra@gmail.com>
315
316         * target-reloc.h (class Default_comdat_behavior): New, package up..
317         (get_comdat_behaviour): ..this.
318         (relocate_section): Add Relocate_comdat_behavior template arg,
319         adjust code to suit.
320         * arm.cc (Target_arm::relocate_section): Adjust to suit.
321         (Target_arm::scan_reloc_section): Likewise.
322         * i386.cc (Target_i386::relocate_section): Likewise.
323         * sparc.cc (Target_sparc::relocate_section): Likewise.
324         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
325         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
326         * powerpc.cc (class Relocate_comdat_behavior): New.
327         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
328         gold::relocate_section with new template arg.
329
330 2012-10-18  Alan Modra  <amodra@gmail.com>
331
332         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
333         dynamic relocs for GOT_TPREL got entries, without symbol if
334         resolving locally.
335         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
336         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
337         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
338
339 2012-10-17  Alan Modra  <amodra@gmail.com>
340
341         PR gold/14726
342         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
343
344 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
345
346         * layout.cc (Layout::include_section): Keep sections marked
347         SHF_EXCLUDE when doing relocatable links.
348
349 2012-10-16  Alan Modra  <amodra@gmail.com>
350
351         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
352         (Target_powerpc::do_finalize_sections): Call it.
353         (Output_data_save_res): New class and supporting functions.
354         (Target_powerpc::symval_for_branch): Only look up .opd entry for
355         normal symbols defined in object files.
356
357 2012-10-12  Alan Modra  <amodra@gmail.com>
358
359         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
360         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
361         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
362         section if scan_opd_relocs not yet called.
363         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
364
365 2012-10-12  Alan Modra  <amodra@gmail.com>
366
367         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
368         add_local_ifunc_entry): Revert last change.
369         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
370
371 2012-10-05  Alan Modra  <amodra@gmail.com>
372
373         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
374         do_plt_address_for_global): New functions.
375         (Output_data_got_powerpc::do_write): Don't segfault when linking
376         statically.
377         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
378         add_local_ifunc_entry): Return true on adding entry..
379         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
380         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
381         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
382         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
383         set up symbols here.
384         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
385         syms here.  Do so even when no .iplt.  Don't segfault when linking
386         statically.
387         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
388         new variants without reloc param.
389         (Glink_sym_ent::Glink_sym_ent): Likewise.
390         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
391         reloc when refs will resolve to plt call stub.
392         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
393         R_PPC_PLTREL24 to resolve locally.
394         (Target_powerpc::Scan::global): Correct ifunc handling.
395         (Target_powerpc::Relocate::relocate): Correct local sym glink
396         lookup.  Don't destroy "value" when we have a plt call stub,
397         and when checking plt call validity.
398         (Target_powerpc::do_dynsym_value): Simplify.
399
400 2012-10-05  Alan Modra  <amodra@gmail.com>
401
402         * i386.cc (Output_data_plt_i386::address_for_global,
403         address_for_local): Add plt offset to returned value.  Adjust uses.
404         * sparc.cc (Output_data_plt_sparc::address_for_global,
405         address_for_local): Likewise.
406         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
407         address_for_local): Likewise.
408         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
409         address_for_local): Likewise.
410         * target.h (Target::plt_address_for_global, plt_address_for_local):
411         Update comment.
412         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
413         (Output_data_got::Got_entry::write): Nor here.
414         * output.h: Comment fix.
415
416 2012-10-02  Jiong Wang  <jiwang@tilera.com>
417
418         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
419         global_offset_table_ value for larget got.
420         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
421
422 2012-09-29  Alan Modra  <amodra@gmail.com>
423
424         * powerpc.cc (Target_powerpc::iplt_): New output section.
425         (Target_powerpc::iplt_section, make_iplt_section,
426         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
427         (Target_powerpc::make_plt_entry): Handle ifunc syms.
428         Target_powerpc::plt_entry_count): Count iplt entries too.
429         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
430         reloc section in constructor.  New params.
431         (Target_powerpc::make_plt_section): Create reloc section here instead.
432         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
433         functions.
434         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
435         (Output_data_glink::add_entry, find_entry): New functions to
436         deal with local syms.
437         (Glink_sym_ent): Add support for local syms.
438         (Output_data_glink::do_write): Handle ifunc plt entries.
439         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
440         (Target_powerpc::Scan::local, global): Handle ifunc syms.
441         (Target_powerpc::Relocate::relocate): Likewise.
442         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
443
444 2012-09-25  Alan Modra  <amodra@gmail.com>
445
446         * object.h (Sized_relobj_file::adjust_local_symbol,
447         do_adjust_local_symbol): New functions.
448         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
449         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
450         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
451         and irregular opd entry spacing.
452         (Powerpc_relobj::do_read_relocs): Add opd size checks.
453         (Global_symbol_visitor_opd): New functor.
454         (Target_powerpc::do_finalize_sections): Omit global symbols defined
455         on deleted opd entries.
456
457 2012-09-15  Jiong Wang  <jiwang@tilera.com>
458
459         * tilegx.cc: New file.
460         * Makefile.am (TARGETSOURCES): Add tilegx.cc
461         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
462         * configure.tgt: Add entries for tilegx*.
463         * configure.ac: Likewise.
464         * Makefile.in: Rebuild.
465         * configure: Likewise.
466         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
467         tilegx.
468
469 2012-09-13  Alan Modra  <amodra@gmail.com>
470
471         * target-reloc.h (scan_relocs): Call scan.local for relocs
472         against symbols in discarded sections.  Pass is_discarded
473         param.
474         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
475         Add is_discarded param.
476         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
477         is_discarded to flag opd entry as discarded.  Don't emit dyn
478         relocs on such entries.
479         (Target_powerpc::Scan::global): Similarly detect and handle
480         such opd entries.
481         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
482         opd_ent_.  Update all uses.
483         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
484         (Target_powerpc::relocate_section): Zero out discarded opd
485         entry relocs.
486
487 2012-09-12  Ian Lance Taylor  <iant@google.com>
488
489         PR gold/14570
490         * output.cc: Rename Output_data_got template parameter from size
491         to got_size for all functions.  Compile all variants of
492         Output_data_got.
493         (Output_data_got::Got_entry::write): Correct use of size for
494         symbol value.  Use local_is_tls rather than casting to
495         Sized_relobj_file.
496         * object.h (class Object): Add local_is_tls and do_local_is_tls.
497         (class Sized_relobj_file): Add do_local_is_tls.
498         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
499
500 2012-09-11  Alan Modra  <amodra@gmail.com>
501
502         PR gold/14566
503         * layout.cc (Layout::set_segment_offsets): When using
504         common-page-size alignment, ensure we are on a new max-page-size
505         page.
506         * output.cc (Output_segment::set_section_addresses): Use
507         abi_pagesize, not common_pagesize for relro boundary.
508         (Output_segment::set_offset): Likewise.
509
510 2012-09-11  Alan Modra  <amodra@gmail.com>
511
512         * output.h (Output_data_got::add_global_tls, add_local_tls,
513         add_local_tls_pair): New functions.
514         (Output_data_got::add_local_pair_with_rel): Remove second
515         reloc param.  Expand comment.
516         (Output_data_got::Got_entry): Rename use_plt_offset_ to
517         use_plt_or_tls_offset_, similarly for constructor param.
518         (Output_data_got::Got_entry::write): Add got_index param.
519         * output.cc (Output_data_got::add_global_tls, add_local_tls,
520         add_local_tls_pair): New functions.
521         (Output_data_got::Got_entry::write): Handle tls symbols
522         with use_plt_or_tls_offset_ set specially.
523         (Output_data_got::add_local_pair_with_rel): Only one reloc.
524         (Output_data_got::do_write): Replace iterator with index, pass
525         index to entry write function.
526         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
527         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
528         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
529         call.
530         * i386.cc (Target_i386::Scan::local): Likewise.
531         * sparc.cc (Target_sparc::Scan::local): Likewise.
532         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
533         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
534         do_tls_offset_for_global): New functions.
535         (Target_powerpc::Scan::local): Correct TLS relocations and got
536         entry values.
537         (Target_powerpc::Scan::global): Don't emit unnecessary
538         dynamic relocations on TLS GOT entries.
539
540 2012-09-10  Matthias Klose  <doko@ubuntu.com>
541
542         * config.in: Disable sanity check for kfreebsd.
543
544 2012-09-10  Sterling Augustine  <saugustine@google.com>
545
546         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
547         (Gdb_index::pubtypes_read): New parameter.
548         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
549         to calls.
550         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
551         pubtypes_object_.
552
553 2012-09-09  Alan Modra  <amodra@gmail.com>
554
555         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
556         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
557         * gc.h (gc_process_relocs): Call target gc_add_reference.
558         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
559         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
560         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
561         unnecessary cast.
562         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
563         to cater for when we don't need code offset.  Update use.
564         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
565         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
566         set_opd_valid): New functions.
567         (Target_powerpc::do_gc_add_reference): New function.
568         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
569         stashed refs.
570         (Target_powerpc::do_gc_mark_symbol): New function.
571
572 2012-09-06  Cary Coutant  <ccoutant@google.com>
573
574         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
575         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
576         (Dwarf_die::skip_attributes): Likewise.
577         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
578         * testsuite/gdb_index_test.cc (inline_func_1): New function.
579         (main): Call it.
580         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
581
582 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
583
584         * testsuite/script_test_3.t: Add .got.plt output section
585         statement.
586         * testsuite/script_test_4.t: Likewise.
587
588 2012-09-05  Alan Modra  <amodra@gmail.com>
589
590         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
591         update all uses and lose "enum" when using type.
592
593 2012-09-05  Alan Modra  <amodra@gmail.com>
594
595         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
596         * configure: Regenerate.
597         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
598         (plugin_final_layout.stdout): Likewise.
599         (memory_test): Set page sizes to 0x1000.
600         * testsuite/Makefile.in: Regenerate.
601         * testsuite/discard_locals_test.sh: Add FIXME comment.
602         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
603         * testsuite/pr14265.t: Add .got output section statement.
604         * testsuite/script_test_2.t: Likewise.
605         * testsuite/script_test_3.t: Likewise.
606         * testsuite/script_test_4.t: Likewise.
607         * testsuite/script_test_5.t: Likewise.
608         * testsuite/script_test_6.t: Likewise.
609         * testsuite/script_test_7.t: Likewise.
610         * testsuite/script_test_9.t: Likewise.
611
612 2012-09-05  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
615         (Powerpc_relocate_functions::Status): New typedef.
616         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
617         (Target_powerpc::Scan::local): Handle REL64.
618         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
619         for REL32 and REL64.
620         (Target_powerpc::symval_for_branch): New function, extracted from..
621         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
622         checks.  Report overflow errors.
623
624 2012-09-05  Alan Modra  <amodra@gmail.com>
625
626         * object.h (Sized_relobj_file::emit_relocs): Delete.
627         (Sized_relobj_file::emit_relocs_reltype): Delete.
628         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
629         relocate_relocs for --emit-relocs.
630         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
631         * output.h: Update comment.
632         (Output_segment::first_section): New function.
633         (Output_segment::first_section_load_address): Use first_section.
634         * output.cc (Output_segment::first_section): New function extracted..
635         (Output_segment::first_section_load_address): ..from here.  Delete.
636         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
637         * target.h (Sized_target::relocate_for_relocatable): Likewise.
638         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
639         adjust call to target.h function.
640         * i386.cc (Target_i386): Likewise.
641         * sparc.cc (Target_sparc): Likewise.
642         * x86_64.cc (Target_x86_64): Likewise.
643         * powerpc.cc (Target_powerpc): Likewise.
644         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
645         first tls section has section symbol for optimised local dynamic
646         output relocs.
647         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
648         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
649         optimised tls code.
650         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
651         Rename to relocate_relocs.  Update error message.
652
653 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
654
655         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
656         --just-symbols.
657
658 2012-08-31  Alan Modra  <amodra@gmail.com>
659
660         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
661         (Powerpc_relobj::toc_base_offset): New stub function.
662         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
663         got_mod_index_offset to tlsld_got_offset.  Update all refs.
664         (Target_powerpc::Relocate::enum skip_tls): New.
665         (Target_powerpc::call_tls_get_addr_): New var.
666         (Target_powerpc::is_branch_reloc): Move to file scope.
667         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
668         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
669         New functions.
670         (Target_powerpc::enum Got_type): Delete old values, add new ones.
671         (powerpc_info): Correct common_pagesize for ppc64.
672         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
673         (Powerpc_relocate_functions): Add overflow check enums and functions.
674         Add non-shift version of rela, rela_ua.  Delete all rel public
675         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
676         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
677         addr16_ha3, addr14 functions.
678         (Output_data_got_powerpc::add_constant_pair): New function.
679         (Output_data_got_powerpc::got_base_offset): Likewise.
680         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
681         (instruction constants): Sort, add some more.
682         (Output_data_glink::do_write): Add and use Address typedef.  Use
683         object->toc_base_offset() stub for 64-bit.
684         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
685         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
686         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
687         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
688         Always treat .opd relocs as against locally defined symbol.
689         Correct condition for RELATIVE relocs.
690         (Target_powerpc::do_finalize_sections): Test for NULL sections.
691         (Target_powerpc::Relocate::relocate): Use plt call stub as value
692         for 32-bit syms with a plt entry.  Correct ppc64 toc base
693         calculations.  Handle TLS relocs, and more.  Add overflow
694         checking and adjust for Powerpc_relocate_functions changes.
695         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
696         Reinstate --emit-relocs code with FIXME.
697
698 2012-08-30  Alan Modra  <amodra@gmail.com>
699
700         * layout.cc (Layout::set_segment_offsets): Set p_align to
701         abi_pagesize, not common_pagesize.
702         (Layout::relaxation_loop_body): Similarly use abi_pagesize
703         to determine whether file header can go in segment.
704
705 2012-08-30  Alan Modra  <amodra@gmail.com>
706
707         * output.h (Output_reloc::Output_reloc <output section>): Add
708         is_relative param.  Adjust calls.
709         (Output_reloc::add_output_section_relative): New functions.
710         * output.cc (Output_reloc::Output_reloc <output section>): Handle
711         is_relative.
712         (Output_reloc::symbol_value): Handle SECTION_CODE.
713
714 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
715
716         * gold.cc (queue_middle_tasks): Call layout again when unique
717         segments for sections is desired.
718         * layout.cc (Layout::Layout): Initialize new members.
719         (Layout::get_output_section_flags): New function.
720         (Layout::choose_output_section): Call get_output_section_flags.
721         (Layout::layout): Make output section for mapping to a unique segment.
722         (Layout::insert_section_segment_map): New function.
723         (Layout::attach_allocated_section_to_segment): Make unique segment for
724         output sections marked so.
725         (Layout::segment_precedes): Check for unique segments when sorting.
726         * layout.h (Layout::Unique_segment_info): New struct.
727         (Layout::Section_segment_map): New typedef.
728         (Layout::insert_section_segment_map): New function.
729         (Layout::get_output_section_flags): New function.
730         (Layout::is_unique_segment_for_sections_specified): New function.
731         (Layout::set_unique_segment_for_sections_specified): New function.
732         (Layout::unique_segment_for_sections_specified_): New member.
733         (Layout::section_segment_map_): New member.
734         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
735         Rename is_gc_pass_one to is_pass_one.
736         Rename is_gc_pass_two to is_pass_two.
737         Rename is_gc_or_icf to is_two_pass.
738         Check for which pass based on whether symbols data is present.
739         Make it two pass when unique segments for sections is desired.
740         * output.cc (Output_section::Output_section): Initialize new
741         members.
742         * output.h (Output_section::is_unique_segment): New function.
743         (Output_section::set_is_unique_segment): New function.
744         (Output_section::is_unique_segment_): New member.
745         (Output_section::extra_segment_flags): New function.
746         (Output_section::set_extra_segment_flags): New function.
747         (Output_section::extra_segment_flags_): New member.
748         (Output_section::segment_alignment): New function.
749         (Output_section::set_segment_alignment): New function.
750         (Output_section::segment_alignment_): New member.
751         (Output_segment::Output_segment): Initialize is_unique_segment_.
752         (Output_segment::is_unique_segment): New function.
753         (Output_segment::set_is_unique_segment): New function.
754         (Output_segment::is_unique_segment_): New member.
755         * plugin.cc (allow_unique_segment_for_sections): New function.
756         (unique_segment_for_sections): New function.
757         (Plugin::load): Add new functions to transfer vector.
758         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
759         * Makefile.in: Regenerate.
760         * testsuite/plugin_final_layout.sh: Check if unique segment
761         functionality works.
762         * testsuite/plugin_section_order.c (onload): Check if new interfaces
763         are available.
764         (allow_unique_segment_for_sections): New global.
765         (unique_segment_for_sections): New global.
766         (claim_file_hook): Call allow_unique_segment_for_sections.
767         (all_symbols_read_hook): Call unique_segment_for_sections.
768
769 2012-08-22  Cary Coutant  <ccoutant@google.com>
770
771         * layout.cc (Layout::include_section): Don't assert on GROUP
772         sections with --emit-relocs.
773
774 2012-08-21  Cary Coutant  <ccoutant@google.com>
775
776         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
777         if --export-dynamic-symbol names an undef symbol.
778
779 2012-08-18  Alan Modra  <amodra@gmail.com>
780
781         * powerpc.cc: Formatting and white space.
782         (Powerpc_relobj): Rename got2_section_ to special_.
783         Add opd_ent_shndx_ and opd_ent_off_ vectors.
784         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
785         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
786         (Target_powerpc): Add Address typedef and invalid_address.  Use
787         throughout.
788         (Target_powerpc::is_branch_reloc): New function.
789         (Powerpc_relocate_functions): Add Address typedef, use throughout.
790         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
791         for dst_mask, value and addend.
792         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
793         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
794         (Output_data_glink::do_write): Correct toc base.  Don't try to use
795         uint16_t for 24-bit offset.  Use get_output_section_offset and
796         check return.
797         (Target_powerpc::Scan::local): Handle more relocs.
798         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
799         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
800         Plug in toc restoring insn after plt calls.  Translate branches
801         to function descriptor symbols to corresponding entry point.
802         (Target_powerpc::relocate_for_relocatable): Check return from
803         get_output_section_offset.
804         * symtab.h: Comment typo.
805
806 2012-08-14  Ian Lance Taylor  <iant@google.com>
807
808         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
809         unsupported_relocal_local to call unsupported_reloc_global.
810
811 2012-08-14  Nick Clifton  <nickc@redhat.com>
812
813         PR ld/14265
814         * script-sections.cc (Sections_element::output_section_name): Add
815         keep return parameter.
816         (Output_section_element::match_name): Add keep return parameter.
817         Return the value of the keep_ member.
818         * script-sections.h (class Output_section): Update
819         output_section_name prototype.
820         * layout.cc (Layout::keep_input_section): New public member
821         function.
822         (Layout::choose_output_section): Pass keep parameter to
823         output_section_name.
824         * layout.h (class Layout): Add keep_input_section.
825         * object.cc (Sized_relobj_file::do_layout): Check for kept input
826         sections.
827         * testsuite/Makefile.am: Add a test.
828         * testsuite/Makefile.in: Regenerate.
829         * testsuite/pr14265.c: Source file for the test.
830         * testsuite/pr14265.t: Linker script for the test.
831         * testsuite/pr14265.sh: Shell script for the test.
832
833 2012-08-14  Alan Modra  <amodra@gmail.com>
834
835         * target.h (Target::output_section_name): New function.
836         (Target::do_output_section_name): New function.
837         * layout.cc (Layout::choose_output_section): Call the above.
838         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
839
840 2012-08-14  Alan Modra  <amodra@gmail.com>
841
842         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
843         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
844         for replace_constant call.
845         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
846         (Output_data_glink::do_print_to_mapfile): New function.
847         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
848         (Target_powerpc::Relocate::relocate): Likewise.
849
850 2012-08-14  Alan Modra  <amodra@gmail.com>
851
852         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
853         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
854         (Output_data_glink::add_entry,find_entry): Remove shndx param.
855         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
856         all references to shndx_.  Handle special case for R_PPC_PLTREL24
857         here.
858         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
859         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
860         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
861         here.
862         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
863         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
864
865 2012-08-12  Alan Modra  <amodra@gmail.com>
866
867         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
868         (glink insn constants): Use uint32_t.
869         (Output_data_glink::add_entry): Use insert, not [] operator.
870
871 2012-08-11  Alan Modra  <amodra@gmail.com>
872
873         * object.h (Sized_relobj_file::find_shdr): New function.
874         (Sized_relobj_file::find_special_sections): New function.
875         * object.cc (Sized_relobj_file::find_shdr): New function.
876         (Sized_relobj_file::find_eh_frame): Use find_shdr.
877         (Sized_relobj_file::find_special_sections): New function, split out..
878         (Sized_relobj_file::do_read_symbols): ..from here.
879         * output.h (Output_data_got::replace_constant): New function.
880         (Output_data_got::num_entries): New function.
881         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
882         (Output_data_got::got_offset): Protected rather than private.
883         (Output_data_got::replace_got_entry): New function.
884         * output.cc (Output_data_got::replace_got_entry): New function.
885         * powerpc.cc (class Powerpc_relobj): New.
886         (class Powerpc_relocate_functions): Delete all psymval variants or
887         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
888         Implement _ha functions using corresponding _hi function.
889         (Powerpc_relobj::find_special_sections): New function.
890         (Target_powerpc::do_make_elf_object): New function.
891         (class Output_data_got_powerpc): New.
892         (class Output_data_glink): New.
893         (class Powerpc_scan_relocatable_reloc): New.
894         Many more changes througout file.
895
896 2012-08-09  Nick Clifton  <nickc@redhat.com>
897
898         * po/vi.po: Updated Vietnamese translation.
899
900 2012-08-07  Ian Lance Taylor  <iant@google.com>
901
902         * layout.cc (Layout::add_target_dynamic_tags): If
903         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
904         plt_rel.
905
906 2012-07-30  Nick Clifton  <nickc@redhat.com>
907
908         * po/gold.pot: Updated template.
909         * po/es.po: Updated Spanish translation.
910
911 2012-07-18  Cary Coutant  <ccoutant@google.com>
912
913         PR gold/14344
914         * configure.ac: Add check for -gpubnames support.
915         * configure: Regenerate.
916         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
917         support; force -gno-pubnames.
918         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
919         support.
920         (gdb_index_test_4): New test.
921         * testsuite/Makefile.in: Regenerate.
922         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
923         * testsuite/gdb_index_test_2.sh: Likewise.
924         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
925         * testsuite/gdb_index_test_4.sh: New script.
926         * testsuite/gdb_index_test_comm.sh: New script with common code;
927         don't look for space after colon.
928
929 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
930
931         * gold.cc (queue_middle_tasks): Update function order only after
932         deferred objects due to plugins are processed.
933
934 2012-07-11  Ian Lance Taylor  <iant@google.com>
935
936         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
937         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
938         (Target_arm::scan_reloc_for_stub): Likewise.
939         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
940         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
941         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
942         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
943         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
944
945 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
946             Ian Lance Taylor  <iant@google.com>
947
948         PR gold/14309
949         * configure.ac: Test whether std::tr1::hash<off_t> works.
950         * gold.h: Add a specialization for std::tr1::hash<off_t> if
951         needed.
952         * output.h (class Output_fill): Add virtual destructor.
953         * configure, config.in: Rebuild.
954
955 2012-06-22  Roland McGrath  <mcgrathr@google.com>
956
957         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
958
959 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
960
961         * plugin.cc (Plugin::load): Handle position independent executables.
962
963 2012-06-06  Cary Coutant  <ccoutant@google.com>
964
965         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
966         add .debug_macro.
967         (lines_only_debug_sections): Likewise.
968         (gdb_fast_lookup_sections): New static array.
969         (is_gdb_debug_section): Rename formal parameter.
970         (is_lines_only_debug_section): Likewise.
971         (is_gdb_fast_lookup_section): New function.
972         (Layout::include_section): Check for ".zdebug_" prefix; pass
973         section name suffix to is_gdb_debug_section, et al.; check for
974         fast-lookup sections when building .gdb_index.
975         * options.h (--strip-debug-gdb): Update GDB version number.
976
977 2012-06-06  Cary Coutant  <ccoutant@google.com>
978
979         * configure.ac: Add check for fallocate.
980         * configure: Regenerate.
981         * config.in: Regenerate.
982
983         * options.h (class General_options): Add --mmap-output-file and
984         --posix-fallocate options.
985         * output.cc: (posix_fallocate): Remove; replace with...
986         (gold_fallocate): New function.
987         (Output_file::map_no_anonymous): Call gold_fallocate.
988         (Output_file::map): Check --mmap-output-file option.
989
990 2012-06-05  Jing Yu  <jingyu@google.com>
991
992         * gold.h (textdomain): Add do {} to empty while(0).
993         (bindtextdomain): Likewise.
994
995 2012-06-04  Cary Coutant  <ccoutant@google.com>
996
997         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
998         has_dynsym_index.
999
1000 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1001
1002         * symtab.cc (Symbol_table::define_special_symbol):
1003         Initialize *poldsym to prevent uninitialized variable errors.
1004
1005 2012-05-23  Cary Coutant  <ccoutant@google.com>
1006
1007         * layout.cc (Layout::section_name_mapping): Add rules to handle
1008         exact match on .data.rel.ro.local or .data.rel.ro.
1009         (Layout::output_section_name): Check for exact matches.
1010
1011 2012-05-23  Cary Coutant  <ccoutant@google.com>
1012
1013         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1014         more carefully.
1015
1016 2012-05-22  Cary Coutant  <ccoutant@google.com>
1017
1018         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1019         object before exporting symbol.
1020
1021 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1022
1023         * testsuite/tls_test.cc: Include "config.h" first.
1024         * testsuite/tls_test_c.c: Likewise.
1025
1026 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1027             Nick Clifton  <nickc@redhat.com>
1028
1029         PR 14072
1030         * configure.in: Add check that sysdep.h has been included before
1031         any system header files.
1032         * configure: Regenerate.
1033         * config.in: Regenerate.
1034
1035 2012-05-14  Cary Coutant  <ccoutant@google.com>
1036
1037         * layout.cc (Layout::make_output_section): Mark .tdata section
1038         as RELRO.
1039         * testsuite/relro_test.cc: Add a TLS variable.
1040
1041 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1042
1043         PR gold/14091
1044         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1045         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1046         R_X86_64_64.
1047
1048 2012-05-08  Cary Coutant  <ccoutant@google.com>
1049
1050         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1051         (lines_only_debug_sections): Likewise.
1052
1053 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1054
1055         * nacl.cc: New file.
1056         * nacl.h: New file.
1057         * Makefile.am (CCFILES, HFILES): Add them.
1058         * Makefile.in: Regenerate.
1059         * i386.cc (Output_data_plt_i386_nacl): New class.
1060         (Output_data_plt_i386_nacl_exec): New class.
1061         (Output_data_plt_i386_nacl_dyn): New class.
1062         (Target_i386_nacl): New class.
1063         (Target_selector_i386_nacl): New class.
1064         (target_selector_i386): Use it instead of Target_selector_i386.
1065         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1066         (Target_x86_64_nacl): New class.
1067         (Target_selector_x86_64_nacl): New class.
1068         (target_selector_x86_64, target_selector_x32): Use it instead of
1069         Target_selector_x86_64.
1070         * arm.cc (Output_data_plt_arm_nacl): New class.
1071         (Target_arm_nacl): New class.
1072         (Target_selector_arm_nacl): New class.
1073         (target_selector_arm, target_selector_armbe): Use it instead of
1074         Target_selector_arm.
1075
1076         * target-select.cc (select_target): Take new Input_file* and off_t
1077         arguments, pass them on to recognize method of selector.
1078         * object.cc (make_elf_sized_object): Update caller.
1079         * parameters.cc (parameters_force_valid_target): Likewise.
1080         * incremental.cc (make_sized_incremental_binary): Likewise.
1081         * target-select.h: Update decl.
1082         (Target_selector::recognize): Take new Input_file* argument,
1083         pass it on to do_recognize.
1084         (Target_selector::do_recognize): Take new Input_file* argument.
1085         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1086         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1087         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1088         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1089
1090         * target.h (Target::Target_info): New members isolate_execinstr
1091         and rosegment_gap.
1092         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1093         * arm.cc (Target_arm::arm_info): Update initializer.
1094         * i386.cc (Target_i386::i386_info): Likewise.
1095         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1096         * sparc.cc (Target_sparc::sparc_info): Likewise.
1097         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1098         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1099         * layout.cc (Layout::attach_allocated_section_to_segment):
1100         Take new const Target* argument.  If target->isolate_execinstr(), act
1101         like --rosegment.
1102         (Layout::find_first_load_seg): Take new const Target* argument;
1103         if target->isolate_execinstr(), reject PF_X segments.
1104         (Layout::relaxation_loop_body): Update caller.
1105         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1106         reset file offset to zero when we hit LOAD_SEG, and then do a second
1107         loop over the segments before LOAD_SEG to reassign offsets after
1108         addresses have been determined.  Handle target->rosegment_gap().
1109         (Layout::attach_section_to_segment): Take new const Target* argument;
1110         pass it to attach_allocated_section_to_segment.
1111         (Layout::make_output_section): Update caller.
1112         (Layout::attach_sections_to_segments): Take new const Target* argument;
1113         pass it to attach_section_to_segment.
1114         * gold.cc (queue_middle_tasks): Update caller.
1115         * layout.h (Layout): Update method decls with new arguments.
1116
1117         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1118         Target_info pointer to use.
1119         (Target_arm::do_make_data_plt): New virtual method.
1120         (Target_arm::make_data_plt): New method that calls it.
1121         (Target_arm::make_plt_entry): Use it.
1122         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1123         for the section alignment.
1124         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1125         method.
1126         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1127         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1128         method.
1129         (Output_data_plt_arm::get_plt_entry_size): Call it.
1130         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1131         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1132         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1133         method.
1134         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1135         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1136         method instead of sizeof(plt_entry).
1137         (Output_data_plt_arm::add_entry): Likewise.
1138         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1139         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1140         than static method.
1141         (Target_arm::plt_entry_size): Likewise.
1142         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1143         Move to ...
1144         (Output_data_plt_arm_standard): ... here, new class.
1145         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1146         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1147         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1148
1149         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1150         Take additional argument for the PLT entry size.
1151         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1152         Use get_plt_entry_size method rather than plt_entry_size variable.
1153         (Output_data_plt_x86_64::reserve_slot): Likewise.
1154         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1155         (Output_data_plt_x86_64::add_entry): Likewise.
1156         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1157         (Output_data_plt_x86_64::address_for_global): Likewise.
1158         (Output_data_plt_x86_64::address_for_local): Likewise.
1159         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1160         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1161         Make method non-static.
1162         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1163         method.
1164         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1165         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1166         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1167         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1168         virtual method.
1169         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1170         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1171         virtual method.
1172         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1173         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1174         virtual method.
1175         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1176         (Output_data_plt_x86_64::plt_entry_size)
1177         (Output_data_plt_x86_64::first_plt_entry)
1178         (Output_data_plt_x86_64::plt_entry)
1179         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1180         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1181         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1182         (Output_data_plt_x86_64_standard): ... here, new class.
1183         (Target_x86_64::Target_x86_64): Take optional argument for the
1184         Target_info pointer to use.
1185         (Target_x86_64::do_make_data_plt): New virtual method.
1186         (Target_x86_64::make_data_plt): New method to call it.
1187         (Target_x86_64::init_got_plt_for_update): Use that.
1188         Call this->plt_->add_eh_frame method here.
1189         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1190         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1191         rather than static method.
1192         (Target_x86_64::plt_entry_size): Likewise.
1193         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1194         rather than plt_entry_size variable.  Move guts of PLT filling to...
1195         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1196         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1197         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1198
1199         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1200         additional argument for the section alignment.
1201         Don't do add_eh_frame_for_plt here.
1202         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1203         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1204         variable.
1205         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1206         method.
1207         (Output_data_plt_i386::get_plt_entry_size): Call it.
1208         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1209         (Output_data_plt_i386::add_eh_frame): New method to call it.
1210         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1211         method.
1212         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1213         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1214         method.
1215         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1216         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1217         method instead of plt_entry_size.
1218         (Output_data_plt_i386::plt_entry_size)
1219         (Output_data_plt_i386::plt_eh_frame_fde_size)
1220         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1221         (Output_data_plt_i386_standard): ... here, new class.
1222         (Output_data_plt_i386_exec): New class.
1223         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1224         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1225         (Output_data_plt_i386::exec_plt_entry): Move to ...
1226         (Output_data_plt_i386_exec::plt_entry): ... here.
1227         (Output_data_plt_i386_dyn): New class.
1228         (Output_data_plt_i386::first_plt_entry): Move to ...
1229         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1230         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1231         (Output_data_plt_i386_dyn::plt_entry): ... here.
1232         (Target_i386::Target_i386): Take optional argument for the Target_info
1233         pointer to use.
1234         (Target_i386::do_make_data_plt): New virtual method.
1235         (Target_i386::make_data_plt): New method to call it.
1236         (Target_i386::make_plt_section): Use that.
1237         Call this->plt_->add_eh_frame method here.
1238         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1239         rather than plt_entry_size variable.
1240         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1241         (Output_data_plt_i386::address_for_local): Likewise.
1242         (Output_data_plt_i386::do_write): Likewise.
1243         Move guts of PLT filling to...
1244         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1245         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1246         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1247         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1248
1249 2012-05-01  Cary Coutant  <ccoutant@google.com>
1250
1251         * dwarf_reader.cc (Dwarf_die::read_attributes)
1252         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1253         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1254         * reduced_debug_output.cc
1255         (Output_reduced_debug_info_section::get_die_end): Remove
1256         DW_FORM_GNU_ref_index.  Add default case.
1257
1258 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1259
1260         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1261         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1262         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1263         DW_AT_high_pc as offset from DW_AT_low_pc.
1264
1265         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1266         * testsuite/Makefile.in: Regenerate.
1267         * testsuite/gdb_index_test_3.c: New test source file.
1268         * testsuite/gdb_index_test_3.sh: New test source file.
1269
1270 2012-04-25  Ian Lance Taylor  <iant@google.com>
1271
1272         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1273         pointer.
1274         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1275         as a class, not a struct.
1276         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1277         (Target_arm::apply_cortex_a8_workaround): Likewise.
1278         * gc.h: Declare Reloc_types as a struct, not a class.
1279         * object.h: Declare Symbols_data as a struct.
1280         * reloc.h: Declare Read_relocs_data as a struct.
1281         * target.h: Declare Relocate_info as a struct.
1282
1283 2012-04-24  David S. Miller  <davem@davemloft.net>
1284
1285         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1286         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1287         and R_SPARC_WPLT30.
1288
1289 2012-04-24  Cary Coutant  <ccoutant@google.com>
1290
1291         * incremental-dump.cc (find_input_containing_global): Replace
1292         magic number with symbolic constant.
1293         (dump_incremental_inputs): Update version number.
1294         * incremental.cc (Output_section_incremental_inputs): Update version
1295         number; import symbolic constants from Incremental_inputs_reader.
1296         (Incremental_inputs::create_data_sections): Align relocations
1297         section correctly for 64-bit targets.
1298         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1299         constants; add padding.
1300         (Output_section_incremental_inputs::write_header): Add assert for
1301         header_size.
1302         (Output_section_incremental_inputs::write_input_files): Add assert
1303         for input_entry_size.
1304         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1305         add assert for object_info_size, input_section_entry_size,
1306         global_sym_entry_size.
1307         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1308         for data structure sizes; use them.
1309         (Incremental_input_entry_reader): Import symbolic constants from
1310         Incremental_inputs_reader; use them.
1311
1312 2012-04-23  David S. Miller  <davem@davemloft.net>
1313
1314         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1315         and elf_flags_set_.
1316         (Target_sparc::Target_sparc): Initialize new fields.
1317         (Target_sparc::do_make_elf_object): New function.
1318         (Target_sparc::do_adjust_elf_header): New function.
1319
1320 2012-04-23  Cary Coutant  <ccoutant@google.com>
1321
1322         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1323         CU range table of gdb index.
1324
1325 2012-04-20  David S. Miller  <davem@davemloft.net>
1326
1327         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1328         instead of false.
1329
1330 2012-04-16  David S. Miller  <davem@davemloft.net>
1331
1332         * sparc.cc (Target_sparc::got_address): New function.
1333         (Sparc_relocate_functions::gdop_hix22): New function.
1334         (Sparc_relocate_functions::gdop_lox10): New function.
1335         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1336         relocs.
1337         (Target_sparc::Scan::local): Likewise if the global symbol is not
1338         preemptible and is not IFUNC.
1339         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1340         transformations for local and non-preemptible non-IFUNC global
1341         symbols.
1342
1343         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1344         writing out 64-bit part of ranges.
1345
1346         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1347         -fpic and -fpie respectively.
1348         * Makefile.in: Regenerate.
1349
1350         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1351         (Target_sparc::Target_sparc): Initialize new field.
1352         (Target_sparc::do_plt_section_for_global): New function.
1353         (Target_sparc::do_plt_section_for_local): New function.
1354         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1355         (Target_sparc::make_plt_section): New function, broken out of
1356         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1357         (Target_sparc::make_plt_entry): Call make_plt_section.
1358         (Target_sparc::make_local_ifunc_plt_entry): New function.
1359         (Target_sparc::rela_ifunc_section): New function.
1360         (Target_sparc::plt_section): Remove const.
1361         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1362         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1363         and ifunc_count_ fields.
1364         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1365         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1366         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1367         (Output_data_plt_sparc::rela_ifunc): New function.
1368         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1369         (Output_data_plt_sparc::has_ifunc_section): New function.
1370         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1371         (Output_data_plt_sparc::address_for_global): New function.
1372         (Output_data_plt_sparc::address_for_local): New function.
1373         (Output_data_plt_sparc::plt_index_to_offset): New function.
1374         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1375         and entry_count.
1376         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1377         entry_count.
1378         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1379         R_SPARC_JMP_IREL to switch.
1380         (Target_sparc::Scan::check_non_pic): Likewise.
1381         (Target_sparc::Scan::local): Handle IFUNC symbols.
1382         (Target_sparc::Scan::local): Likewise.
1383         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1384         and plt_address_for_local.
1385         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1386         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1387
1388         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1389         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1390         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1391         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1392         global relocs too.
1393         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1394         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1395         calls.
1396         * sparc.cc (Target_sparc::Scan::global): Likewise.
1397         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1398
1399 2012-04-16  Cary Coutant  <ccoutant@google.com>
1400
1401         * archive.cc (Library_base::should_include_member): Check for
1402         --export-dynamic-symbol.
1403         * options.h (class General_options): Add --export-dynamic-symbol.
1404         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1405         --export-dynamic-symbol.
1406         (Symbol_table::gc_mark_undef_symbols): Likewise.
1407         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1408
1409 2012-04-12  David S. Miller  <davem@davemloft.net>
1410
1411         * sparc.cc (Reloc::wdisp10): New relocation method.
1412         (Reloc::h34): Likewise.
1413         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1414         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1415         R_SPARC_WDISP10.
1416         (Target_sparc::Scan::local): Likewise.
1417         (Target_sparc::Scan::global): Likewise.
1418         (Target_sparc::Relocate::relocate): Likewise.
1419
1420 2012-04-09  Cary Coutant  <ccoutant@google.com>
1421
1422         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1423         low_pc == 0.
1424
1425 2012-04-06  Ian Lance Taylor  <iant@google.com>
1426
1427         * timer.cc: #include <unistd.h>.
1428
1429 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1430
1431         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1432         * config.in: Regenerate.
1433         * configure: Regenerate.
1434
1435 2012-04-05  Nick Clifton  <nickc@redhat.com>
1436
1437         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1438         (AM_LC_MESSAGES): Add.
1439         * aclocal.m4: Regenerate.
1440         * config.in: Regenerate.
1441         * configure: Regenerate.
1442
1443 2012-03-21  Cary Coutant  <ccoutant@google.com>
1444
1445         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1446         * Makefile.in: Regenerate.
1447         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1448         (Sized_elf_reloc_mapper::symbol_section): New function.
1449         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1450         (make_elf_reloc_mapper): New function.
1451         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1452         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1453         (Dwarf_abbrev_table::do_get_abbrev): New function.
1454         (Dwarf_ranges_table::read_ranges_table): New function.
1455         (Dwarf_ranges_table::read_range_list): New function.
1456         (Dwarf_pubnames_table::read_section): New function.
1457         (Dwarf_pubnames_table::read_header): New function.
1458         (Dwarf_pubnames_table::next_name): New function.
1459         (Dwarf_die::Dwarf_die): New function.
1460         (Dwarf_die::read_attributes): New function.
1461         (Dwarf_die::skip_attributes): New function.
1462         (Dwarf_die::set_name): New function.
1463         (Dwarf_die::set_linkage_name): New function.
1464         (Dwarf_die::attribute): New function.
1465         (Dwarf_die::string_attribute): New function.
1466         (Dwarf_die::int_attribute): New function.
1467         (Dwarf_die::uint_attribute): New function.
1468         (Dwarf_die::ref_attribute): New function.
1469         (Dwarf_die::child_offset): New function.
1470         (Dwarf_die::sibling_offset): New function.
1471         (Dwarf_info_reader::check_buffer): New function.
1472         (Dwarf_info_reader::parse): New function.
1473         (Dwarf_info_reader::do_parse): New function.
1474         (Dwarf_info_reader::do_read_string_table): New function.
1475         (Dwarf_info_reader::lookup_reloc): New function.
1476         (Dwarf_info_reader::get_string): New function.
1477         (Dwarf_info_reader::visit_compilation_unit): New function.
1478         (Dwarf_info_reader::visit_type_unit): New function.
1479         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1480         Sized_elf_reloc_mapper.
1481         (Sized_dwarf_line_info::symbol_section): Remove function.
1482         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1483         (Sized_dwarf_line_info::read_line_mappings): Remove object
1484         parameter, adjust callers.
1485         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1486         * dwarf_reader.h: Include <sys/types.h>.
1487         (class Track_relocs): Remove forward declaration.
1488         (class Elf_reloc_mapper): New class.
1489         (class Sized_elf_reloc_mapper): New class.
1490         (class Dwarf_abbrev_table): New class.
1491         (class Dwarf_range_list): New class.
1492         (class Dwarf_ranges_table): New class.
1493         (class Dwarf_pubnames_table): New class.
1494         (class Dwarf_die): New class.
1495         (class Dwarf_info_reader): New class.
1496         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1497         (Sized_dwarf_line_info::symbol_section): Remove member function.
1498         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1499         base class.
1500         * gdb-index.cc: New source file.
1501         * gdb-index.h: New source file.
1502         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1503         and .debug_types sections, call Layout::add_to_gdb_index.
1504         (Sized_relobj_incr::do_section_name): Implement.
1505         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1506         return type; Implement.
1507         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1508         return type.
1509         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1510         parameter list and return type.
1511         (Sized_incr_dynobj::do_section_contents): Likewise.
1512         * layout.cc: Include gdb-index.h.
1513         (Layout::Layout): Initialize gdb_index_data_.
1514         (Layout::init_fixed_output_section): Check for .gdb_index section.
1515         (Layout::add_to_gdb_index): New function. Instantiate.
1516         * layout.h: Add forward declaration for class Gdb_index.
1517         (Layout::add_to_gdb_index): New member function.
1518         (Layout::gdb_index_data_): New data member.
1519         * main.cc: Include gdb-index.h.
1520         (main): Print statistics for gdb index.
1521         * object.cc (Object::section_contents): Move code into
1522         do_section_contents.
1523         (need_decompressed_section): Check for sections needed when building
1524         gdb index.
1525         (build_compressed_section_map): Likewise.
1526         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1527         gdb index.
1528         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1529         sections; call Layout::add_to_gdb_index.
1530         (Sized_relobj_file::do_decompressed_section_contents): Call
1531         do_section_contents directly.
1532         * object.h (Object::do_section_contents): Adjust parameter list and
1533         return type.
1534         (Object::do_decompressed_section_contents): Call do_section_contents
1535         directly.
1536         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1537         return type.
1538         * options.h (class General_options): Add --gdb-index option.
1539         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1540         list and return type.
1541         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1542         * reloc.h (Track_relocs::checkpoint): New function.
1543         (Track_relocs::reset): New function.
1544
1545         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1546         New test cases.
1547         * testsuite/Makefile.in: Regenerate.
1548         * testsuite/gdb_index_test.cc: New test source file.
1549         * testsuite/gdb_index_test_1.sh: New test source file.
1550         * testsuite/gdb_index_test_2.sh: New test source file.
1551
1552 2012-03-19  Doug Kwan  <dougkwan@google.com>
1553
1554         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1555         (Target_arm::do_finalize_sections): Remove code which defines
1556         __exidx_start and __exidx_end.  Make symbol table parameter
1557         anonymous as it is not used.
1558         * gold.cc (queue_middle_tasks): Call target hook to define any
1559         target-specific symbols.
1560         * target.h (Target::define_standard_symbols): New method.
1561         (Target::do_define_standard_symbols): Same.
1562         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1563         * testsuite/Makefile.in: Regenerate.
1564         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1565         and __exidx_end.
1566         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1567         relocations are generated for __exidx_start and __exidx_end.
1568
1569 2012-03-16  Doug Kwan  <dougkwan@google.com>
1570
1571         * testsuite/Makefile.am: Disable test initpri3b.
1572         * testsuite/Makefile.in: Regenerate.
1573
1574 2012-03-15  Doug Kwan  <dougkwan@google.com>
1575
1576         * arm.cc (Target_arm::got_section): Make .got section read-only
1577         if -z now is given.
1578
1579 2012-03-15  Ian Lance Taylor  <iant@google.com>
1580
1581         PR gold/13850
1582         * layout.cc (Layout::make_output_section): Correctly mark
1583         SHT_INIT_ARRAY, et. al., as relro.
1584
1585 2012-03-14  Doug Kwan  <dougkwan@google.com>
1586
1587         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1588         dynamic relocations for protected symbols in shared objects.
1589
1590 2012-03-13  Ian Lance Taylor  <iant@google.com>
1591
1592         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1593         keep the larger alignment.
1594
1595 2012-03-12  Cary Coutant  <ccoutant@google.com>
1596
1597         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1598         handling of DW_LNE_define_file.
1599
1600 2012-03-12  Cary Coutant  <ccoutant@google.com>
1601
1602         * reduced_debug_output.cc
1603         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1604         codes to switch.
1605
1606 2012-02-29  Cary Coutant  <ccoutant@google.com>
1607
1608         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1609
1610 2012-02-29  Cary Coutant  <ccoutant@google.com>
1611
1612         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1613         Call Object::decompressed_section_contents.
1614         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1615         New dtor.
1616         (Sized_dwarf_line_info::buffer_start_): New data member.
1617         * merge.cc (Output_merge_data::do_add_input_section): Call
1618         Object::decompressed_section_contents.
1619         (Output_merge_string::do_add_input_section): Likewise.
1620         * object.cc (need_decompressed_section): New function.
1621         (build_compressed_section_map): Decompress sections needed later.
1622         (Sized_relobj_file::do_decompressed_section_contents): New function.
1623         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1624         * object.h (Object::decompressed_section_contents): New function.
1625         (Object::discard_decompressed_sections): New function.
1626         (Object::do_decompressed_section_contents): New function.
1627         (Object::do_discard_decompressed_sections): New function.
1628         (Compressed_section_info): New type.
1629         (Compressed_section_map): Include decompressed section contents.
1630         (Sized_relobj_file::do_decompressed_section_contents): New function.
1631         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1632
1633 2012-02-16  Cary Coutant  <ccoutant@google.com>
1634
1635         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1636         * testsuite/Makefile.in: Regenerate.
1637
1638 2012-02-14  Cary Coutant  <ccoutant@google.com>
1639
1640         * options.cc (General_options::finalize): Disallow -pie and -static.
1641
1642 2012-02-03  Doug Kwan  <dougkwan@google.com>
1643
1644         * arm.cc (Arm_relocate_functions::abs8,
1645         Arm_relocate_functions::abs16): Use
1646         Bits::has_signed_unsigned_overflow32.
1647         (Arm_relocate_functions::thm_abs8): Correct range of
1648         overflow check.
1649         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1650         in assertions.
1651
1652 2012-02-02  Doug Kwan  <dougkwan@google.com>
1653
1654         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1655         position independent outputs, not just shared objects.
1656
1657 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1658
1659         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1660         * configure: Regenerated.
1661
1662 2012-01-27  Ian Lance Taylor  <iant@google.com>
1663
1664         * reloc.h (Bits): New class with static functions, copied from
1665         namespace utils in arm.cc.
1666         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1667         instead.
1668
1669 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1670
1671         * incremental.cc (write_info_blocks): Correct relocation offset.
1672
1673 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1674
1675         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1676         (Relocate::tls_gd_to_le): Likewise.
1677
1678 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1679
1680         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1681
1682 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1683
1684         * configure.ac: Check if -mcmodel=medium works.
1685         * configure: Regenerated.
1686
1687 2012-01-24  Cary Coutant  <ccoutant@google.com>
1688
1689         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1690         definition and ...
1691         (read_unsigned_LEB_128_x): ... this new function.
1692         (read_signed_LEB_128): Replaced with inline definition and ...
1693         (read_signed_LEB_128_x): ... this new function.
1694         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1695         (read_unsigned_LEB_128): Add inline definition.
1696         (read_signed_LEB_128_x): New function.
1697         (read_signed_LEB_128): Add inline definition.
1698         * testsuite/Makefile.am (leb128_unittest): New unit test.
1699         * testsuite/Makefile.in: Regenerate.
1700         * testsuite/leb128_unittest.cc: New unit test.
1701
1702 2012-01-23  Ian Lance Taylor  <iant@google.com>
1703
1704         PR gold/13617
1705         * i386.cc (Target_i386::do_code_fill): When using a jmp
1706         instruction, pad with nop instructions.
1707         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1708
1709 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1710
1711         * x86_64.cc (gc_process_relocs): Add typename on types used in
1712         template.
1713         (scan_relocs): Likewise.
1714         (relocate_section): Likewise.
1715         (apply_relocation): Likewise.
1716
1717 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1718
1719         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1720         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1721         under x32.
1722
1723 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1724
1725         * x86_64.cc: Initial support for x32.
1726
1727 2012-01-03  Cary Coutant  <ccoutant@google.com>
1728
1729         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1730         Use abstract base class for GOT.
1731         * gold/output.h (class Output_data_got_base): New abstract base class.
1732         (class Output_data_got): Derive from new base class, adjust ctors.
1733         (Output_data_got::reserve_slot): Make virtual; rename to
1734         do_reserve_slot; Adjust callers.
1735         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1736         pointer to abstract base class.
1737         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1738
1739 2011-12-18  Ian Lance Taylor  <iant@google.com>
1740
1741         * object.h (Relobj::local_symbol_value): New function.
1742         (Relobj::local_plt_offset): New function.
1743         (Relobj::local_has_got_offset): New function.
1744         (Relobj::local_got_offset): New function.
1745         (Relobj::set_local_got_offset): New function.
1746         (Relobj::do_local_symbol_value): New pure virtual function.
1747         (Relobj::do_local_plt_offset): Likewise.
1748         (Relobj::do_local_has_got_offset): Likewise.
1749         (Relobj::do_local_got_offset): Likewise.
1750         (Relobj::do_set_local_got_offset): Likewise.
1751         (Sized_relobj::do_local_has_got_offset): Rename from
1752         local_has_got_offset.
1753         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1754         (Sized_relobj::do_set_local_got_offset): Rename from
1755         set_local_got_offset.
1756         (Sized_relobj_file::do_local_plt_offset): Rename from
1757         local_plt_offset.
1758         (Sized_relobj_file::do_local_symbol_value): New function.
1759         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1760         local_plt_offset.
1761         * output.cc (Output_data_got::Got_entry::write): Change object to
1762         Relobj.  Use local_symbol_value.
1763         (Output_data_got::add_global_with_rel): Change rel_dyn to
1764         Output_data_reloc_generic*.  Use add_global_generic.
1765         (Output_data_got::add_global_with_rela): Remove.  Change all
1766         callers to use add_global_with_rel.
1767         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1768         Output_data_reloc_generic*.  Use add_global_generic.
1769         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1770         callers to use add_global_pair_with_rel.
1771         (Output_data_got::add_local): Change object to Relobj*.
1772         (Output_data_got::add_local_plt): Likewise.
1773         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1774         change rel_dyn to Output_data_reloc_generic*.  Use
1775         add_local_generic.
1776         (Output_data_got::add_local_with_rela): Remove.  Change all
1777         callers to use all_local_with_rel.
1778         (Output_data_got::add_local_pair_with_rel): Change object to
1779         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1780         add_output_section_generic.
1781         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1782         callers to use add_local_pair_with_rel.
1783         (Output_data_got::reserve_local): Change object to Relobj*.
1784         * output.h: (class Output_data_reloc_generic): Add pure virtual
1785         declarations for add_global_generic, add_local_generic,
1786         add_output_section_generic.
1787         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1788         functions for Output_data_reloc_generic.  Update declarations for
1789         changes listed in output.cc.
1790         (class Output_data_got): Change template parameter to got_size.
1791         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1792         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1793         function.
1794         (Sized_relobj_incr::do_local_plt_offset): New function.
1795         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1796         add_global_generic.
1797
1798 2011-12-17  Cary Coutant  <ccoutant@google.com>
1799
1800         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1801         * resolve.cc (Symbol_table::resolve): Likewise.
1802         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1803         arrays.
1804         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1805
1806 2011-12-16  Ian Lance Taylor  <iant@google.com>
1807
1808         * output.h (Output_data_reloc_generic::add): Only call
1809         add_dynamic_reloc if this is a dynamic reloc section.
1810
1811 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1812
1813         PR gold/13505
1814         * target-reloc.h (apply_relocation): Replace <64, false> with
1815         <size, big_endian>.
1816
1817 2011-11-25  Nick Clifton  <nickc@redhat.com>
1818
1819         * po/it.po: New Italian translation.
1820
1821 2011-11-17  Sterling Augustine  <saugustine@google.com>
1822
1823         * script.cc (script_include_directive): Implement.
1824         (read_script_file): New local variables name and search_path. Update
1825         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1826         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1827         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1828
1829 2011-11-11  Sterling Augustine  <saugustine@google.com>
1830
1831         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1832         (file_or_sections_cmd): Likewise.
1833
1834 2011-11-11  Doug Kwan  <dougkwan@google.com>
1835
1836         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1837         if --just-symbols is given.
1838
1839 2011-11-10  Doug Kwan  <dougkwan@google.com>
1840
1841         PR gold/13362
1842         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1843         when processing data relocs.
1844         * reloc.h (Relocate_functions::rel_unaligned): New method.
1845         (Relocate_functions::pcrel_unaligned): Ditto.
1846         (Relocate_functions::rel32_unaligned): Ditto.
1847         (Relocate_functions::pcrel32_unaligned): Ditto.
1848
1849 2011-11-09  Doug Kwan  <dougkwan@google.com>
1850
1851         PR gold/13362
1852         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1853         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1854         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1855         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1856         (Relocate_functions::rel_unaligned): New.
1857         (Relocate_functions::rel32_unaligned): New.
1858         * target-reloc.h (relocate_for_relocatable): Add code to handle
1859         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1860         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1861         arm_unaligned_reloc_r): New targets.
1862         * testsuite/Makefile.in: Regenerate.
1863         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1864         linking.
1865
1866 2011-11-02  Ian Lance Taylor  <iant@google.com>
1867
1868         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1869         NATIVE_LINKER.
1870         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1871         * options.cc (General_options::finalize): Use library search path
1872         from configure script if specified.  If not native and no sysroot,
1873         only search TOOLLIBDIR.
1874         * options.h (Search_directory::Search_directory): Change name to
1875         const std::string&.
1876         (General_options::add_to_library_path_with_sysroot): Change arg to
1877         const std::string&.
1878         * configure, Makefile.in, config.in: Rebuild.
1879
1880 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1881
1882         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1883         we are working around the ARM1176 Erratum.
1884         * options.h (General_options::fix_arm1176): Add option.
1885         * testsuite/Makefile.am: Add testcases, and keep current ones
1886         working.
1887         * testsuite/Makefile.in: Regenerate.
1888         * testsuite/arm_fix_1176.s: New file.
1889         * testsuite/arm_fix_1176.sh: Likewise.
1890
1891 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1892
1893         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1894         may_use_blx_.
1895         (Target_arm::may_use_blx): Remove method.
1896         (Target_arm::set_may_use_blx): Likewise.
1897         (Target_arm::may_use_v4t_interworking): New method.
1898         (Target_arm::may_use_v5t_interworking): Likewise.
1899         (Target_arm::may_use_blx_): Remove member variable.
1900         (Arm_relocate_functions::arm_branch_common): Check for v5T
1901         interworking.
1902         (Arm_relocate_functions::thumb_branch_common): Likewise.
1903         (Reloc_stub::stub_type_for_reloc): Likewise.
1904         (Target_arm::do_finalize_sections): Correct interworking checks.
1905         * testsuite/Makefile.am: Add new tests.
1906         * testsuite/Makefile.in: Regenerate.
1907         * testsuite/arm_farcall_arm_arm.s: New test.
1908         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1909         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1910         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1911         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1912         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1913         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1914         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
1915
1916 2011-10-31  Cary Coutant  <ccoutant@google.com>
1917
1918         PR gold/13023
1919         * expression.cc (Expression::eval_with_dot): Add
1920         is_section_dot_assignment parameter.
1921         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
1922         absolute and assigning to dot within a section.
1923         * script-sections.cc
1924         (Output_section_element_assignment::set_section_addresses): Pass
1925         dot_section to set_if_absolute.
1926         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
1927         as is_section_dot_assignment flag to eval_with_dot.
1928         (Output_section_element_dot_assignment::set_section_addresses):
1929         Likewise.
1930         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
1931         parameter.  Also set value if relative to dot_section; set the
1932         symbol's output_section.
1933         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
1934         parameter.  Adjust all callers.
1935         (Expression::eval_maybe_dot): Likewise.
1936         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
1937         Adjust all callers.
1938         * testsuite/script_test_2.t: Test assignment of an absolute value
1939         to dot within an output section element.
1940
1941 2011-10-31  Cary Coutant  <ccoutant@google.com>
1942
1943         * options.h (class General_options): Add --[no-]gnu-unique options.
1944         * symtab.cc (Symbol_table::sized_write_globals): Convert
1945         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
1946
1947 2011-10-31  Cary Coutant  <ccoutant@google.com>
1948
1949         PR gold/13359
1950         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
1951         unnecessary assertion.
1952         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
1953
1954 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
1955
1956         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1957         gc_mark_symbol.
1958         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
1959         gc_mark_symbol.
1960         Change to just keep the section associated with symbol.
1961         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
1962         they are externally visible and --export-dynamic is turned on.
1963         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
1964
1965 2011-10-19  Ian Lance Taylor  <iant@google.com>
1966
1967         PR gold/13163
1968         * script-sections.cc
1969         (Output_section_element_dot_assignment::needs_output_section): New
1970         function.
1971
1972 2011-10-19  Ian Lance Taylor  <iant@google.com>
1973
1974         PR gold/13204
1975         * layout.cc (Layout::segment_precedes): Don't assert failure if a
1976         --section-start option was seen.
1977         * options.h (General_options::any_section_start): New function.
1978
1979 2011-10-18  David S. Miller  <davem@davemloft.net>
1980
1981         PR binutils/13301
1982         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
1983         member to track relocation locations that have moved during TLS
1984         reloc optimizations.
1985         (Target_sparc::Relocate::Relocate): Initialize to NULL.
1986         (Target_sparc::Relocate::relocate): Adjust view down by 4
1987         bytes if it matches reloc_adjust_addr_.
1988         (Target_sparc::Relocate::relocate_tls): Always move the
1989         __tls_get_addr call delay slot instruction forward 4 bytes when
1990         performing relaxation.
1991
1992 2011-10-18  Cary Coutant  <ccoutant@google.com>
1993
1994         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
1995         (Output_file::map_no_anonymous): Check for non-zero
1996         return code from posix_fallocate.
1997
1998 2011-10-17  Cary Coutant  <ccoutant@google.com>
1999
2000         PR gold/13245
2001         * plugin.cc (is_visible_from_outside): Check for symbols
2002         referenced from dynamic objects.
2003         * resolve.cc (Symbol_table::resolve): Don't count references
2004         from dynamic objects as references from real ELF files.
2005         * testsuite/plugin_test_2.sh: Adjust expected result.
2006
2007 2011-10-17  Cary Coutant  <ccoutant@google.com>
2008
2009         * gold.cc: Include timer.h.
2010         (queue_middle_tasks): Stamp time.
2011         (queue_final_tasks): Likewise.
2012         * main.cc (main): Store timer in parameters.  Print timers
2013         for each pass.
2014         * parameters.cc (Parameters::Parameters): Initialize timer_.
2015         (Parameters::set_timer): New function.
2016         (set_parameters_timer): New function.
2017         * parameters.h (Parameters::set_timer): New function.
2018         (Parameters::timer): New function.
2019         (Parameters::timer_): New data member.
2020         (set_parameters_timer): New function.
2021         * timer.cc (Timer::stamp): New function.
2022         (Timer::get_pass_time): New function.
2023         * timer.h (Timer::stamp): New function.
2024         (Timer::get_pass_time): New function.
2025         (Timer::pass_times_): New data member.
2026
2027 2011-10-17  Cary Coutant  <ccoutant@google.com>
2028
2029         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2030         task for members of lib groups.
2031
2032 2011-10-17  Cary Coutant  <ccoutant@google.com>
2033
2034         PR gold/13288
2035         * fileread.cc (File_read::find_view): Add assert.
2036         (File_read::make_view): Move bounds check (replace with assert)...
2037         (File_read::find_or_make_view): ... to here.
2038
2039 2011-10-12  Cary Coutant  <ccoutant@google.com>
2040
2041         * output.cc (Output_file::open_base_file): Handle case where
2042         ::read returns less than requested size.
2043
2044 2011-10-10  Cary Coutant  <ccoutant@google.com>
2045
2046         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2047         Initialize defined_count_.
2048         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2049         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2050         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2051         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2052         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2053         * incremental.h (Sized_relobj_incr::defined_count_): New data
2054         member.
2055         (Sized_incr_dynobj::defined_count_): New data member.
2056         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2057         Return zeroes instead of internal error.
2058
2059 2011-10-10  Cary Coutant  <ccoutant@google.com>
2060
2061         PR gold/13249
2062         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2063         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2064         * output.h (class Output_reloc): Add use_plt_offset flag.
2065         (Output_reloc::type_): Adjust size of bit field.
2066         (Output_reloc::use_plt_offset_): New bit field.
2067         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2068         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2069         flag.  Adjust all callers.
2070         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2071         creating RELATIVE relocations.
2072
2073 2011-10-10  Nick Clifton  <nickc@redhat.com>
2074
2075         * po/es.po: Updated Spanish translation.
2076         * po/fi.po: Updated Finnish translation.
2077
2078 2011-10-03   Diego Novillo  <dnovillo@google.com>
2079
2080         * options.cc (parse_uint): Fix dereference of RETVAL.
2081
2082 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2083
2084         * layout.h (section_order_map_): New member.
2085         (get_section_order_map): New member function.
2086         * output.cc (Output_section::add_input_section): Check for patterns
2087         only when --section-ordering-file is specified.
2088         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2089         output_sections have been formed.
2090         * layout.cc (Layout_Layout): Initialize section_order_map_.
2091         * plugin.cc (update_section_order): Store order in order_map. Do not
2092         update the order.
2093         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2094         * testsuite/Makefile.in: Regenerate.
2095         * testsuite/plugin_section_order.c: New file.
2096         * testsuite/plugin_final_layout.cc: New file.
2097         * testsuite/plugin_final_layout.sh: New file.
2098
2099 2011-09-29  Cary Coutant  <ccoutant@google.com>
2100
2101         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2102         Check for NULL.
2103         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2104         symbols during incremental update.
2105         (Symbol_table::add_from_dynobj): Likewise.
2106
2107 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2108             Ian Lance Taylor  <iant@google.com>
2109
2110         * symtab.cc (Symbol_table::define_special_symbol): Always
2111         canonicalize version string.
2112
2113 2011-09-26  Cary Coutant  <ccoutant@google.com>
2114
2115         * gold.cc (queue_initial_tasks): Move option checks ...
2116         * options.cc (General_options::finalize): ... to here. Disable
2117         some options; make others fatal.
2118
2119 2011-09-26  Cary Coutant  <ccoutant@google.com>
2120
2121         gcc PR lto/47247
2122         * plugin.cc (get_symbols_v2): New function.
2123         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2124         (is_referenced_from_outside): New function.
2125         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2126         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2127         (get_symbols): Pass version parameter.
2128         (get_symbols_v2): New function.
2129         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2130         parameter.
2131         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2132         (onload): Add LDPT_GET_SYMBOLS_V2.
2133         (all_symbols_read_hook): Use get_symbols_v2; check for
2134         LDPR_PREVAILING_DEF_IRONLY_EXP.
2135         * testsuite/plugin_test_3.sh: Update expected results.
2136
2137 2011-09-23  Simon Baldwin  <simonb@google.com>
2138
2139         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2140         configuration options.
2141         * configure: Regenerate.
2142         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2143         * Makefile.in: Regenerate.
2144         * testsuite/Makefile.in: Regenerate.
2145
2146 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2147
2148         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2149
2150 2011-09-19  Cary Coutant  <ccoutant@google.com>
2151
2152         * incremental.cc (can_incremental_update): Fix typo in comment.
2153         * incremental.h (can_incremental_update): Likewise.
2154
2155 2011-09-18  Cary Coutant  <ccoutant@google.com>
2156
2157         * incremental.cc (can_incremental_update): New function.
2158         * incremental.h (can_incremental_update): New function.
2159         * layout.cc (Layout::init_fixed_output_section): Call it.
2160         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2161         * object.cc (Sized_relobj_file::do_layout): Call
2162         can_incremental_update.
2163
2164 2011-09-13  Cary Coutant  <ccoutant@google.com>
2165
2166         * configure.ac: Check for glibc support for gnu_indirect_function
2167         support with static linking, setting automake conditional
2168         IFUNC_STATIC.
2169         * Makefile.in: Regenerate.
2170         * configure: Regenerate.
2171
2172         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2173         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2174         for IFUNC_STATIC.
2175         * testsuite/Makefile.in: Regenerate.
2176
2177 2011-09-13  Cary Coutant  <ccoutant@google.com>
2178
2179         * incremental.cc (Sized_relobj_incr::do_layout): Call
2180         report_comdat_group for kept comdat sections.
2181         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2182         * testsuite/Makefile.in: Regenerate.
2183         * testsuite/incr_comdat_test_1.cc: New source file.
2184         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2185         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2186         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2187
2188 2011-09-13  Ian Lance Taylor  <iant@google.com>
2189
2190         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2191         variable external_symbols_offset.
2192
2193 2011-09-12  Ian Lance Taylor  <iant@google.com>
2194
2195         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2196         triggered if object has no symbols.
2197
2198 2011-09-09  David S. Miller  <davem@davemloft.net>
2199
2200         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2201         (Output_fill_debug_line::do_write): Likewise.
2202
2203 2011-08-29  Cary Coutant  <ccoutant@google.com>
2204
2205         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2206         casts to match formatting specs.
2207         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2208
2209 2011-08-26  Cary Coutant  <ccoutant@google.com>
2210
2211         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2212         remaining hole size when allocating.
2213         (Layout::make_output_section): Set fill methods for debug sections.
2214         * layout.h (Free_list::Free_list_node): Move from private to
2215         public.
2216         (Free_list::set_min_hole_size): New function.
2217         (Free_list::begin, Free_list::end): New functions.
2218         (Free_list::min_hole_): New data member.
2219         * output.cc: Include dwarf.h.
2220         (Output_fill_debug_info::do_minimum_hole_size): New function.
2221         (Output_fill_debug_info::do_write): New function.
2222         (Output_fill_debug_line::do_minimum_hole_size): New function.
2223         (Output_fill_debug_line::do_write): New function.
2224         (Output_section::Output_section): Initialize new data member.
2225         (Output_section::set_final_data_size): Ensure patch space is larger
2226         than minimum hole size.
2227         (Output_section::do_write): Fill holes in debug sections.
2228         * output.h (Output_fill): New class.
2229         (Output_fill_debug_info): New class.
2230         (Output_fill_debug_line): New class.
2231         (Output_section::set_free_space_fill): New function.
2232         (Output_section::free_space_fill_): New data member.
2233         * testsuite/Makefile.am (incremental_test_3): Add
2234         --incremental-patch option.
2235         (incremental_test_4): Likewise.
2236         (incremental_test_5): Likewise.
2237         (incremental_test_6): Likewise.
2238         (incremental_copy_test): Likewise.
2239         (incremental_common_test_1): Likewise.
2240         * testsuite/Makefile.in: Regenerate.
2241
2242 2011-08-26  Nick Clifton  <nickc@redhat.com>
2243
2244         * po/es.po: Updated Spanish translation.
2245
2246 2011-08-01  Cary Coutant  <ccoutant@google.com>
2247
2248         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2249         * gold/testsuite/Makefile.in: Regenerate.
2250         * gold/testsuite/justsyms_exec.c: New source file.
2251         * gold/testsuite/justsyms_lib.c: New source file.
2252
2253 2011-08-01  Cary Coutant  <ccoutant@google.com>
2254
2255         * layout.cc (Layout::set_segment_offsets): Don't realign text
2256         segment if -Ttext was specified.
2257         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2258         file type.
2259         * object.h (Sized_relobj_file::e_type): New function.
2260         (Sized_relobj_file::e_type_): New data member.
2261         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2262         base address for ET_EXEC files.
2263         * target.cc (Target::do_make_elf_object_implementation): Allow
2264         ET_EXEC files with --just-symbols option.
2265
2266 2011-07-28  Cary Coutant  <ccoutant@google.com>
2267
2268         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2269         Add thread_number parameter.
2270         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2271         * workqueue-threads.cc
2272         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2273         current thread if its thread number is greater than desired thread
2274         count.
2275         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2276         Add thread_number parameter.
2277         (Workqueue::should_cancel_thread): Likewise.
2278         (Workqueue::find_runnable_or_wait): Pass thread_number to
2279         should_cancel_thread.
2280         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2281         parameter.
2282
2283 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2284
2285         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2286         only after checking if it cannot be forced local.
2287         * symtab.h (is_externally_visible): Check if the symbol is not forced
2288         local.
2289
2290 2011-07-15  Ian Lance Taylor  <iant@google.com>
2291
2292         * options.h (class General_options): Add --print-output-format.
2293         Move -EL next to -EB, for  better --help output.
2294         * target-select.cc: Include <cstdio>, "options.h", and
2295         "parameters.h".
2296         (Target_selector::do_target_bfd_name): New function.
2297         (print_output_format): New function.
2298         * target-select.h (class Target_selector): Update declarations.
2299         (Target_selector::target_bfd_name): New function.
2300         (print_output_format): Declare.
2301         * main.cc: Include "target-select.h".
2302         (main): Handle --print-output-format.
2303         * gold.cc: Include "target-select.h".
2304         (queue_initial_tasks): Handle --print-output-format when there are
2305         no input files.
2306         * parameters.cc (parameters_force_valid_target): Give a better
2307         error message if -EB/-EL does not match target.
2308         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2309         function.
2310
2311 2011-07-15  Ian Lance Taylor  <iant@google.com>
2312
2313         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2314         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2315         (Output_data_plt_i386::do_write): Write address of .dynamic
2316         section to first entry in .got.plt section.
2317         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2318         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2319         Initialize layout_.
2320         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2321         section to first entry in .got.plt section.
2322         * layout.h (Layout::dynamic_section): New function.
2323
2324 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2325
2326         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2327         to claim_file call.
2328         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2329         input_section_position_, and input_section_glob_.
2330         (read_layout_from_file): Call function section_ordering_specified.
2331         * layout.h (is_section_ordering_specified): New function.
2332         (section_ordering_specified): New function.
2333         (section_ordering_specified_): New boolean member.
2334         * main.cc(main): Call load_plugins after layout object is defined.
2335         * output.cc (Output_section::add_input_section): Use
2336         function section_ordering_specified to check if section ordering is
2337         needed.
2338         * output.cc (Output_section::add_relaxed_input_section): Use
2339         function section_ordering_specified to check if section ordering is
2340         needed.
2341         (Output_section::update_section_layout): New function.
2342         (Output_section::sort_attached_input_sections): Check if input section
2343         must be reordered.
2344         * output.h (Output_section::update_section_layout): New function.
2345         * plugin.cc (get_section_count): New function.
2346         (get_section_type): New function.
2347         (get_section_name): New function.
2348         (get_section_contents): New function.
2349         (update_section_order): New function.
2350         (allow_section_ordering): New function.
2351         (Plugin::load): Add the new interfaces to the transfer vector.
2352         (Plugin_manager::load_plugins): New parameter.
2353         (Plugin_manager::all_symbols_read): New parameter.
2354         (Plugin_manager::claim_file): New parameter. Save the elf object for
2355         unclaimed objects.
2356         (Plugin_manager::get_elf_object): New function.
2357         (Plugin_manager::get_view): Change to directly use the bool to check
2358         if get_view is called from claim_file_hook.
2359         * plugin.h (input_objects): New function
2360         (Plugin__manager::load_plugins): New parameter.
2361         (Plugin_manager::claim_file): New parameter.
2362         (Plugin_manager::get_elf_object): New function.
2363         (Plugin_manager::in_claim_file_handler): New function.
2364         (Plugin_manager::in_claim_file_handler_): New member.
2365         (layout): New function.
2366         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2367         handler with an extra parameter. Make the elf object before calling
2368         claim_file handler.
2369         * testsuite/plugin_test.c (get_section_count): New function pointer.
2370         (get_section_type): New function pointer.
2371         (get_section_name): New function pointer.
2372         (get_section_contents): New function pointer.
2373         (update_section_order): New function pointer.
2374         (allow_section_ordering): New function pointer.
2375         (onload): Check if the new interfaces exist.
2376
2377 2011-07-13  Ian Lance Taylor  <iant@google.com>
2378
2379         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2380         relro section.
2381         * x86_64.cc (Target_x86_64::got_section): Likewise.
2382         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2383         (relro_now_test_SOURCES): New variable.
2384         (relro_now_test_DEPENDENCIES): New variable.
2385         (relro_now_test_LDFLAGS): New variable.
2386         (relro_now_test_LDADD): New variable.
2387         (relro_now_test.so): New target.
2388         * testsuite/Makefile.in: Rebuild.
2389
2390 2011-07-12  Ian Lance Taylor  <iant@google.com>
2391
2392         PR gold/12980
2393         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2394         GLOB_DAT relocation rather than a RELATIVE relocation for a
2395         protected symbol when creating a shared library.
2396         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2397         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2398         * testsuite/protected_main_1.cc (main): Test that protected
2399         function has same address.
2400
2401 2011-07-11  Ian Lance Taylor  <iant@google.com>
2402
2403         PR gold/12979
2404         * options.h (class General_options): Add -Bgroup.
2405         * options.cc (General_options::finalize): If -Bgroup is set,
2406         default to --unresolved-symbols=report-all.
2407         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2408         * target-reloc.h (issue_undefined_symbol_error): Handle
2409         --unresolved-symbols=report-all.
2410
2411 2011-07-08  Ian Lance Taylor  <iant@google.com>
2412
2413         PR gold/11985
2414         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2415         if linker script discards key sections.
2416         (Layout::create_dynamic_symtab): Likewise.
2417         (Layout::assign_local_dynsym_offsets): Likewise.
2418         (Layout::sized_create_version_sections): Likewise.
2419         (Layout::create_interp): Likewise.
2420         (Layout::finish_dynamic_section): Likewise.
2421         (Layout::set_dynamic_symbol_size): Likewise.
2422
2423 2011-07-08  Ian Lance Taylor  <iant@google.com>
2424
2425         PR gold/12386
2426         * options.h (class General_options): Add --unresolved-symbols.
2427         * target-reloc.h (issue_undefined_symbol_error): Check
2428         --unresolved-symbols.  Add comments.
2429
2430 2011-07-08  Ian Lance Taylor  <iant@google.com>
2431
2432         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2433         expression more complex.
2434
2435 2011-07-08  Ian Lance Taylor  <iant@google.com>
2436
2437         PR gold/11317
2438         * target-reloc.h (issue_undefined_symbol_error): New inline
2439         function, broken out of relocate_section.
2440         (relocate_section): Call issue_undefined_symbol_error.
2441         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2442         there is no TLS segment if we are about to issue an undefined
2443         symbol error.
2444         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2445
2446 2011-07-08  Ian Lance Taylor  <iant@google.com>
2447
2448         PR gold/12279
2449         * resolve.cc (Symbol_table::should_override): Add fromtype
2450         parameter.  Change all callers.  Give error when linking together
2451         TLS and non-TLS symbol.
2452         (Symbol_table::should_override_with_special): Add fromtype
2453         parameter.  Change all callers.
2454         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2455         there is no TLS segment if we have reported some errors.
2456         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2457
2458 2011-07-08  Ian Lance Taylor  <iant@google.com>
2459
2460         PR gold/12372
2461         * target.h (Target::plt_address_for_global): New function.
2462         (Target::plt_address_for_local): New function.
2463         (Target::plt_section_for_global): Remove.
2464         (Target::plt_section_for_local): Remove.
2465         (Target::do_plt_address_for_global): New virtual function.
2466         (Target::do_plt_address_for_local): New virtual function.
2467         (Target::do_plt_section_for_global): Remove.
2468         (Target::do_plt_section_for_local): Remove.
2469         (Target::register_global_plt_entry): Add Symbol_table and Layout
2470         parameters.
2471         * output.cc (Output_data_got::Got_entry::write): Use
2472         plt_address_for_global and plt_address_for_local.
2473         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2474         address of output section.
2475         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2476         got_irelative_, and irelative_count_ fields.  Update
2477         declarations.
2478         (Output_data_plt_i386::has_irelative_section): New function.
2479         (Output_data_plt_i386::entry_count): Add irelative_count_.
2480         (Output_data_plt_i386::set_final_data_size): Likewise.
2481         (class Target_i386): Add got_irelative_ and rel_irelative_
2482         fields.  Update declarations.
2483         (Target_i386::Target_i386): Initialize new fields.
2484         (Target_i386::do_plt_address_for_global): New function replacing
2485         do_plt_section_for_global.
2486         (Target_i386::do_plt_address_for_local): New function replacing
2487         do_plt_section_for_local.
2488         (Target_i386::got_section): Create got_irelative_.
2489         (Target_i386::rel_irelative_section): New function.
2490         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2491         fields.  Don't define __rel_iplt_{start,end}.
2492         (Output_data_plt_i386::add_entry): Add symtab and layout
2493         parameters.  Change all callers.  Use different PLT and GOT for
2494         IFUNC symbols.
2495         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2496         layout parameters.  Change all callers.  Use different PLT and
2497         GOT.
2498         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2499         (Output_data_plt_i386::rel_irelative): New function.
2500         (Output_data_plt_i386::address_for_global): New function.
2501         (Output_data_plt_i386::address_for_local): New function.
2502         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2503         IRELATIVE GOT when changing IFUNC GOT entries.
2504         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2505         reloc.
2506         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2507         if we didn't create an IRELATIVE GOT.
2508         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2509         plt_address_for_local.
2510         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2511         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2512         got_irelative_, and irelative_count_ fields.  Update
2513         declarations.
2514         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2515         Initialize new fields.  Remove symtab parameter.  Change all
2516         callers.
2517         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2518         irelative_count_.
2519         (Output_data_plt_x86_64::has_irelative_section): New function.
2520         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2521         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2522         fields.  Update declarations.
2523         (Target_x86_64::Target_x86_64): Initialize new fields.
2524         (Target_x86_64::do_plt_address_for_global): New function replacing
2525         do_plt_section_for_global.
2526         (Target_x86_64::do_plt_address_for_local): New function replacing
2527         do_plt_section_for_local.
2528         (Target_x86_64::got_section): Create got_irelative_.
2529         (Target_x86_64::rela_irelative_section): New function.
2530         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2531         all callers.  Don't create __rel_iplt_{start,end}.
2532         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2533         parameters.  Change all callers.  Use different PLT and GOT for
2534         IFUNC symbols.
2535         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2536         layout parameters.  Change all callers.  Use different PLT and
2537         GOT.
2538         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2539         parameters.  Change all callers.  Use different PLT and GOT for
2540         IFUNC symbols.
2541         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2542         (Output_data_plt_x86_64::rela_irelative): New function.
2543         (Output_data_plt_x86_64::address_for_global): New function.
2544         (Output_data_plt_x86_64::address_for_local): New function.
2545         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2546         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2547         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2548         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2549         parameters.
2550         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2551         reloc.
2552         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2553         symbols if we didn't create an IRELATIVE GOT.
2554         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2555         plt_address_for_local.
2556         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2557         * testsuite/ifuncvar1.c: New test file.
2558         * testsuite/ifuncvar2.c: New test file.
2559         * testsuite/ifuncvar3.c: New test file.
2560         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2561         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2562         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2563         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2564         * testsuite/Makefile.in: Rebuild.
2565
2566 2011-07-07  Cary Coutant  <ccoutant@google.com>
2567
2568         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2569         (two_file_test_1_ndebug.o): Likewise.
2570         (two_file_test_1b_ndebug.o): Likewise.
2571         (two_file_test_2_ndebug.o): Likewise.
2572         (two_file_test_main_ndebug.o): Likewise.
2573         (incremental_test_2): Link with no-debug versions.
2574
2575 2011-07-06  Cary Coutant  <ccoutant@google.com>
2576
2577         * gold/incremental.cc
2578         (Output_section_incremental_inputs::write_info_blocks): Check for
2579         hidden and internal symbols.
2580
2581 2011-07-06  Cary Coutant  <ccoutant@google.com>
2582
2583         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2584         Check disposition for startup file.
2585         (Incremental_inputs::report_command_line): Ignore
2586         --incremental-startup-unchanged option.
2587         * options.cc (General_options::parse_incremental_startup_unchanged):
2588         New function.
2589         (General_options::General_options): Initialize new data member.
2590         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2591         (General_options): Add --incremental-startup-unchanged option.
2592         (General_options::incremental_startup_disposition): New function.
2593         (General_options::incremental_startup_disposition_): New data member.
2594
2595 2011-07-06  Cary Coutant  <ccoutant@google.com>
2596
2597         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2598         input file index to Script_info ctor.
2599         (Sized_incremental_binary::do_file_has_changed): Find the
2600         command-line argument for files named in scripts.
2601         * incremental.h (Script_info::Script_info): New ctor
2602         with input file index.
2603         (Script_info::input_file_index): New function.
2604         (Script_info::input_file_index_): New data member.
2605         (Incremental_binary::get_library): Add const.
2606         (Incremental_binary::get_script_info): Add const.
2607         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2608         * testsuite/Makefile.am (incremental_test_5): New test case.
2609         (incremental_test_6): New test case.
2610         * testsuite/Makefile.in: Regenerate.
2611
2612 2011-07-06  Cary Coutant  <ccoutant@google.com>
2613
2614         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2615         debug output when command lines differ.
2616
2617 2011-07-06  Cary Coutant  <ccoutant@google.com>
2618
2619         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2620         --incremental-patch option.
2621         * layout.cc (Free_list::allocate): Extend allocation beyond original
2622         end if enabled.
2623         (Layout::make_output_section): Mark sections that should get
2624         patch space.
2625         * options.cc (parse_percent): New function.
2626         * options.h (parse_percent): New function.
2627         (DEFINE_percent): New macro.
2628         (General_options): Add --incremental-patch option.
2629         * output.cc (Output_section::Output_section): Initialize new data
2630         members.
2631         (Output_section::add_input_section): Print section name when out
2632         of patch space.
2633         (Output_section::add_output_section_data): Likewise.
2634         (Output_section::set_final_data_size): Add patch space when
2635         doing --incremental-full.
2636         (Output_section::do_reset_address_and_file_offset): Remove patch
2637         space.
2638         (Output_segment::set_section_list_addresses): Print debug output
2639         only if --incremental-update.
2640         * output.h (Output_section::set_is_patch_space_allowed): New function.
2641         (Output_section::is_patch_space_allowed_): New data member.
2642         (Output_section::patch_space_): New data member.
2643         * parameters.cc (Parameters::incremental_full): New function.
2644         * parameters.h (Parameters::incremental_full): New function
2645         * testsuite/Makefile.am (incremental_test_2): Add test for
2646         --incremental-patch option.
2647         * testsuite/Makefile.in: Regenerate.
2648         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2649         (t18): Remove function body.
2650
2651 2011-07-05  Doug Kwan  <dougkwan@google.com>
2652
2653         PR gold/12771
2654         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2655         Arm_Address type for relocation result.
2656         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2657         overflow check.
2658         (Arm_relocate_functions::abs32): Use unaligned access.
2659         (Arm_relocate_functions::rel32): Ditto.
2660         (Arm_relocate_functions::prel31): Ditto.
2661         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2662         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2663         static data relocations.
2664         * testsuite/Makefile.in: Regnerate.
2665         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2666
2667 2011-07-05  Ian Lance Taylor  <iant@google.com>
2668
2669         PR gold/12392
2670         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2671         symbols if necessary.
2672         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2673
2674 2011-07-05  Ian Lance Taylor  <iant@google.com>
2675
2676         PR gold/12952
2677         * resolve.cc (Symbol::override_base_with_special): Simply override
2678         version with special symbol version, ignoring previous version.
2679
2680 2011-07-05  Ian Lance Taylor  <iant@google.com>
2681
2682         * object.cc (Sized_relobj_file::include_section_group): Add
2683         information to comment about signature location.
2684
2685 2011-07-02  Ian Lance Taylor  <iant@google.com>
2686
2687         PR gold/12957
2688         * options.h (class General_options): Add -f and -F.
2689         * options.cc (General_options::finalize): Fatal error if -f/-F
2690         are used without -shared.
2691         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2692
2693 2011-07-02  Ian Lance Taylor  <iant@google.com>
2694
2695         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2696
2697 2011-07-01  Ian Lance Taylor  <iant@google.com>
2698
2699         PR gold/12525
2700         PR gold/12952
2701         * resolve.cc (Symbol::override_base_with_special): Don't override
2702         the version if the overriding symbol has a different name.
2703         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2704         all callers.  If we give an error about an undefined version,
2705         define the base version if necessary.
2706         * dynobj.h (class Versions): Update declaration.
2707         * testsuite/weak_alias_test_5.cc: New file.
2708         * testsuite/weak_alias_test.script: New file.
2709         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2710         and versioned_alias have the right value, and call t2.
2711         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2712         weak_alias_test_5.so.
2713         (weak_alias_test_LDADD): Likewise.
2714         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2715         * testsuite/Makefile.in: Rebuild.
2716
2717 2011-07-01  Ian Lance Taylor  <iant@google.com>
2718
2719         PR gold/12525
2720         * options.h (class General_options): Support -z notext.
2721         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2722         -Wl,-z,notext.
2723         (two_file_shared_nonpic.so): Likewise.
2724         (two_file_shared_mixed.so): Likewise.
2725         (two_file_shared_mixed_1.so): Likewise.
2726         (weak_undef_lib_nonpic.so): Likewise.
2727         (alt/weak_undef_lib_nonpic.so): Likewise.
2728         (tls_test_shared_nonpic.so): Likewise.
2729         * testsuite/Makefile.in: Rebuild.
2730
2731 2011-07-01  Ian Lance Taylor  <iant@google.com>
2732
2733         PR gold/12525
2734         * configure.ac: Test whether static linking works, setting
2735         the automake conditional HAVE_STATIC.
2736         * testsuite/Makefile.am: Disable tests using -static if
2737         HAVE_STATIC is not true.
2738         * configure, testsuite/Makefile.in: Rebuild.
2739
2740 2011-07-01  Ian Lance Taylor  <iant@google.com>
2741
2742         PR gold/12525
2743         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2744         Assert if we see DW_EH_PE_indirect.
2745         * target.h (Target::ehframe_datarel_base): New function.
2746         (Target::do_ehframe_datarel_base): New target function.
2747         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2748         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2749         function.
2750
2751 2011-07-01  Ian Lance Taylor  <iant@google.com>
2752
2753         PR gold/12571
2754         * options.h (class General_options): Add
2755         --ld-generated-unwind-info.
2756         * ehframe.cc (Fde::write): Add address parameter.  Change all
2757         callers.  If associated with PLT, fill in address and size.
2758         (Cie::set_output_offset): Only add merge mapping if there is an
2759         object.
2760         (Cie::write): Add address parameter.  Change all callers.
2761         (Eh_frame::add_ehframe_for_plt): New function.
2762         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2763         input_offset_ fields into union u_, with new plt field.
2764         (Fde::Fde): Adjust for new union field.
2765         (Fde::Fde) [Output_data version]: New constructor.
2766         (Fde::add_mapping): Only add merge mapping if there is an object.
2767         (class Cie): Update declarations.
2768         (class Eh_frame): Declare add_ehframe_for_plt.
2769         * layout.cc (Layout::layout_eh_frame): Break out code into
2770         make_eh_frame_section, and call it.
2771         (Layout::make_eh_frame_section): New function.
2772         (Layout::add_eh_frame_for_plt): New function.
2773         * layout.h (class Layout): Update declarations.
2774         * merge.cc (Merge_map::add_mapping): Add assertion.
2775         * i386.cc: Include "dwarf.h".
2776         (class Output_data_plt_i386): Make first_plt_entry,
2777         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2778         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2779         and plt_eh_frame_fde.
2780         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2781         boundary.  Call add_eh_frame_for_plt if appropriate.
2782         * x86_64.cc: Include "dwarf.h".
2783         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2784         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2785         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2786         and plt_eh_frame_fde.
2787         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2788         appropriate.
2789
2790 2011-06-29  Ian Lance Taylor  <iant@google.com>
2791
2792         PR gold/12629
2793         * object.cc (Sized_relobj_file::layout_section): Change shdr
2794         parameter to be const.
2795         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2796         out of do_layout.
2797         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2798         appropriate.  Call layout_eh_frame_section.
2799         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2800         sections.
2801         * object.h (class Sized_relobj_file): Update declarations.
2802
2803 2011-06-29  Ian Lance Taylor  <iant@google.com>
2804
2805         PR gold/12652
2806         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2807         modifier.
2808         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2809
2810 2011-06-29  Ian Lance Taylor  <iant@google.com>
2811
2812         PR gold/12675
2813         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2814         SHT_X86_64_UNWIND.
2815         * layout.cc (Layout::layout_eh_frame): Likewise.
2816
2817 2011-06-29  Ian Lance Taylor  <iant@google.com>
2818
2819         PR gold/12695
2820         * layout.cc (Layout::symtab_section_shndx): New function.
2821         * layout.h (class Layout): Declare symtab_section_shndx.
2822         * output.cc (Output_section::write_header): Call it.
2823
2824 2011-06-29  Ian Lance Taylor  <iant@google.com>
2825
2826         PR gold/12818
2827         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2828         symbols which are not used in a relocation.
2829
2830 2011-06-28  Ian Lance Taylor  <iant@google.com>
2831
2832         PR gold/12898
2833         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2834         script create indistinguishable segments.
2835         (Layout::set_segment_offsets): Use stable_sort when sorting
2836         segments.  Pass this to Compare_segments constructor.
2837         * layout.h (class Layout): Make segment_precedes non-static.
2838         (class Compare_segments): Change from struct to class.  Add
2839         layout_ field.  Add constructor.
2840         * script-sections.cc
2841         (Script_sections::attach_sections_using_phdrs_clause): Rename
2842         local orphan to is_orphan.  Don't report failure to put empty
2843         section in segment.  On attachment failure, report name of
2844         section, and attach to first PT_LOAD segment.
2845
2846 2011-06-28  Ian Lance Taylor  <iant@google.com>
2847
2848         PR gold/12934
2849         * target-select.cc (Target_selector::Target_selector): Add
2850         emulation parameter.  Change all callers.
2851         (select_target_by_bfd_name): Rename from select_target_by_name.
2852         Change all callers.
2853         (select_target_by_emulation): New function.
2854         (supported_emulation_names): New function.
2855         * target-select.h (class Target_selector): Add emulation_ field.
2856         Update declarations.
2857         (Target_selector::recognize_by_bfd_name): Rename from
2858         recognize_by_name.  Change all callers.
2859         (Target_selector::supported_bfd_names): Rename from
2860         supported_names.  Change all callers.
2861         (Target_selector::recognize_by_emulation): New function.
2862         (Target_selector::supported_emulations): New function.
2863         (Target_selector::emulation): New function.
2864         (Target_selector::do_recognize_by_bfd_name): Rename from
2865         do_recognize_by_name.  Change all callers.
2866         (Target_selector::do_supported_bfd_names): Rename from
2867         do_supported_names.  Change all callers.
2868         (Target_selector::do_recognize_by_emulation): New function.
2869         (Target_selector::do_supported_emulations): New function.
2870         (select_target_by_bfd_name): Change name in declaration.
2871         (select_target_by_emulation): Declare.
2872         (supported_emulation_names): Declare.
2873         * parameters.cc (parameters_force_valid_target): Try to find
2874         target based on emulation from -m option.
2875         * options.h (class General_options): Change doc string for -m.
2876         * options.cc (help): Print emulations.
2877         (General_options::parse_V): Likewise.
2878         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2879         Add emulation parameter.  Change all callers.
2880
2881 2011-06-28  Ian Lance Taylor  <iant@google.com>
2882
2883         * target.h (class Target): Add osabi_ field.
2884         (Target::osabi): New function.
2885         (Target::set_osabi): New function.
2886         (Target::Target): Initialize osabi_.
2887         (Target::do_adjust_elf_header): Make pure virtual.
2888         (Sized_target::do_adjust_elf_header): Declare.
2889         * target.cc (Sized_target::do_adjust_elf_header): New function.
2890         (class Sized_target): Instantiate all versions.
2891         * freebsd.h (class Target_freebsd): Remove.
2892         (Target_selector_freebsd::do_recognize): Call set_osabi on
2893         Target.
2894         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2895         (Target_selector_freebsd::set_osabi): Remove.
2896         * i386.cc (class Target_i386): Inherit from Sized_target rather
2897         than Target_freebsd.
2898         * x86_64.cc (class Target_x86_64): Likewise.
2899
2900 2011-06-28  Ian Lance Taylor  <iant@google.com>
2901
2902         * target.h (Target::can_check_for_function_pointers): Rewrite.
2903         Make non-virtual.
2904         (Target::can_icf_inline_merge_sections): Likewise.
2905         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2906         (Target::Target_info): Add can_icf_inline_merge_sections field.
2907         (Target::do_can_check_for_function_pointers): New virtual
2908         function.
2909         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2910         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2911         from can_check_for_function_pointers, move in file.
2912         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2913         section_may_have_icf_unsafe_poineters, move in file.
2914         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
2915         * i386.cc (Target_i386::do_can_check_for_function_pointers):
2916         Rename from can_check_for_function_pointers, move in file.
2917         (Target_i386::can_icf_inline_merge_sections): Remove.
2918         (Target_i386::i386_info): Initialize
2919         can_icf_inline_merge_sections.
2920         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
2921         Initialize can_icf_inline_merge_sections.
2922         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
2923         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
2924         Rename from can_check_for_function_pointers, move in file.
2925         (Target_x86_64::can_icf_inline_merge_sections): Remove.
2926         (Target_x86_64::x86_64_info): Initialize
2927         can_icf_inline_merge_sections.
2928         * testsuite/testfile.cc (Target_test::test_target_info):
2929         Likewise.
2930         * icf.cc (get_section_contents): Correct formatting.
2931
2932 2011-06-27  Ian Lance Taylor  <iant@google.com>
2933
2934         * symtab.cc (Symbol::versioned_name): New function.
2935         (Symbol_table::add_to_final_symtab): Use versioned_name when
2936         appropriate.
2937         (Symbol_table::sized_write_symbol): Likewise.
2938         * symtab.h (class Symbol): Declare versioned_name.
2939         * stringpool.h (class Stringpool_template): Add variant of add
2940         which takes a std::basic_string.
2941         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
2942         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
2943         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
2944         (ver_test_12.o): New target.
2945         * testsuite/Makefile.in: Rebuild.
2946
2947 2011-06-27  Doug Kwan  <dougkwan@google.com>
2948
2949         * arm.cc (Arm_relocate_functions::thm_jump8,
2950         Arm_relocate_functions::thm_jump11): Use a wider signed
2951         type to compute offset.
2952         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
2953         arm_thm_jump8.
2954         * testsuite/Makefile.in: Regenerate.
2955         * testsuite/arm_branch_in_range.sh: Check test results of
2956         arm_thm_jump11 and arm_thm_jump8.
2957         * testsuite/arm_thm_jump11.s: New test source file.
2958         * testsuite/arm_thm_jump11.t: New linker script.
2959         * testsuite/arm_thm_jump8.s: New test source file.
2960         * testsuite/arm_thm_jump8.t: New linker script.
2961
2962 2011-06-24  Ian Lance Taylor  <iant@google.com>
2963
2964         * layout.cc: Include "object.h".
2965         (ctors_sections_in_init_array): New static variable.
2966         (Layout::is_ctors_in_init_array): New function.
2967         (Layout::layout): Add entry to ctors_sections_in_init_array if
2968         appropriate.
2969         * layout.h (class Layout): Declare is_ctors_in_init_array.
2970         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
2971         is_ctors_reverse_view is set.
2972         (Sized_relobj_file::write_sections): Add layout parameter.  Change
2973         all callers.  Set is_ctors_reverse_view field of View_size.
2974         (Sized_relobj_file::reverse_words): New function.
2975         * object.h (Sized_relobj_file::View_size): Add
2976         is_ctors_reverse_view field.
2977         (class Sized_relobj_file): Update declarations.
2978         * testsuite/initpri3.c: New test.
2979         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
2980         initpri3b.
2981         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
2982         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
2983         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
2984         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
2985         * testsuite/Makefile.in: Rebuild.
2986
2987 2011-06-24  Cary Coutant  <ccoutant@google.com>
2988
2989         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
2990         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
2991         (debug_msg_cdebug.err): New targets.
2992         * testsuite/Makefile.in: Regenerate.
2993         * testsuite/debug_msg.sh: Check output of link with compressed debug.
2994         Fix checks for link with shared library.
2995
2996 2011-06-24  Doug Kwan  <dougkwan@google.com>
2997
2998         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
2999         skip empty text sections.
3000         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3001
3002 2011-06-22  Ian Lance Taylor  <iant@google.com>
3003
3004         PR gold/12910
3005         * options.h (class General_options): Add --ctors-in-init-array.
3006         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3007         friends as SHT_PROGBITS for merging sections.
3008         (Layout::layout): Remove special handling of .init_array and
3009         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3010         and .dtors if ctors_in_init_array.
3011         (Layout::make_output_section): Force correct section types for
3012         .init_array and friends.  Don't sort if doing relocatable link,
3013         Don't sort .ctors and .dtors if ctors_in_init_array.
3014         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3015         (Layout::output_section_name): Add relobj parameter.  Change all
3016         callers.  Handle .ctors. and .dtors. in code rather than table.
3017         Handle .ctors and .dtors if ctors_in_init_array.
3018         (Layout::match_file_name): New function, moved from output.cc.
3019         * layout.h (class Layout): Update declarations.
3020         * output.cc: Include "layout.h".
3021         (Input_section_sort_entry::get_priority): New function.
3022         (Input_section_sort_entry::match_file_name): Just call
3023         Layout::match_file_name.
3024         (Output_section::Input_section_sort_init_fini_compare::operator()):
3025         Handle .ctors and .dtors.  Sort by explicit priority rather than
3026         by name.
3027         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3028         * testsuite/initpri2.c: New test.
3029         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3030         (check_PROGRAMS): Add initpri2.
3031         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3032         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3033         * configure, testsuite/Makefile.in: Rebuild.
3034
3035 2011-06-19  Ian Lance Taylor  <iant@google.com>
3036
3037         PR gold/12880
3038         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3039         .interp section to a PT_INTERP segment even if we have seen a
3040         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3041         clause in a linker script.
3042         (Layout::finalize): Don't create a .interp section if we've
3043         already create a PT_INTERP segment.
3044         (Layout::create_interp): Always call choose_output_section (revert
3045         patch of 2011-06-17).  Don't create PT_INTERP segment.
3046         * script-sections.cc
3047         (Script_sections::create_note_and_tls_segments): Add a .interp
3048         section to a PT_INTERP segment even if we have seen a
3049         --dynamic-linker option.
3050
3051 2011-06-18  Ian Lance Taylor  <iant@google.com>
3052
3053         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3054         merely because a non-PT_LOAD segment has a dynamic reloc.
3055
3056 2011-06-18  Ian Lance Taylor  <iant@google.com>
3057
3058         * layout.cc (Layout::finish_dynamic_section): Don't create
3059         DT_FLAGS entry if not needed.
3060
3061 2011-06-18  Ian Lance Taylor  <iant@google.com>
3062
3063         PR gold/12745
3064         * layout.cc (Layout::layout_eh_frame): Correct handling of
3065         writable .eh_frame section.
3066
3067 2011-06-17  Ian Lance Taylor  <iant@google.com>
3068
3069         PR gold/12893
3070         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3071         symbol is redefined with the exact same object and value.
3072
3073 2011-06-17  Ian Lance Taylor  <iant@google.com>
3074
3075         PR gold/12880
3076         * layout.h (class Layout): Add interp_segment_ field.
3077         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3078         (Layout::attach_allocated_section_to_segment): If making shared
3079         library, put .interp section in PT_INTERP segment.
3080         (Layout::finalize): Also call create_interp if -dynamic-linker
3081         option was used.
3082         (Layout::create_interp): Assert that there is no PT_INTERP
3083         segment.  If not using a SECTIONS clause, use make_output_section.
3084         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3085         * script-sections.cc
3086         (Script_sections::create_note_and_tls_segments): If making shared
3087         library, put .interp section in PT_INTERP segment.
3088
3089 2011-06-17  Ian Lance Taylor  <iant@google.com>
3090
3091         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3092         when making a shared library.
3093
3094 2011-06-17  Ian Lance Taylor  <iant@google.com>
3095
3096         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3097         parameter.  Change all callers.  Don't issue warning about PC32
3098         against locally defined symbol.
3099
3100 2011-06-16  Ian Lance Taylor  <iant@google.com>
3101
3102         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3103         occurs in same object.
3104
3105 2011-06-14  Alan Modra  <amodra@gmail.com>
3106
3107         * po/POTFILES.in: Regenerate.
3108
3109 2011-06-09  Ian Lance Taylor  <iant@google.com>
3110
3111         * script-sections.cc
3112         (Orphan_output_section::set_section_addresses): For a relocatable
3113         link set address to 0.
3114
3115 2011-06-09  Cary Coutant  <ccoutant@google.com>
3116
3117         PR gold/12804
3118         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3119         used with --compress-debug-sections.
3120         * gold/object.cc (Sized_relobj_file::do_layout): Report
3121         uncompressed size of compressed input sections.
3122
3123 2011-06-08  Cary Coutant  <ccoutant@google.com>
3124
3125         PR gold/12804
3126         * testsuite/two_file_test_2_v1.cc: Change initialization of
3127         v2 to keep it in .data.
3128
3129 2011-06-07  Cary Coutant  <ccoutant@google.com>
3130
3131         * common.cc (Symbol_table::do_allocate_commons_list): Call
3132         gold_fallback.
3133         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3134         (Errors::fallback): New function.
3135         (gold_fallback): New function.
3136         * errors.h (Errors::fallback): New function.
3137         * gold.cc (gold_exit): Change status parameter to enum; adjust
3138         all callers.
3139         (queue_initial_tasks): Call gold_fallback.
3140         * gold.h: Include cstdlib.
3141         (Exit_status): New enum type.
3142         (gold_exit): Change status parameter to enum.
3143         (gold_fallback): New function.
3144         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3145         (Layout::create_symtab_sections): Likewise.
3146         (Layout::create_shdrs): Likewise.
3147         * main.cc (main): Adjust call to gold_exit.
3148         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3149         (Output_data_got::add_got_entry_pair): Likewise.
3150         (Output_section::add_input_section): Likewise.
3151         (Output_section::add_output_section_data): Likewise.
3152         (Output_segment::set_section_list_addresses): Likewise.
3153         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3154
3155 2011-06-07  Cary Coutant  <ccoutant@google.com>
3156
3157         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3158         for incremental links.
3159         * output.cc (Output_segment::set_section_list_addresses): Remove
3160         FIXME and test for TLS or BSS.
3161
3162 2011-06-07  Cary Coutant  <ccoutant@google.com>
3163
3164         * testsuite/Makefile.am: Add incremental_copy_test,
3165         incremental_common_test_1.
3166         * testsuite/Makefile.in: Regenerate.
3167         * testsuite/common_test_1_v1.c: New source file.
3168         * testsuite/common_test_1_v2.c: New source file.
3169         * testsuite/copy_test_v1.cc: New source file.
3170
3171 2011-06-07  Cary Coutant  <ccoutant@google.com>
3172
3173         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3174         update, allocate common from bss section's free list.
3175         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3176         linker-defined symbols.
3177         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3178         Skip GOT and PLT entries that are no longer referenced.
3179         (Output_section_incremental_inputs::write_info_blocks): Mark
3180         linker-defined symbols.
3181         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3182         * output.cc (Output_section::allocate): New function.
3183         * output.h (Output_section::allocate): New function.
3184         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3185         linker-defined symbols.
3186         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3187         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3188         (Symbol::init_base_output_data): Likewise.
3189         (Symbol::init_base_output_segment): Likewise.
3190         (Symbol::init_base_constant): Likewise.
3191         (Sized_symbol::init_output_data): Likewise.
3192         (Sized_symbol::init_output_segment): Likewise.
3193         (Sized_symbol::init_constant): Likewise.
3194         (Symbol_table::do_define_in_output_data): Likewise.
3195         (Symbol_table::do_define_in_output_segment): Likewise.
3196         (Symbol_table::do_define_as_constant): Likewise.
3197         * symtab.h (Symbol::is_predefined): New function.
3198         (Symbol::init_base_output_data): Add is_predefined parameter.
3199         (Symbol::init_base_output_segment): Likewise.
3200         (Symbol::init_base_constant): Likewise.
3201         (Symbol::is_predefined_): New data member.
3202         (Sized_symbol::init_output_data): Add is_predefined parameter.
3203         (Sized_symbol::init_output_segment): Likewise.
3204         (Sized_symbol::init_constant): Likewise.
3205         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3206
3207 2011-06-07  Cary Coutant  <ccoutant@google.com>
3208
3209         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3210         instead of emit_copy_reloc.
3211         (Copy_relocs::emit_copy_reloc): Refactor.
3212         (Copy_relocs::make_copy_reloc): New function.
3213         (Copy_relocs::add_copy_reloc): Remove.
3214         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3215         section.
3216         (Copy_relocs::make_copy_reloc): New function.
3217         (Copy_relocs::add_copy_reloc): Remove.
3218         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3219         unchanged input files.
3220         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3221         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3222         Reserve BSS space for COPY relocations.
3223         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3224         (Output_section_incremental_inputs::write_info_blocks): Record
3225         whether a symbol is copied from a shared object.
3226         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3227         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3228         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3229         (Incremental_input_entry_reader::get_output_symbol_index): Add
3230         is_copy parameter.
3231         (Incremental_binary::emit_copy_relocs): New function.
3232         (Incremental_binary::do_emit_copy_relocs): New function.
3233         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3234         new data member.
3235         (Sized_incremental_binary::add_copy_reloc): New function.
3236         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3237         (Sized_incremental_binary::Copy_reloc): New struct.
3238         (Sized_incremental_binary::Copy_relocs): New typedef.
3239         (Sized_incremental_binary::copy_relocs_): New data member.
3240         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3241         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3242         * target.h (Sized_target::emit_copy_reloc): New function.
3243         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3244
3245 2011-06-02  Cary Coutant  <ccoutant@google.com>
3246
3247         PR gold/12163
3248         * gold/archive.cc (Archive::Archive): Initialize new data member.
3249         (Archive::include_all_members): Return if archive has already been
3250         included.
3251         * gold/archive.h (Archive::include_all_members_): New data member.
3252
3253 2011-06-02  Nick Clifton  <nickc@redhat.com>
3254
3255         * dynobj.h: Fix spelling mistake in comment.
3256         * output.cc: Likewise.
3257
3258 2011-05-31  Doug Kwan  <dougkwan@google.com>
3259             Asier Llano
3260
3261         PR gold/12826
3262         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3263         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3264         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3265         redundant arm_exidx_test.so.
3266         * testsuite/Makefile.in: Regenerate.
3267         (check_SCRIPTS): Add pr12826.sh
3268         (check_DATA): Add pr12826.stdout
3269         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3270         * testsuite/pr12826.sh: New file.
3271         * testsuite/pr12826_1.s: Ditto.
3272         * testsuite/pr12826_1.s: Ditto.
3273
3274 2011-05-30  Ian Lance Taylor  <iant@google.com>
3275
3276         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3277         sections.
3278
3279 2011-05-29  Ian Lance Taylor  <iant@google.com>
3280
3281         PR gold/12804
3282         * testsuite/Makefile.am: Use different file name for two_file_test
3283         temporary file for each incremental test.
3284         * testsuite/Makefile.in: Rebuild.
3285
3286 2011-05-29  Ian Lance Taylor  <iant@google.com>
3287
3288         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3289         binary input file is empty.
3290
3291 2011-05-27  Ian Lance Taylor  <iant@google.com>
3292
3293         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3294         (ver_test_9.so): Likewise.
3295         * testsuite/Makefile.in: Rebuild.
3296
3297 2011-05-26 Cary Coutant  <ccoutant@google.com>
3298
3299         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3300         * incremental.cc (Incremental_inputs::report_input_section): Fix
3301         comment, indentation.
3302         (Incremental_inputs::report_comdat_group): New function.
3303         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3304         of data for incremental input file entry.
3305         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3306         group count, COMDAT group signatures.
3307         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3308         an unchanged input file.
3309         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3310         Initialize new data member.
3311         (Incremental_object_entry::add_comdat_group): New function.
3312         (Incremental_object_entry::get_comdat_group_count): New function.
3313         (Incremental_object_entry::get_comdat_signature_key): New function.
3314         (Incremental_object_entry::groups_): New data member.
3315         (Incremental_inputs::report_comdat_group): New function.
3316         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3317         data for incremental input file entry.
3318         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3319         (Incremental_input_entry_reader::get_input_section): Adjust size of
3320         data for incremental input file entry.
3321         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3322         (Incremental_input_entry_reader::get_comdat_group_signature): New
3323         function.
3324         * object.cc (Sized_relobj::include_section_group): Report kept
3325         COMDAT groups for incremental links.
3326
3327 2011-05-24  David Meyer  <pdox@google.com>
3328
3329         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3330         with name parameter.  Add found_name parameter.
3331         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3332         * dirsearch.h (class Dirsearch): Update declaration.
3333
3334 2011-05-24  Ian Lance Taylor  <iant@google.com>
3335
3336         * archive.cc (Library_base::should_include_member): Pull in object
3337         from archive if it defines the entry symbol.
3338         * parameters.cc (Parameters::entry): New function.
3339         * parameters.h (class Parameters): Declare entry.
3340         * output.h (class Output_file_header): Remove entry_ field.
3341         * output.cc (Output_file_header::Output_file_header): Remove entry
3342         parameter.  Change all callers.
3343         (Output_file_header::entry): Use parameters->entry.
3344         * gold.cc (queue_middle_tasks): Likewise.
3345         * plugin.cc (Plugin_hook::run): Likewise.
3346
3347 2011-05-24 Cary Coutant  <ccoutant@google.com>
3348
3349         * gold.cc (queue_initial_tasks): Pass incremental base filename
3350         to Output_file::open_base_file; don't print error message.
3351         * incremental-dump.cc (main): Adjust call to
3352         Output_file::open_for_modification.
3353         * incremental-dump.cc (main): Likewise.
3354         * incremental.cc (Incremental_inputs::report_command_line):
3355         Ignore --incremental-base option when comparing command lines.
3356         Ignore parameter when given as separate argument.
3357         * options.h (class General_options): Add --incremental-base.
3358         * output.cc (Output_file::Output_file):
3359         (Output_file::open_base_file): Add base_name and writable parameters;
3360         read base file into new file; print error message here.
3361         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3362         callers.
3363         * output.h (Output_file::open_for_modification): Rename to...
3364         (Output_file::open_base_file): ...this; add base_name and
3365         writable parameters; adjust all callers.
3366         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3367         callers.
3368         * testsuite/Makefile.am (incremental_test_4): Test
3369         --incremental-base.
3370         * testsuite/Makefile.in: Regenerate.
3371
3372 2011-05-24 Cary Coutant  <ccoutant@google.com>
3373
3374         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3375         incremental_test_4.
3376         * testsuite/Makefile.in: Regenerate.
3377         * testsuite/two_file_test_1_v1.cc: New test source file.
3378         * testsuite/two_file_test_1b_v1.cc: New test source file.
3379         * testsuite/two_file_test_2_v1.cc: New test source file.
3380
3381 2011-05-24 Cary Coutant  <ccoutant@google.com>
3382
3383         * dynobj.h (Dynobj::do_dynobj): New function.
3384         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3385         flag and soname for shared objects.
3386         * incremental.cc (Incremental_inputs::report_object): Make
3387         either Incremental_object_entry or Incremental_dynobj_entry; add
3388         soname to string table.
3389         (Incremental_inputs::report_input_section): Add assertion.
3390         (Output_section_incremental_inputs::set_final_data_size): Adjust
3391         type of input file entry for shared libraries; adjust size of
3392         shared library info entry.
3393         (Output_section_incremental_inputs::write_input_files): Write
3394         as_needed flag for shared libraries.
3395         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3396         of input file entry for shared libraries; write soname.
3397         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3398         soname from incremental info.
3399         * incremental.h (enum Incremental_input_flags): Add
3400         INCREMENTAL_INPUT_AS_NEEDED.
3401         (Incremental_input_entry::Incremental_input_entry): Initialize new
3402         data member.
3403         (Incremental_input_entry::set_as_needed): New function.
3404         (Incremental_input_entry::as_needed): New function.
3405         (Incremental_input_entry::do_dynobj_entry): New function.
3406         (Incremental_input_entry::as_needed_): New data member.
3407         (Incremental_object_entry::Incremental_object_entry): Don't check
3408         for shared library.
3409         (Incremental_object_entry::do_type): Likewise.
3410         (class Incremental_dynobj_entry): New class.
3411         (Incremental_input_entry_reader::as_needed): New function.
3412         (Incremental_input_entry_reader::get_soname): New function.
3413         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3414         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3415         size of shared library info entry.
3416         * layout.cc (Layout::finish_dynamic_section): Don't test for
3417         incremental link when adding DT_NEEDED entries.
3418         * object.h (Object::Object): Initialize new data member.
3419         (Object::dynobj): New function.
3420         (Object::set_as_needed): New function.
3421         (Object::as_needed): New function.
3422         (Object::do_dynobj): New function.
3423         (Object::as_needed_): New data member.
3424
3425 2011-05-24 Cary Coutant  <ccoutant@google.com>
3426
3427         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3428         info; adjust display of GOT entries.
3429         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3430         vector of input objects; remove file_status_.
3431         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3432         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3433         got_plt reader; call target hooks to reserve GOT entries.
3434         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3435         of input file info header and GOT info entry.
3436         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3437         relocation info.
3438         (Got_plt_view_info::got_descriptor): Remove.
3439         (Got_plt_view_info::sym_index): New data member.
3440         (Got_plt_view_info::input_index): New data member.
3441         (Local_got_offset_visitor::visit): Write input file index.
3442         (Global_got_offset_visitor::visit): Write 0 for input file index.
3443         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3444         with sym_index and input_index.
3445         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3446         incremental info GOT entry; replace got_descriptor with input_index.
3447         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3448         map from input file index to object.
3449         (Sized_relobj_incr::do_layout): Replace direct data member reference
3450         with accessor function.
3451         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3452         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3453         Adjust size of input file info header.
3454         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3455         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3456         (Incremental_input_entry_reader::get_input_section): Adjust size of
3457         input file info header.
3458         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3459         of incremental info GOT entry.
3460         (Incremental_got_plt_reader::get_got_desc): Remove.
3461         (Incremental_got_plt_reader::get_got_symndx): New function.
3462         (Incremental_got_plt_reader::get_got_input_index): New function.
3463         (Sized_incremental_binary::Sized_incremental_binary): Remove
3464         file_status_; add input_objects_.
3465         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3466         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3467         (Sized_incremental_binary::file_is_unchanged): Remove.
3468         (Sized_incremental_binary::set_input_object): New function.
3469         (Sized_incremental_binary::input_object): New function.
3470         (Sized_incremental_binary::file_status_): Remove.
3471         (Sized_incremental_binary::input_objects_): New data member.
3472         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3473         references.
3474         (Sized_relobj_incr::invalid_address): Move to base class.
3475         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3476         class.
3477         (Sized_relobj_incr::do_output_section_offset): Likewise.
3478         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3479         (Sized_relobj_incr::section_offsets_): Likewise.
3480         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3481         function.
3482         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3483         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3484         with accessor function.
3485         (Sized_relobj_file::do_layout): Likewise.
3486         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3487         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3488         (Sized_relobj_file::compute_final_local_value): Replace refs to
3489         section_offsets_ with accessor function.
3490         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3491         * object.h (Relobj::Relobj): Initialize new data members.
3492         (Relobj::add_dyn_reloc): New function.
3493         (Relobj::first_dyn_reloc): New function.
3494         (Relobj::dyn_reloc_count): New function.
3495         (Relobj::first_dyn_reloc_): New data member.
3496         (Relobj::dyn_reloc_count_): New data member.
3497         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3498         references.
3499         (Sized_relobj::Address): New typedef.
3500         (Sized_relobj::invalid_address): Move here from child class.
3501         (Sized_relobj::Sized_relobj): Initialize new data members.
3502         (Sized_relobj::sized_relobj): New function.
3503         (Sized_relobj::is_output_section_offset_invalid): Move here from
3504         child class.
3505         (Sized_relobj::get_output_section_offset): Likewise.
3506         (Sized_relobj::local_has_got_offset): Likewise.
3507         (Sized_relobj::local_got_offset): Likewise.
3508         (Sized_relobj::set_local_got_offset): Likewise.
3509         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3510         (Sized_relobj::clear_got_offsets): New function.
3511         (Sized_relobj::section_offsets): Move here from child class.
3512         (Sized_relobj::do_output_section_offset): Likewise.
3513         (Sized_relobj::do_set_section_offset): Likewise.
3514         (Sized_relobj::Local_got_offsets): Likewise.
3515         (Sized_relobj::local_got_offsets_): Likewise.
3516         (Sized_relobj::section_offsets_): Likewise.
3517         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3518         references.
3519         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3520         class.
3521         (Sized_relobj_file::sized_relobj): New function
3522         (Sized_relobj_file::local_has_got_offset): Move to base class.
3523         (Sized_relobj_file::local_got_offset): Likewise.
3524         (Sized_relobj_file::set_local_got_offset): Likewise.
3525         (Sized_relobj_file::get_output_section_offset): Likewise.
3526         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3527         (Sized_relobj_file::do_output_section_offset): Likewise.
3528         (Sized_relobj_file::do_set_section_offset): Likewise.
3529         (Sized_relobj_file::Local_got_offsets): Likewise.
3530         (Sized_relobj_file::local_got_offsets_): Likewise.
3531         (Sized_relobj_file::section_offsets_): Likewise.
3532         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3533         (all constructors).
3534         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3535         (Output_reloc::get_symbol_index): Likewise.
3536         (Output_reloc::local_section_offset): Likewise.
3537         (Output_reloc::get_address): Likewise.
3538         (Output_reloc::symbol_value): Likewise.
3539         (Output_data_got::reserve_slot): Move to class definition.
3540         (Output_data_got::reserve_local): New function.
3541         (Output_data_got::reserve_slot_for_global): Remove.
3542         (Output_data_got::reserve_global): New function.
3543         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3544         (all constructors, two instantiations).
3545         (Output_reloc::get_relobj): New function (two instantiations).
3546         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3547         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3548         (Output_data_reloc::add_global): Adjust type of relobj.
3549         (Output_data_reloc::add_global_relative): Likewise.
3550         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3551         (Output_data_reloc::add_local): Likewise.
3552         (Output_data_reloc::add_local_relative): Likewise.
3553         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3554         (Output_data_reloc::add_local_section): Likewise.
3555         (Output_data_reloc::add_output_section): Likewise.
3556         (Output_data_reloc::add_absolute): Likewise.
3557         (Output_data_reloc::add_target_specific): Likewise.
3558         (Output_data_got::reserve_slot): Move definition here.
3559         (Output_data_got::reserve_local): New function.
3560         (Output_data_got::reserve_global): New function.
3561         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3562         section_offsets_ with accessor function.
3563         (Sized_relobj_file::write_sections): Likewise.
3564         (Sized_relobj_file::do_relocate_sections): Likewise.
3565         * target.h (Sized_target::reserve_local_got_entry): New function.
3566         (Sized_target::reserve_global_got_entry): New function.
3567         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3568         (Target_x86_64::reserve_global_got_entry): New function.
3569         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3570
3571 2011-05-23 Cary Coutant  <ccoutant@google.com>
3572
3573         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3574         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3575         bit when checking got_type.
3576         * incremental.cc (Sized_incremental_binary::setup_readers):
3577         Store symbol table and string table locations; initialize bit vector
3578         of file status flags.
3579         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3580         unchanged files.
3581         (Sized_incremental_binary::do_process_got_plt): New function.
3582         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3583         (Output_section_incremental_inputs::set_final_data_size): Record
3584         file index for each input file.
3585         (Output_section_incremental_inputs::write_got_plt): Store file index
3586         instead of input entry offset for each GOT entry.
3587         * incremental.h
3588         (Incremental_input_entry::Incremental_input_entry): Initialize new
3589         data member.
3590         (Incremental_input_entry::set_offset): Store file index.
3591         (Incremental_input_entry::get_file_index): New function.
3592         (Incremental_input_entry::file_index_): New data member.
3593         (Incremental_binary::process_got_plt): New function.
3594         (Incremental_binary::do_process_got_plt): New function.
3595         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3596         data members.
3597         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3598         (Sized_incremental_binary::set_file_is_unchanged): New function.
3599         (Sized_incremental_binary::file_is_unchanged): New function.
3600         (Sized_incremental_binary::do_process_got_plt): New function.
3601         (Sized_incremental_binary::file_status_): New data member.
3602         (Sized_incremental_binary::main_symtab_loc_): New data member.
3603         (Sized_incremental_binary::main_strtab_loc_): New data member.
3604         * output.cc (Output_data_got::Got_entry::write): Add case
3605         RESERVED_CODE.
3606         (Output_data_got::add_global): Call add_got_entry.
3607         (Output_data_got::add_global_plt): Likewise.
3608         (Output_data_got::add_global_with_rel): Likewise.
3609         (Output_data_got::add_global_with_rela): Likewise.
3610         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3611         (Output_data_got::add_global_pair_with_rela): Likewise.
3612         (Output_data_got::add_local): Call add_got_entry.
3613         (Output_data_got::add_local_plt): Likewise.
3614         (Output_data_got::add_local_with_rel): Likewise.
3615         (Output_data_got::add_local_with_rela): Likewise.
3616         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3617         (Output_data_got::add_local_pair_with_rela): Likewise.
3618         (Output_data_got::reserve_slot): New function.
3619         (Output_data_got::reserve_slot_for_global): New function.
3620         (Output_data_got::add_got_entry): New function.
3621         (Output_data_got::add_got_entry_pair): New function.
3622         (Output_section::add_output_section_data): Edit FIXME.
3623         * output.h
3624         (Output_section_data_build::Output_section_data_build): New
3625         constructor with size parameter.
3626         (Output_data_space::Output_data_space): Likewise.
3627         (Output_data_got::Output_data_got): Initialize new data member; new
3628         constructor with size parameter.
3629         (Output_data_got::add_constant): Call add_got_entry.
3630         (Output_data_got::reserve_slot): New function.
3631         (Output_data_got::reserve_slot_for_global): New function.
3632         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3633         (Output_data_got::add_got_entry): New function.
3634         (Output_data_got::add_got_entry_pair): New function.
3635         (Output_data_got::free_list_): New data member.
3636         * target.h (Sized_target::init_got_plt_for_update): New function.
3637         (Sized_target::register_global_plt_entry): New function.
3638         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3639         Initialize new data member; call init; add constructor with PLT count.
3640         (Output_data_plt_x86_64::init): New function.
3641         (Output_data_plt_x86_64::add_relocation): New function.
3642         (Output_data_plt_x86_64::reserve_slot): New function.
3643         (Output_data_plt_x86_64::free_list_): New data member.
3644         (Target_x86_64::init_got_plt_for_update): New function.
3645         (Target_x86_64::register_global_plt_entry): New function.
3646         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3647         incremental updates.
3648         (Output_data_plt_x86_64::add_relocation): New function.
3649         * testsuite/object_unittest.cc (Object_test): Set default options.
3650
3651 2011-05-16  Ian Lance Taylor  <iant@google.com>
3652
3653         * options.h (class General_options): Make -i a synonym for -r.
3654
3655 2011-05-16  Ian Lance Taylor  <iant@google.com>
3656
3657         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3658
3659 2011-05-10 Cary Coutant  <ccoutant@google.com>
3660
3661         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3662         strip_all (-s).
3663
3664 2011-05-06  Ian Lance Taylor  <iant@google.com>
3665
3666         * layout.cc (Layout::layout): If the output section flags change,
3667         update the ordering.
3668
3669 2011-04-25 Cary Coutant  <ccoutant@google.com>
3670
3671         * incremental-dump.cc (dump_incremental_inputs): Print local
3672         symbol info for each input file.
3673         * incremental.cc
3674         (Output_section_incremental_inputs::set_final_data_size): Add local
3675         symbol info to input file entries in incremental info.
3676         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3677         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3678         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3679         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3680         implementation.
3681         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3682         (Sized_incr_relobj::do_relocate): Write the local symbols.
3683         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3684         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3685         Adjust size of input file header.
3686         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3687         (Incremental_inputs_reader::get_local_symbol_count): New function.
3688         (Incremental_inputs_reader::get_input_section): Adjust size of input
3689         file header.
3690         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3691         (Sized_incr_relobj::This): New typedef.
3692         (Sized_incr_relobj::sym_size): New const data member.
3693         (Sized_incr_relobj::Local_symbol): New struct.
3694         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3695         (Sized_incr_relobj::do_local_symbol_offset): New function.
3696         (Sized_incr_relobj::local_symbol_count_): New data member.
3697         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3698         (Sized_incr_relobj::local_symbol_index_): New data member.
3699         (Sized_incr_relobj::local_symbol_offset_): New data member.
3700         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3701         (Sized_incr_relobj::local_symbols_): New data member.
3702         * object.h (Relobj::output_local_symbol_count): New function.
3703         (Relobj::local_symbol_offset): New function.
3704         (Relobj::do_output_local_symbol_count): New function.
3705         (Relobj::do_local_symbol_offset): New function.
3706         (Sized_relobj::do_output_local_symbol_count): New function.
3707         (Sized_relobj::do_local_symbol_offset): New function.
3708
3709 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3710
3711         * descriptors.cc (set_close_on_exec): New function.
3712         (Descriptors::open): Use set_close_on_exec.
3713         * output.cc (S_ISLNK): Define if not defined.
3714
3715 2011-04-22 Cary Coutant  <ccoutant@google.com>
3716
3717         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3718         global symbol map.
3719         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3720         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3721         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3722         relocations.
3723         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3724         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3725         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3726         * incremental.h
3727         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3728         function.
3729         (Incremental_binary::apply_incremental_relocs): New function.
3730         (Incremental_binary::do_apply_incremental_relocs): New function.
3731         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3732         data member.
3733         (Sized_incremental_binary::add_global_symbol): New function.
3734         (Sized_incremental_binary::global_symbol): New function.
3735         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3736         (Sized_incremental_binary::symbol_map_): New data member.
3737         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3738         * target.h (Sized_target::apply_relocation): New function.
3739         * target-reloc.h (apply_relocation): New function.
3740         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3741
3742 2011-04-22  Doug Kwan  <dougkwan@google.com>
3743
3744         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3745         flag of a SHT_ARM_EXIDX section.
3746         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3747         * testsuite/Makefile.in: Regenerate.
3748         * testsuite/arm_exidx_test.s: New file.
3749         * testsuite/arm_exidx_test.sh: Same.
3750
3751 2011-04-20 Cary Coutant  <ccoutant@google.com>
3752
3753         PR gold/12689
3754         * archive.h (Incremental_archive_entry::Archive_member):
3755         Initialize arg_serial_ (second constructor).
3756
3757 2011-04-17  Ian Lance Taylor  <iant@google.com>
3758
3759         * object.cc (Relocate_info::location): Simplify location string.
3760         * errors.cc (Errors::error_at_location): Don't print program
3761         name.
3762         (Errors::warning_at_location): Likewise.
3763         (Errors::undefined_symbol): Likewise.
3764         * testsuite/debug_msg.sh: Update accordingly.
3765
3766 2011-04-14 Cary Coutant  <ccoutant@google.com>
3767
3768         * gold/layout.cc (Layout::symtab_section_offset): New function.
3769         * gold/layout.h (Layout::symtab_section_offset): New function.
3770         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3771
3772 2011-04-12  Ian Lance Taylor  <iant@google.com>
3773
3774         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3775         with MREMAP_MAYMOVE.
3776         * output.h (class Output_file): Add map_is_allocated_ field.
3777         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3778         not available, provide stubs.  If mremap is not available, #define
3779         it to gold_mremap.
3780         (MREMAP_MAYMOVE): Define if not defined.
3781         (Output_file::Output_file): Initialize map_is_allocated_.
3782         (Output_file::resize): Check map_is_allocated_.
3783         (Output_file::map_anonymous): If mmap fails, use malloc.
3784         (Output_file::unmap): Don't do anything for an anonymous map.
3785         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3786         is not available, provide stubs.
3787         (File_read::View::~View): Use free rather than delete[].
3788         (File_read::make_view): Use malloc rather than new[].  If mmap
3789         fails, use malloc.
3790         (File_read::find_or_make_view): Use malloc rather than new[].
3791         * gold.h: Remove HAVE_REMAP code.
3792         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3793         exists.  Rename mremap to gold_mremap.  If mmap is not available
3794         don't do anything.
3795         * configure, config.in: Rebuild.
3796
3797 2011-04-11  Ian Lance Taylor  <iant@google.com>
3798
3799         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3800         initialize local variable v.
3801
3802 2011-04-11  Cary Coutant  <ccoutant@google.com>
3803
3804         * archive.cc (Archive::include_member): Adjust call to
3805         report_object.
3806         (Add_archive_symbols::run): Track argument serial numbers.
3807         (Lib_group::include_member): Likewise.
3808         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3809         * archive.h (Incremental_archive_entry::Archive_member):
3810         Initialize arg_serial_.
3811         (Archive_member::arg_serial_): New data member.
3812         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3813         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3814         incremental link.
3815         (Sized_dynobj::do_for_all_local_got_entries): New function.
3816         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3817         function.
3818         * fileread.cc (get_mtime): New function.
3819         * fileread.h (get_mtime): New function.
3820         * gold.cc (queue_initial_tasks): Check for incremental update.
3821         (process_incremental_input): New function.
3822         (queue_middle_tasks): Don't force valid target for incremental
3823         update.
3824         * incremental-dump.cc (find_input_containing_global): Adjust
3825         size of symbol info entry.
3826         (dump_incremental_inputs): Dump argument serial number and
3827         in_system_directory flag; bias shndx by 1; print symbol names
3828         when dumping per-file symbol lists; use new symbol info readers.
3829         * incremental.cc
3830         (Output_section_incremental_inputs:update_data_size): New function.
3831         (Sized_incremental_binary::setup_readers): Setup input readers
3832         for each input file; build maps for files added from libraries
3833         and scripts.
3834         (Sized_incremental_binary::check_input_args): New function.
3835         (Sized_incremental_binary::do_check_inputs): Build map of argument
3836         serial numbers to input arguments.
3837         (Sized_incremental_binary::do_file_has_changed): Rename
3838         do_file_is_unchanged to this; compare file modification times.
3839         (Sized_incremental_binary::do_init_layout): New function.
3840         (Sized_incremental_binary::do_reserve_layout): New function.
3841         (Sized_incremental_binary::do_get_input_reader): Remove.
3842         (Sized_incremental_binary::get_symtab_view): New function.
3843         (Incremental_checker::can_incrementally_link_output_file): Remove.
3844         (Incremental_inputs::report_command_line): Exclude --debug options.
3845         (Incremental_inputs::report_archive_begin): Add parameter; track
3846         argument serial numbers; don't put input file entry for archive
3847         before archive members.
3848         (Incremental_inputs::report_archive_end): Put input file entry
3849         for archive after archive members.
3850         (Incremental_inputs::report_object): Add parameter; track argument
3851         serial numbers and in_system_directory flag.
3852         (Incremental_inputs::report_script): Add parameter; track argument
3853         serial numbers.
3854         (Output_section_incremental_inputs::set_final_data_size): Adjust
3855         size of symbol info entry; check for forwarding symbols.
3856         (Output_section_incremental_inputs::write_input_files): Write
3857         in_system_directory flag and argument serial number.
3858         (Output_section_incremental_inputs::write_info_blocks): Map section
3859         indices between incremental info and original input file; store
3860         input section index for each symbol.
3861         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3862         change operator() to visit().
3863         (class Global_got_offset_visitor): Likewise.
3864         (class Global_symbol_visitor_got_plt):
3865         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3866         classes.
3867         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3868         (Sized_incr_relobj::do_read_symbols): New function.
3869         (Sized_incr_relobj::do_layout): New function.
3870         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3871         (Sized_incr_relobj::do_add_symbols): New function.
3872         (Sized_incr_relobj::do_should_include_member): New function.
3873         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3874         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3875         (Sized_incr_relobj::do_section_size): New function.
3876         (Sized_incr_relobj::do_section_name): New function.
3877         (Sized_incr_relobj::do_section_contents): New function.
3878         (Sized_incr_relobj::do_section_flags): New function.
3879         (Sized_incr_relobj::do_section_entsize): New function.
3880         (Sized_incr_relobj::do_section_address): New function.
3881         (Sized_incr_relobj::do_section_type): New function.
3882         (Sized_incr_relobj::do_section_link): New function.
3883         (Sized_incr_relobj::do_section_info): New function.
3884         (Sized_incr_relobj::do_section_addralign): New function.
3885         (Sized_incr_relobj::do_initialize_xindex): New function.
3886         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3887         (Sized_incr_relobj::do_read_relocs): New function.
3888         (Sized_incr_relobj::do_gc_process_relocs): New function.
3889         (Sized_incr_relobj::do_scan_relocs): New function.
3890         (Sized_incr_relobj::do_count_local_symbols): New function.
3891         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3892         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3893         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3894         (Sized_incr_relobj::do_relocate): New function.
3895         (Sized_incr_relobj::do_set_section_offset): New function.
3896         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3897         (Sized_incr_dynobj::do_read_symbols): New function.
3898         (Sized_incr_dynobj::do_layout): New function.
3899         (Sized_incr_dynobj::do_add_symbols): New function.
3900         (Sized_incr_dynobj::do_should_include_member): New function.
3901         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3902         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3903         (Sized_incr_dynobj::do_section_size): New function.
3904         (Sized_incr_dynobj::do_section_name): New function.
3905         (Sized_incr_dynobj::do_section_contents): New function.
3906         (Sized_incr_dynobj::do_section_flags): New function.
3907         (Sized_incr_dynobj::do_section_entsize): New function.
3908         (Sized_incr_dynobj::do_section_address): New function.
3909         (Sized_incr_dynobj::do_section_type): New function.
3910         (Sized_incr_dynobj::do_section_link): New function.
3911         (Sized_incr_dynobj::do_section_info): New function.
3912         (Sized_incr_dynobj::do_section_addralign): New function.
3913         (Sized_incr_dynobj::do_initialize_xindex): New function.
3914         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
3915         (make_sized_incremental_object): New function.
3916         (Incremental_library::copy_unused_symbols): New function.
3917         (Incremental_library::do_for_all_unused_symbols): New function.
3918         * incremental.h (enum Incremental_input_flags): New type.
3919         (class Incremental_checker): Remove.
3920         (Incremental_input_entry::Incremental_input_entry): Add argument
3921         serial number.
3922         (Incremental_input_entry::arg_serial): New function.
3923         (Incremental_input_entry::set_is_in_system_directory): New function.
3924         (Incremental_input_entry::is_in_system_directory): New function.
3925         (Incremental_input_entry::arg_serial_): New data member.
3926         (Incremental_input_entry::is_in_system_directory_): New data member.
3927         (class Script_info): Move here from script.h.
3928         (Script_info::Script_info): Add filename parameter.
3929         (Script_info::filename): New function.
3930         (Script_info::filename_): New data member.
3931         (Incremental_script_entry::Incremental_script_entry): Add argument
3932         serial number.
3933         (Incremental_object_entry::Incremental_object_entry): Likewise.
3934         (Incremental_object_entry::add_input_section): Build list of input
3935         sections with map to original shndx.
3936         (Incremental_object_entry::get_input_section_index): New function.
3937         (Incremental_object_entry::shndx_): New data member.
3938         (Incremental_object_entry::name_key_): Rename; adjust all refs.
3939         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
3940         (Incremental_archive_entry::Incremental_archive_entry): Add argument
3941         serial number.
3942         (Incremental_inputs::report_archive_begin): Likewise.
3943         (Incremental_inputs::report_object): Likewise.
3944         (Incremental_inputs::report_script): Likewise.
3945         (class Incremental_global_symbol_reader): New class.
3946         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
3947         and store flags and input file type.
3948         (Incremental_input_entry_reader::arg_serial): New function.
3949         (Incremental_input_entry_reader::type): Extract type from flags.
3950         (Incremental_input_entry_reader::is_in_system_directory): New function.
3951         (Incremental_input_entry_reader::get_input_section_count): Call
3952         accessor function for type.
3953         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
3954         function for type; adjust size of global symbol entry.
3955         (Incremental_input_entry_reader::get_global_symbol_count): Call
3956         accessor function for type.
3957         (Incremental_input_entry_reader::get_object_count): Likewise.
3958         (Incremental_input_entry_reader::get_object_offset): Likewise.
3959         (Incremental_input_entry_reader::get_member_count): Likewise.
3960         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
3961         (Incremental_input_entry_reader::get_member_offset): Likewise.
3962         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
3963         (Incremental_input_entry_reader::Global_symbol_info): Remove.
3964         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
3965         (Incremental_input_entry_reader::get_global_symbol_reader): New
3966         function.
3967         (Incremental_input_entry_reader::get_output_symbol_index): New
3968         function.
3969         (Incremental_input_entry_reader::type_): Remove.
3970         (Incremental_input_entry_reader::flags_): New data member.
3971         (Incremental_inputs_reader::input_file_offset): New function.
3972         (Incremental_inputs_reader::input_file_index): New function.
3973         (Incremental_inputs_reader::input_file): Call input_file_offset.
3974         (Incremental_inputs_reader::input_file_at_offset): New function.
3975         (Incremental_relocs_reader::get_r_type): Reformat.
3976         (Incremental_relocs_reader::get_r_shndx): Reformat.
3977         (Incremental_relocs_reader::get_r_offset): Reformat.
3978         (Incremental_relocs_reader::data): New function.
3979         (Incremental_binary::Incremental_binary): Initialize new data members.
3980         (Incremental_binary::check_inputs): Add cmdline parameter.
3981         (Incremental_binary::file_is_unchanged): Remove.
3982         (Input_reader::arg_serial): New function.
3983         (Input_reader::get_unused_symbol_count): New function.
3984         (Input_reader::get_unused_symbol): New function.
3985         (Input_reader::do_arg_serial): New function.
3986         (Input_reader::do_get_unused_symbol_count): New function.
3987         (Input_reader::do_get_unused_symbol): New function.
3988         (Incremental_binary::input_file_count): New function.
3989         (Incremental_binary::get_input_reader): Change signature to use
3990         index instead of filename.
3991         (Incremental_binary::file_has_changed): New function.
3992         (Incremental_binary::get_input_argument): New function.
3993         (Incremental_binary::get_library): New function.
3994         (Incremental_binary::get_script_info): New function.
3995         (Incremental_binary::init_layout): New function.
3996         (Incremental_binary::reserve_layout): New function.
3997         (Incremental_binary::output_file): New function.
3998         (Incremental_binary::do_check_inputs): New function.
3999         (Incremental_binary::do_file_is_unchanged): Remove.
4000         (Incremental_binary::do_file_has_changed): New function.
4001         (Incremental_binary::do_init_layout): New function.
4002         (Incremental_binary::do_reserve_layout): New function.
4003         (Incremental_binary::do_input_file_count): New function.
4004         (Incremental_binary::do_get_input_reader): Change signature.
4005         (Incremental_binary::input_args_map_): New data member.
4006         (Incremental_binary::library_map_): New data member.
4007         (Incremental_binary::script_map_): New data member.
4008         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4009         new data members.
4010         (Sized_incremental_binary::output_section): New function.
4011         (Sized_incremental_binary::inputs_reader): Add const.
4012         (Sized_incremental_binary::symtab_reader): Add const.
4013         (Sized_incremental_binary::relocs_reader): Add const.
4014         (Sized_incremental_binary::got_plt_reader): Add const.
4015         (Sized_incremental_binary::get_symtab_view): New function.
4016         (Sized_incremental_binary::Inputs_reader): New typedef.
4017         (Sized_incremental_binary::Input_entry_reader): New typedef.
4018         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4019         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4020         (Sized_incremental_binary::do_file_has_changed): New function.
4021         (Sized_incremental_binary::do_init_layout): New function.
4022         (Sized_incremental_binary::do_reserve_layout): New function.
4023         (Sized_input_reader::Inputs_reader): Remove.
4024         (Sized_input_reader::Input_entry_reader): Remove.
4025         (Sized_input_reader::do_arg_serial): New function.
4026         (Sized_input_reader::do_get_unused_symbol_count): New function.
4027         (Sized_input_reader::do_get_unused_symbol): New function.
4028         (Sized_incremental_binary::do_input_file_count): New function.
4029         (Sized_incremental_binary::do_get_input_reader): Change signature;
4030         use index instead of filename.
4031         (Sized_incremental_binary::section_map_): New data member.
4032         (Sized_incremental_binary::input_entry_readers_): New data member.
4033         (class Sized_incr_relobj): New class.
4034         (class Sized_incr_dynobj): New class.
4035         (make_sized_incremental_object): New function.
4036         (class Incremental_library): New class.
4037         * layout.cc (Free_list::num_lists): New static data member.
4038         (Free_list::num_nodes): New static data member.
4039         (Free_list::num_removes): New static data member.
4040         (Free_list::num_remove_visits): New static data member.
4041         (Free_list::num_allocates): New static data member.
4042         (Free_list::num_allocate_visits): New static data member.
4043         (Free_list::init): New function.
4044         (Free_list::remove): New function.
4045         (Free_list::allocate): New function.
4046         (Free_list::dump): New function.
4047         (Free_list::print_stats): New function.
4048         (Layout_task_runner::run): Resize output file for incremental updates.
4049         (Layout::Layout): Initialize new data members.
4050         (Layout::set_incremental_base): New function.
4051         (Layout::init_fixed_output_section): New function.
4052         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4053         incremental updates.
4054         (Layout::create_gold_note): Do not create gold note section for
4055         incremental updates.
4056         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4057         for incremental updates.
4058         (Layout::set_section_offsets): For incremental updates, allocate space
4059         from free list.
4060         (Layout::create_symtab_sections): Layout with offsets relative to
4061         start of section; for incremental updates, allocate space from free
4062         list.
4063         (Layout::create_shdrs): For incremental updates, allocate space from
4064         free list.
4065         (Layout::finish_dynamic_section): For incremental updates, do not
4066         check --as-needed (fixed in subsequent patch).
4067         * layout.h (class Free_list): New class.
4068         (Layout::set_incremental_base): New function.
4069         (Layout::incremental_base): New function.
4070         (Layout::init_fixed_output_section): New function.
4071         (Layout::allocate): New function.
4072         (Layout::incremental_base_): New data member.
4073         (Layout::free_list_): New data member.
4074         * main.cc (main): Print Free_list statistics.
4075         * object.cc (Relobj::finalize_incremental_relocs): Add
4076         clear_counts parameter; clear counts only when clear_counts is set.
4077         (Sized_relobj::Sized_relobj): Initialize new base class.
4078         (Sized_relobj::do_layout): Don't report special sections.
4079         (Sized_relobj::do_for_all_local_got_entries): New function.
4080         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4081         symtab_off to all symbol table offsets.
4082         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4083         * object.h (class Got_offset_list): Move to top of file.
4084         (Object::Object): Allow case where input_file == NULL.
4085         (Object::~Object): Likewise.
4086         (Object::input_file): Assert that input_file != NULL.
4087         (Object::lock): Allow case where input_file == NULL.
4088         (Object::unlock): Likewise.
4089         (Object::is_locked): Likewise.
4090         (Object::token): Likewise.
4091         (Object::release): Likewise.
4092         (Object::is_incremental): New function.
4093         (Object::get_mtime): New function.
4094         (Object::for_all_local_got_entries): New function.
4095         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4096         (Object::set_is_in_system_directory): New function.
4097         (Object::is_in_system_directory): New function.
4098         (Object::do_is_incremental): New function.
4099         (Object::do_get_mtime): New function.
4100         (Object::do_for_all_local_got_entries): New function.
4101         (Object::is_in_system_directory_): New data member.
4102         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4103         (class Sized_relobj_base): New class.
4104         (class Sized_relobj): Derive from Sized_relobj_base.
4105         (class Sized_relobj::Symbols): Redeclare from base class.
4106         (class Sized_relobj::local_got_offset_list): Remove.
4107         (class Sized_relobj::Output_sections): Redeclare from base class.
4108         (class Sized_relobj::do_for_all_local_got_entries): New function.
4109         (class Sized_relobj::write_local_symbols): Add offset parameter.
4110         (class Sized_relobj::local_symbol_offset_): Update comment.
4111         (class Sized_relobj::local_dynsym_offset_): Update comment.
4112         * options.cc (Input_arguments::add_file): Remove const.
4113         * options.h (Input_file_argument::Input_file_argument):
4114         Initialize arg_serial_ (all constructors).
4115         (Input_file_argument::set_arg_serial): New function.
4116         (Input_file_argument::arg_serial): New function.
4117         (Input_file_argument::arg_serial_): New data member.
4118         (Input_arguments::Input_arguments): Initialize file_count_.
4119         (Input_arguments::add_file): Remove const.
4120         (Input_arguments::number_of_input_files): New function.
4121         (Input_arguments::file_count_): New data member.
4122         (Command_line::number_of_input_files): Call
4123         Input_arguments::number_of_input_files.
4124         * output.cc (Output_segment_headers::Output_segment_headers):
4125         Set current size.
4126         (Output_section::Input_section::current_data_size): New function.
4127         (Output_section::Output_section): Initialize new data members.
4128         (Output_section::add_input_section): Don't do merge sections for
4129         an incremental link; allocate space from free list for an
4130         incremental update.
4131         (Output_section::add_output_section_data): Allocate space from
4132         free list for an incremental update.
4133         (Output_section::update_data_size): New function.
4134         (Output_section::set_fixed_layout): New function.
4135         (Output_section::reserve): New function.
4136         (Output_segment::set_section_addresses): Remove const.
4137         (Output_segment::set_section_list_addresses): Remove const; allocate
4138         space from free list for an incremental update.
4139         (Output_segment::set_offset): Adjust size of RELRO segment for an
4140         incremental update.
4141         * output.h (Output_data::current_data_size): Move here from
4142         child classes.
4143         (Output_data::pre_finalize_data_size): New function.
4144         (Output_data::update_data_size): New function.
4145         (Output_section_headers::update_data_size): new function.
4146         (Output_section_data_build::current_data_size): Move to Output_data.
4147         (Output_data_strtab::update_data_size): New function.
4148         (Output_section::current_data_size): Move to Output_data.
4149         (Output_section::set_fixed_layout): New function.
4150         (Output_section::has_fixed_layout): New function.
4151         (Output_section::reserve): New function.
4152         (Output_section::update_data_size): New function.
4153         (Output_section::has_fixed_layout_): New data member.
4154         (Output_section::free_list_): New data member.
4155         (Output_segment::set_section_addresses): Remove const.
4156         (Output_segment::set_section_list_addresses): Remove const.
4157         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4158         New function.
4159         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4160         New function.
4161         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4162         parameter when calling Add_symbols constructor; store argument
4163         serial number for members of a lib group.
4164         (Add_symbols::locks): Allow case where token == NULL.
4165         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4166         (Read_member::~Read_member): New function.
4167         (Read_member::is_runnable): New function.
4168         (Read_member::locks): New function.
4169         (Read_member::run): New function.
4170         (Check_script::~Check_script): New function.
4171         (Check_script::is_runnable): New function.
4172         (Check_script::locks): New function.
4173         (Check_script::run): New function.
4174         (Check_library::~Check_library): New function.
4175         (Check_library::is_runnable): New function.
4176         (Check_library::locks): New function.
4177         (Check_library::run): New function.
4178         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4179         (Add_symbols::library_): New data member.
4180         (class Read_member): New class.
4181         (class Check_script): New class.
4182         (class Check_library): New class.
4183         * reloc.cc (Read_relocs::is_runnable): Allow case where
4184         token == NULL.
4185         (Read_relocs::locks): Likewise.
4186         (Scan_relocs::locks): Likewise.
4187         (Relocate_task::locks): Likewise.
4188         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4189         to clear counters.
4190         (Sized_relobj::incremental_relocs_scan): Fix comment.
4191         (Sized_relobj::do_relocate): Pass output file offset to
4192         write_local_symbols.
4193         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4194         from class declaration.
4195         * script.cc (read_input_script): Allocate Script_info; pass
4196         argument serial number to report_script.
4197         * script.h (class Script_info): Move to incremental.h.
4198         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4199         * symtab.h (Symbol_table::add_from_incrobj): New function.
4200         (Symbol_table::set_file_offset): New function.
4201
4202 2011-04-05  Cary Coutant  <ccoutant@google.com>
4203
4204         * incremental-dump.cc (dump_incremental_inputs): Change signature
4205         to take a Sized_incremental_binary; change caller.  Use readers
4206         in Sized_incremental_binary.
4207         * incremental.cc
4208         (Sized_incremental_binary::find_incremental_inputs_sections):
4209         Rename do_find_incremental_inputs_sections to this.
4210         (Sized_incremental_binary::setup_readers): New function.
4211         (Sized_incremental_binary::do_check_inputs): Check
4212         has_incremental_info_ flag; move setup code to setup_readers;
4213         use input readers.
4214         (Sized_incremental_binary::do_file_is_unchanged): New function.
4215         (Sized_incremental_binary::do_get_input_reader): New function.
4216         * incremental.h (class Incremental_binary): Move to end of file.
4217         (Incremental_binary::file_is_unchanged): New function.
4218         (Incremental_binary::do_file_is_unchanged): New function.
4219         (Incremental_binary::Input_reader): New class.
4220         (Incremental_binary::get_input_reader): New function.
4221         (class Sized_incremental_binary): Move to end of file.
4222         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4223         input section reader classes.
4224         (Sized_incremental_binary::has_incremental_info): New function.
4225         (Sized_incremental_binary::inputs_reader): New function.
4226         (Sized_incremental_binary::symtab_reader): New function.
4227         (Sized_incremental_binary::relocs_reader): New function.
4228         (Sized_incremental_binary::got_plt_reader): New function.
4229         (Sized_incremental_binary::do_file_is_unchanged): New function.
4230         (Sized_incremental_binary::Sized_input_reader): New class.
4231         (Sized_incremental_binary::get_input_reader): New function.
4232         (Sized_incremental_binary::find_incremental_inputs_sections):
4233         Rename do_find_incremental_inputs_sections to this.
4234         (Sized_incremental_binary::setup_readers): New function.
4235         (Sized_incremental_binary::has_incremental_info_): New data member.
4236         (Sized_incremental_binary::inputs_reader_): New data member.
4237         (Sized_incremental_binary::symtab_reader_): New data member.
4238         (Sized_incremental_binary::relocs_reader_): New data member.
4239         (Sized_incremental_binary::got_plt_reader_): New data member.
4240         (Sized_incremental_binary::current_input_file_): New data member.
4241
4242 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4243
4244         PR gold/12640
4245         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4246         violation.
4247
4248 2011-03-30  Cary Coutant  <ccoutant@google.com>
4249
4250         * archive.cc (Archive::include_member): Adjust call to report_object.
4251         (Add_archive_symbols::run): Add script_info to call to
4252         report_archive_begin.
4253         (Lib_group::include_member): Adjust call to report_object.
4254         (Add_lib_group_symbols::run): Adjust call to report_object.
4255         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4256         blocks.  Add object count for script input files.
4257         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4258         script_info parameter; change all callers.
4259         (Incremental_inputs::report_object): Add script_info parameter;
4260         change all callers.
4261         (Incremental_inputs::report_script): Store backpointer to
4262         incremental info entry.
4263         (Output_section_incremental_inputs::set_final_data_size): Record
4264         additional information for scripts.
4265         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4266         * incremental.h (Incremental_script_entry::add_object): New function.
4267         (Incremental_script_entry::get_object_count): New function.
4268         (Incremental_script_entry::get_object): New function.
4269         (Incremental_script_entry::objects_): New data member; adjust
4270         constructor.
4271         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4272         (Incremental_inputs::report_object): Add script_info parameter.
4273         (Incremental_inputs_reader::get_object_count): New function.
4274         (Incremental_inputs_reader::get_object_offset): New function.
4275         * options.cc (Input_arguments::add_file): Return reference to
4276         new input argument.
4277         * options.h (Input_argument::set_script_info): New function.
4278         (Input_argument::script_info): New function.
4279         (Input_argument::script_info_): New data member; adjust all
4280         constructors.
4281         (Input_file_group::add_file): Return reference to new input argument.
4282         (Input_file_lib::add_file): Likewise.
4283         (Input_arguments::add_file): Likewise.
4284         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4285         * script.cc (Parser_closure::Parser_closure): Add script_info
4286         parameter; adjust all callers.
4287         (Parser_closure::script_info): New function.
4288         (Parser_closure::script_info_): New data member.
4289         (read_input_script): Report scripts earlier to incremental info.
4290         (script_add_file): Set script_info in Input_argument.
4291         (script_add_library): Likewise.
4292         * script.h (Script_options::Script_info): Rewrite class.
4293
4294 2011-03-29  Cary Coutant  <ccoutant@google.com>
4295
4296         * archive.cc (Library_base::should_include_member): Move
4297         method here from class Archive.
4298         (Archive::Archive): Initialize base class.
4299         (Archive::should_include_member): Move to base class.
4300         (Archive::do_for_all_unused_symbols): New function.
4301         (Add_archive_symbols::run): Remove redundant access to
4302         incremental_inputs.
4303         (Lib_group::Lib_group): Initialize base class.
4304         (Lib_group::do_filename): New function.
4305         (Lib_group::include_member): Pass pointer to Lib_group to
4306         report_object.
4307         (Lib_group::do_for_all_unused_symbols): New function.
4308         (Add_lib_group_symbols::run): Report archive information for
4309         incremental links.
4310         * archive.h (class Library_base): New base class.
4311         (class Archive): Derive from Library_base.
4312         (Archive::filename): Move to base class.
4313         (Archive::set_incremental_info): Likewise.
4314         (Archive::incremental_info): Likewise.
4315         (Archive::Should_include): Likewise.
4316         (Archive::should_include_member): Likewise.
4317         (Archive::Armap_entry): Remove.
4318         (Archive::Unused_symbol_iterator): Remove.
4319         (Archive::unused_symbols_begin): Remove.
4320         (Archive::unused_symbols_end): Remove.
4321         (Archive::do_filename): New function.
4322         (Archive::do_get_mtime): New function.
4323         (Archive::do_for_all_unused_symbols): New function.
4324         (Archive::task_): Move to base class.
4325         (Archive::incremental_info_): Likewise.
4326         (class Lib_group): Derive from Library_base.
4327         (Lib_group::do_filename): New function.
4328         (Lib_group::do_get_mtime): New function.
4329         (Lib_group::do_for_all_unused_symbols): New function.
4330         (Lib_group::task_): Move to base class.
4331         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4332         function.
4333         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4334         function.
4335         * incremental.cc (Incremental_inputs::report_archive_begin):
4336         Use Library_base; call library's get_mtime; add incremental inputs
4337         entry before members.
4338         (class Unused_symbol_visitor): New class.
4339         (Incremental_inputs::report_archive_end): Use Library_base; use
4340         visitor class to record unused symbols; don't add incremental inputs
4341         entry after members.
4342         (Incremental_inputs::report_object): Use Library_base.
4343         * incremental.h
4344         (Incremental_archive_entry::Incremental_archive_entry): Remove
4345         unused Archive parameter.
4346         (Incremental_inputs::report_archive_begin): Use Library_base.
4347         (Incremental_inputs::report_archive_end): Likewise.
4348         (Incremental_inputs::report_object): Likewise.
4349         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4350         function.
4351         * object.h (Object::for_all_global_symbols): New function.
4352         (Object::do_for_all_global_symbols): New function.
4353         (Sized_relobj::do_for_all_global_symbols): New function.
4354         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4355         function.
4356         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4357         function.
4358
4359 2011-03-27  Ian Lance Taylor  <iant@google.com>
4360
4361         * archive.cc (Archive::interpret_header): Return -1 if something
4362         goes wrong.  Change callers accordingly.
4363
4364 2011-03-25  Cary Coutant  <ccoutant@google.com>
4365
4366         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4367         * testsuite/Makefile.in: Regenerate.
4368
4369 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4370
4371         * plugin.cc (get_view): New.
4372         (Plugin::load): Pass get_view to the plugin.
4373         (Plugin_manager::get_view): New.
4374
4375 2011-03-21  Ian Lance Taylor  <iant@google.com>
4376
4377         * testsuite/final_layout.sh: Rewrite to not use dc.
4378         * testsuite/relro_test.sh: Fail if dc is not present.
4379
4380 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4381
4382         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4383         Change == to -eq.
4384         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4385         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4386         Change == to -eq.
4387         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4388         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4389
4390 2011-03-14  Ian Lance Taylor  <iant@google.com>
4391
4392         * script-sections.cc (Sort_output_sections::script_compare):
4393         Rename from is_before, change return type.
4394         (Sort_output_sections::operator()): Adjust accordingly.
4395
4396 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4397
4398         PR gold/12572
4399         * testsuite/odr_violation2.cc: Add comment to make all error line
4400         numbers double digits.
4401         * testsuite/debug_msg.sh: Adjust expected errors.
4402
4403 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4404
4405         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4406         but mark earlier ones as non-canonical
4407         (offset_to_iterator): Update search target and example
4408         (do_addr2line): Return extra lines in a vector*
4409         (format_file_lineno): Extract from do_addr2line
4410         (one_addr2line): Add vector* out-param
4411         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4412         when a lineno entry appeared last for its instruction
4413         (Dwarf_line_info): Add vector* out-param
4414         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4415         * symtab.cc (Odr_violation_compare): Include the lineno in the
4416         comparison again.
4417         (linenos_from_loc): New. Combine the canonical line for an
4418         address with its other lines.
4419         (True_if_intersect): New. Helper functor to make
4420         std::set_intersection a query.
4421         (detect_odr_violations): Compare sets of lines instead of just
4422         one line for each function. This became less deterministic, but
4423         has fewer false positives.
4424         * symtab.h: Declarations.
4425         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4426         mix an optimized and non-optimized object in the same binary
4427         (odr_violation2.so): Same.
4428         * testsuite/Makefile.in: Regenerate from Makefile.am.
4429         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4430         * testsuite/debug_msg.sh: Update line numbers and add
4431         assertions.
4432         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4433         non-optimized context.
4434         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4435         isn't inlined, and use OdrDerived in an optimized context.
4436         * testsuite/odr_header1.h: Defines OdrDerived, where
4437         optimization will change the
4438         first-instruction-in-the-destructor's file and line number.
4439         * testsuite/odr_header2.h: Defines OdrBase.
4440
4441 2011-03-09  Ian Lance Taylor  <iant@google.com>
4442
4443         * fileread.cc (File_read::clear_views): Don't delete the whole
4444         file view.
4445
4446 2011-03-08  Ian Lance Taylor  <iant@google.com>
4447
4448         PR gold/12525
4449         * fileread.cc: #include <climits>.
4450         (GOLD_IOV_MAX): Define.
4451         (File_read::read_multiple): Limit number of entries by iov_max.
4452         * fileread.h (class File_read): Always set max_readv_entries to
4453         128.
4454
4455 2011-03-07  Ian Lance Taylor  <iant@google.com>
4456
4457         PR gold/12525
4458         * options.h (class General_options): Add -dy and -dn.
4459
4460 2011-03-02  Cary Coutant  <ccoutant@google.com>
4461
4462         * testsuite/script_test_9.t: Add TLS segment.
4463
4464 2011-03-02  Simon Baldwin  <simonb@google.com>
4465
4466         * configure.ac: Add check for gnu_indirect_function support in
4467         the toolchain building binutils.
4468         * configure: Rebuild.
4469
4470 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4471
4472         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4473         plugin only symbols.
4474         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4475         in plugin files as not needed in the symbol table.
4476
4477 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4478
4479         * output.cc (Output_section::add_input_section): Delay fill
4480         generation for section ordering.
4481
4482 2011-02-09  Ian Lance Taylor  <iant@google.com>
4483
4484         PR gold/12316
4485         * object.h (class Sized_relobj): Remove clear_local_symbols.
4486         * reloc.cc (Sized_relobj::do_relocate): Don't call
4487         clear_local_symbols.
4488
4489 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4490
4491         * plugin.cc (is_visible_from_outside): Return true for symbols
4492         in the -u option.
4493
4494 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4495
4496         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4497         filename.
4498
4499 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4500
4501         * icf.h (is_section_foldable_candidate): Change type of parameter
4502         to std::string.
4503         * icf.cc (Icf::find_identical_sections): Change type of local variable
4504         section_name to be std::string.
4505         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4506
4507 2011-01-25  Ian Lance Taylor  <iant@google.com>
4508
4509         * script.cc (script_add_extern): Rewrite to use
4510         add_symbol_reference.
4511
4512 2011-01-25  Doug Kwan  <dougkwan@google.com>
4513
4514         * icf.cc (get_section_contents): Always lock section's object.
4515
4516 2011-01-24  Ian Lance Taylor  <iant@google.com>
4517
4518         * options.h (class General_options): Accept
4519         --no-detect-odr-violations.
4520
4521 2011-01-24  Ian Lance Taylor  <iant@google.com>
4522
4523         * version.cc (version_string): Bump to 1.11.
4524
4525 2011-01-24  Ian Lance Taylor  <iant@google.com>
4526
4527         * plugin.cc (class Plugin_rescan): Define new class.
4528         (Plugin_manager::claim_file): Set any_claimed_.
4529         (Plugin_manager::save_archive): New function.
4530         (Plugin_manager::save_input_group): New function.
4531         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4532         necessary.
4533         (Plugin_manager::new_undefined_symbol): New function.
4534         (Plugin_manager::rescan): New function.
4535         (Plugin_manager::rescannable_defines): New function.
4536         (Plugin_manager::add_input_file): Set any_added_.
4537         * plugin.h (class Plugin_manager): define new fields rescannable_,
4538         undefined_symbols_, any_claimed_, and any_added_.  Declare
4539         Plugin_rescan as friend.  Declare new functions.
4540         (Plugin_manager::Rescannable): Define type.
4541         (Plugin_manager::Rescannable_list): Define type.
4542         (Plugin_manager::Undefined_symbol_list): Define type.
4543         (Plugin_manager::Plugin_manager): Initialize new fields.
4544         * archive.cc (Archive::defines_symbol): New function.
4545         (Add_archive_symbols::run): Pass archive to plugins if any.
4546         * archive.h (class Archive): Declare defines_symbol.
4547         * readsyms.cc (Input_group::~Input_group): New function.
4548         (Finish_group::run): Pass input_group to plugins if any.
4549         * readsyms.h (class Input_group): Declare destructor.
4550         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4551         any.
4552
4553 2011-01-10  Ian Lance Taylor  <iant@google.com>
4554
4555         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4556         section as relro.
4557         (Layout::set_segment_offsets): Reset increase_relro before calling
4558         set_section_addresses a second time.
4559
4560 2011-01-04  Cary Coutant  <ccoutant@google.com>
4561
4562         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4563         sections before NOBITS sections.
4564
4565 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4566
4567         * version.cc (print_version): Update copyright to 2011.
4568
4569 2010-12-23  Cary Coutant  <ccoutant@google.com>
4570
4571         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4572         of OS to this->add.  Add OD parameter to second form of the function.
4573
4574 2010-12-20  Ian Lance Taylor  <iant@google.com>
4575
4576         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4577         second of two consecutive entries with same offset.
4578
4579 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4580
4581         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4582         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4583         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4584         to avoid unneeded links against $(LDADD).
4585         * testsuite/Makefile.in: Regenerate.
4586
4587 2010-12-15  Ian Lance Taylor  <iant@google.com>
4588
4589         PR gold/12324
4590         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4591         for R_X86_64_32 and R_X86_64_PC32.
4592         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4593         ver_matching_def_pic.o.
4594         (ver_matching_def_pic.o): New target.
4595
4596 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4597
4598         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4599         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4600         Move definition before File_read::View member definitions.
4601         (File_read::View::~View): Initialize and hold lock before
4602         updating current_mapped_bytes.
4603
4604 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4605
4606         * dwarf_reader.cc: Remove outdated comment.
4607         * gold-threads.cc: Fix typo in error message.
4608         * archive.cc: Fix typos in comments.
4609         * archive.h: Likewise.
4610         * arm-reloc-property.cc: Likewise.
4611         * arm-reloc-property.h: Likewise.
4612         * arm-reloc.def: Likewise.
4613         * arm.cc: Likewise.
4614         * attributes.h: Likewise.
4615         * cref.cc: Likewise.
4616         * ehframe.cc: Likewise.
4617         * fileread.h: Likewise.
4618         * gold.h: Likewise.
4619         * i386.cc: Likewise.
4620         * icf.cc: Likewise.
4621         * incremental.h: Likewise.
4622         * int_encoding.cc: Likewise.
4623         * layout.h: Likewise.
4624         * main.cc: Likewise.
4625         * merge.h: Likewise.
4626         * object.cc: Likewise.
4627         * object.h: Likewise.
4628         * options.cc: Likewise.
4629         * readsyms.cc: Likewise.
4630         * reduced_debug_output.cc: Likewise.
4631         * reloc.cc: Likewise.
4632         * script-sections.cc: Likewise.
4633         * sparc.cc: Likewise.
4634         * symtab.h: Likewise.
4635         * target-reloc.h: Likewise.
4636         * target.cc: Likewise.
4637         * target.h: Likewise.
4638         * timer.cc: Likewise.
4639         * timer.h: Likewise.
4640         * x86_64.cc: Likewise.
4641
4642 2010-12-09  Cary Coutant  <ccoutant@google.com>
4643
4644         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4645         stack.
4646         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4647         parameter; change all callers.
4648         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4649         * options.h (warn_execstack): New option.
4650
4651 2010-12-07  Doug Kwan  <dougkwan@google.com>
4652
4653         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4654         like function call relocations.
4655
4656 2010-12-07  Ian Lance Taylor  <iant@google.com>
4657
4658         * archive.cc (Archive::get_elf_object_for_member): Permit
4659         punconfigured to be NULL.
4660         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4661         (Archive::include_member): Pass NULL to get_elf_object_for_member
4662         if we searched for the archive and this is the first included
4663         object.
4664
4665 2010-12-01  Ian Lance Taylor  <iant@google.com>
4666
4667         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4668         track_relocs_type_ field.
4669         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4670         Set track_relocs_type_.
4671         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4672         contents when using RELA relocs.
4673         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4674         reloc_map_.
4675         * reloc.cc (Track_relocs::next_addend): New function.
4676         * reloc.h (class Track_relocs): Declare next_addend.
4677
4678 2010-12-01  Ian Lance Taylor  <iant@google.com>
4679
4680         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4681         virtual destructor.
4682
4683 2010-12-01  Ian Lance Taylor  <iant@google.com>
4684
4685         * README: Update compilers known to work and fail.
4686
4687 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4688
4689         * configure.in: For --enable-gold, handle value `default' instead of
4690         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4691         not the default.
4692         * configure: Regenerate.
4693
4694 2010-11-18  Doug Kwan  <dougkwan@google.com>
4695
4696         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4697         and right_alignment to be zero.  Store result alignment only if it is
4698         greater than existing alignment.
4699
4700 2010-11-16  Cary Coutant  <ccoutant@google.com>
4701
4702         PR gold/12220
4703         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4704         Check for ".zdebug_line".
4705
4706 2010-11-16  Doug Kwan  <dougkwan@google.com>
4707             Cary Coutant  <ccoutant@google.com>
4708
4709         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4710         by reference; adjust all callers.
4711         * output.cc (Output_segment::set_section_addresses): Adjust references
4712         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4713         list is empty.
4714         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4715         end at page boundary.
4716
4717 2010-11-16  Cary Coutant  <ccoutant@google.com>
4718
4719         PR gold/12220
4720         * layout.cc (Layout::choose_output_section): Transform names of
4721         compressed sections even when using a script with a SECTIONS clause.
4722         (Layout::output_section_name): Remove code to transform
4723         compressed debug section names.
4724         * output.cc (Output_section::add_input_section): Use uncompressed
4725         section size when tracking input sections.
4726
4727 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4728
4729         * symtab.h (Symbol::NON_PIC_REF): Remove.
4730         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4731         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4732         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4733         (Symbol::use_plt_offset): Take a flags argument and pass it
4734         directly to needs_dynamic_reloc.  Restrict check for undefined
4735         weak symbols to function calls.
4736         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4737         (Target_arm::Scan::global): Use it.
4738         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4739         (Target_arm::Relocate::relocate): Likewise.
4740         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4741         parameter with an r_type parameter.  Use get_reference_flags
4742         to get the flags.
4743         (Target_arm::Relocate::relocate): Update accordingly.
4744         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4745         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4746         (Target_i386::Scan::global): Likewise.
4747         (Target_i386::Relocate::relocate): Likewise.
4748         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4749         parameter with an r_type parameter.  Use get_reference_flags
4750         to get the flags.
4751         (Target_i386::Relocate::relocate): Update accordingly.
4752         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4753         (Target_powerpc::Scan::global): Use it.
4754         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4755         (Target_powerpc::Relocate::relocate): Likewise.
4756         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4757         (Target_sparc::Scan::global): Use it.
4758         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4759         (Target_sparc::Relocate::relocate): Likewise.
4760         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4761         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4762         (Target_x86_64::Scan::global): Likewise.
4763         (Target_x86_64::Relocate::relocate): Likewise.
4764
4765 2010-11-08  Doug Kwan  <dougkwan@google.com>
4766             Cary Coutant  <ccoutant@google.com>
4767
4768         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4769         (Arm_exidx_merge_section::section_contents_): New data member.
4770         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4771         (Arm_input_section::~Arm_input_section): De-allocate memory.
4772         (Arm_input_section::original_contents_): New data member.
4773         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4774         in parameters instead of calling Object::section_contents without
4775         locking.
4776         (Arm_output_section::group_section): New parameter TASK.  Pass it
4777         to callees that need locking objects.
4778         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4779         to lock EXIDX input sections.  Fix a formatting issue.  Call
4780         Arm_exidx_merged_section::build_contents to create merged section
4781         contents.
4782         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4783         to lock object of stub table owner.
4784         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4785         TEXT_SIZE to initialize data member TEXT_SIZE_.
4786         (Arm_exidx_input_section::addralign): Fix typo in comment.
4787         (Arm_exidx_input_section::text_size): New method.
4788         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4789         that require locking objects.  Lock objects before scanning for stubs
4790         and updating local symbols.
4791         (Arm_input_section<big_endian>::init): Copy contents of original
4792         input section.
4793         (Arm_input_section<big_endian>::do_write): Use saved contents of
4794         original input section instead of calling Object::section_contents
4795         without locking.
4796         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4797         size without calling Object::section_size().
4798         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4799         for size.  Allocate a buffer for merged EXIDX entries.
4800         (Arm_exidx_merged_section::build_contents): New method.
4801         (Arm_exidx_merged_section::do_write): Move merge section contents
4802         building code to Arm_exidx_merged_section::build_contetns.  Write
4803         out contetns in buffer instead of building it on the fly.
4804         (Arm_relobj::make_exidx_input_section): Also pass text section size
4805         to Arm_exidx_input_section constructor.
4806         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4807         (Arm_dynobj::do_read_symbols): Fix memory leak.
4808         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4809         * target.h: (class Task): Add forward declaration.
4810         (Target::relax): Add new parameter TASK and pass it to
4811         Target::do_relax().
4812         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4813
4814 2010-11-05  Cary Coutant  <ccoutant@google.com>
4815
4816         PR gold/10708
4817         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4818         object when reading from the file.
4819         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4820         second layout pass.
4821         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4822         when reading section contents.
4823         (get_section_contents): Likewise.
4824         (icf::find_identical_sections): Likewise.
4825         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4826         object when reading from the file.
4827         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4828         the object when doing deferred section layout.
4829
4830 2010-11-03  Nick Clifton  <nickc@redhat.com>
4831
4832         PR gold/12001
4833         * script.h (class Symbol_assignment: name): New member.  Returns
4834         the name of the symbol.
4835         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4836         Returns true if the given symbol name is on the list of
4837         assignments wating to be processed.
4838         * archive.cc (should_incldue_member): If the symbol is undefined,
4839         check to see if it is on the list of symbols pending assignment.
4840
4841 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4842
4843         * script-sections.cc (Script_sections::find_memory_region): Check
4844         for a NULL output section pointer.
4845
4846 2010-10-29  Doug Kwan  <dougkwan@google.com>
4847
4848         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4849         Output_section::add_relaxed_input_section.
4850         * output.cc (Output_section::add_relaxed_input_section): Add new
4851         arguments LAYOUT and NAME.  Set section order index.
4852         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4853         Copy section order index.
4854         * output.h (Output_section::add_relaxed_input_section): Add new
4855         arguments LAYOUT and NAME.
4856
4857 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4858
4859         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4860         NATIVE_OR_CROSS_LINKER.
4861         * testsuite/Makefile.in: Regenerate.
4862
4863 2010-10-20  Doug Kwan  <dougkwan@google.com>
4864
4865         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4866         without SHF_LINK_ORDER flags.
4867         * layout.cc (Layout::choose_output_section): Do not filter
4868         SHF_LINK_ORDER flag in a relocatable link.
4869
4870 2010-10-17  Cary Coutant  <ccoutant@google.com>
4871
4872         * output.h (Output_segment::set_section_addresses): Change function
4873         signature.  Update all callers.
4874         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4875         sections.
4876         (Output_segment::set_section_addresses): Align after last TLS
4877         section.  Add padding before last relro section instead of after.
4878
4879 2010-10-17  Doug Kwan  <dougkwan@google.com>
4880
4881         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4882         GOT output section to be writable.
4883
4884 2010-10-14  Cary Coutant  <ccoutant@google.com>
4885
4886         * debug.h (DEBUG_INCREMENTAL): New flag.
4887         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4888         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4889         mode.
4890         * incremental.cc (report_command_line): Ignore all forms of
4891         --incremental.
4892         * layout.cc (Layout::Layout): Check parameters for incremental link
4893         mode.
4894         * options.cc (General_options::parse_incremental): New function.
4895         (General_options::parse_no_incremental): New function.
4896         (General_options::parse_incremental_full): New function.
4897         (General_options::parse_incremental_update): New function.
4898         (General_options::incremental_mode_): New data member.
4899         (General_options::finalize): Check incremental_mode_.
4900         * options.h (General_options): Update help text for --incremental.
4901         Add --no-incremental, --incremental-full, --incremental-update.
4902         (General_options::Incremental_mode): New enum type.
4903         (General_options::incremental_mode): New function.
4904         (General_options::incremental_mode_): New data member.
4905         * parameters.cc (Parameters::incremental_mode_): New data member.
4906         (Parameters::set_options): Set incremental_mode_.
4907         (Parameters::set_incremental_full): New function.
4908         (Parameters::incremental): New function.
4909         (Parameters::incremental_update): New function.
4910         (set_parameters_incremental_full): New function.
4911         * parameters.h (Parameters::set_incremental_full): New function.
4912         (Parameters::incremental): New function.
4913         (Parameters::incremental_update): New function.
4914         (Parameters::incremental_mode_): New data member.
4915         (set_parameters_incremental_full): New function.
4916         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
4917         incremental link mode.
4918         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
4919         (Sized_relobj::do_relocate_sections): Likewise.
4920         * testsuite/Makefile.am (incremental_test): Use --incremental-full
4921         option.
4922         * testsuite/Makefile.in: Regenerate.
4923         * testsuite/incremental_test.sh: Filter all forms of --incremental.
4924
4925 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4926
4927         * script-sections.h (class Script_sections): Make
4928         Sections_elements typedef public.
4929         * script-sections.cc (class Sort_output_sections): Add elements_
4930         field.  Add constructor which sets it; change all callers.
4931         (Sort_output_sections::is_before): New function.
4932         (Sort_output_sections::operator()): Call is_before.
4933         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
4934         conditional.
4935         * testsuite/script_test_10.sh: New test. Test script section
4936         order.
4937         * testsuite/script_test_10.t: Likewise.
4938         * testsuite/script_test_10.s: Likewise.
4939         * testsuite/Makefile.am: Wrap the cross linker tests and the
4940         common tests into NATIVE_OR_CROSS_LINKER.
4941         (check_SCRIPTS): Add script_test_10.sh.
4942         (check_DATA): Add script_test_10.stdout.
4943         (script_test_10.o, script_test_10): New targets.
4944         (script_test_10.stdout): New target.
4945         * configure, testsuite/Makefile.in: Regenerate.
4946
4947 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4948
4949         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
4950         error for the deprecated relocations.
4951         (Target_arm::Scan::global): Likewise.
4952         (Target_arm::Relocate::relocate): Likewise.
4953
4954 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
4955
4956         * fileread.cc (Input_file::find_file): Initialize *found_name
4957         and *namep when using the fallback search for case 4.
4958
4959 2010-10-11  Cary Coutant  <ccoutant@google.com>
4960
4961         * options.h (class General_options): Redefine -z lazy as an alias for
4962         the negation of -z now.
4963
4964 2010-10-11  Ian Lance Taylor  <iant@google.com>
4965
4966         * resolve.cc (symbol_to_bits): Report the value of the unsupported
4967         binding.
4968
4969 2010-10-06  Nick Clifton  <nickc@redhat.com>
4970
4971         * script-sections.cc(class Memory_region): Remove
4972         current_lma_offset_ field.  Rename current_vma_offset_ to
4973         current_offset_.  Add last_section_ field.
4974         (Memory_region::get_current_vma_address): Rename to
4975         get_current_address.
4976         (Memory_region::get_current_lma_address): Delete.
4977         (Memory_region::increment_vma_offset): Rename to
4978         increment_offset.
4979         (Memory_region::increment_lma_offset): Delete.
4980         (Memory_region::attributes_compatible): New method.  Returns
4981         true if the provided section is compatible with the region.
4982         (Memory_region::get_last_section): New method.  Returns the last
4983         section to use the region.
4984         (Memory_region::set_last_section): New method.  Stores the last
4985         section to use the region.
4986         (Script_sections::block_in_region): New method.  Returns true if
4987         a block of memory is contained within a region.
4988         (Script_sections::find_memory_region): New method.  Locates a
4989         memory region to be used to set a VMA or LMA address.
4990         (Output_section_definition::set_section_addresses): Add code to
4991         check for addresses set by memory regions.
4992         (Output_segment::set_section_addresses): Remove memory region
4993         walking code.
4994         (Script_sections::create_segment): Add a warning if a header
4995         segment is created outside of any region.
4996         * script-sections.h (class Script_sections): Add prototypes for
4997         find_memory_region and block_in_region methods.
4998         * testsuite/memory_test.s: Use .long instead of .word.
4999         * testsuite/memory_test.t: Add some more output sections.
5000         * testsuite/memory_test.sh: Update expected output.
5001
5002 2010-10-02  Doug Kwan  <dougkwan@google.com>
5003
5004         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5005         defintion to symtab.h
5006         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5007         declaration to defintion.
5008
5009 2010-10-01  Nick Clifton  <nickc@redhat.com>
5010
5011         * expression.cc (eval): Replace dummy argument with NULL.
5012         (eval_maybe_dot): Check for a NULL result section pointer.
5013         (Symbol_expression::value): Likewise.
5014         (Dot_expression::value): Likewise.
5015         (BINARY_EXPRESSION): Likewise.
5016         (Max_expression::value): Likewise.
5017         (Min_expression::value): Likewise.
5018         (Absolute_expression::value): Likewise.
5019         (Addr_expression::value_from_output_section): Likewise.
5020         (Loaddddr_expression::value_from_output_section): Likewise.
5021         (Segment_start_expression::value): Likewise.
5022         * script-sections.cc
5023         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5024         argument with NULL.
5025         (Sections_elememt_dot_assignment::set_section_addresses):
5026         Likewise.
5027         (Output_data_expression::do_write_to_buffer): Likewise.
5028         (Output_section_definition::finalize_symbols): Likewise.
5029         (Output_section_definition::set_section_addresses): Likewise.
5030
5031 2010-09-30  Doug Kwan  <dougkwan@google.com>
5032
5033         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5034
5035 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5036
5037         * target.h (Target::can_icf_inline_merge_sections): New virtual
5038         function.
5039         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5040         virtual function.
5041         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5042         virtual function.
5043         * icf.cc (get_section_contents): Inline merge sections only when
5044         target allows it.
5045
5046 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5047
5048         * configure: Regenerate.
5049
5050 2010-09-17  Ian Lance Taylor  <iant@google.com>
5051
5052         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5053         * testsuite/Makefile.am (memory_test.o): New target.
5054         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5055         memory_test.t.
5056         * testsuite/Makefile.in: Rebuild.
5057
5058 2010-09-17  Doug Kwan  <dougkwan@google.com>
5059
5060         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5061         defintion if relocation uses GOT entries of the symbol.
5062         * testsuite/icf_safe_test.sh: Fix test.
5063         * testsuite/icf_safe_so_test.sh: Fix test.
5064
5065 2010-09-16  Cary Coutant  <ccoutant@google.com>
5066
5067         * script_sections.cc (class Memory_region): Remove "NULL" from
5068         vector initializations.
5069
5070 2010-09-15  Cary Coutant  <ccoutant@google.com>
5071
5072         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5073         Resolve forwarding symbols.
5074
5075 2010-09-15  Doug Kwan  <dougkwan@google.com>
5076
5077         * gold/testsuite/script_test_3.t: Add ARM special sections.
5078         * gold/testsuite/script_test_4.t: Same.
5079         * gold/testsuite/script_test_5.t: Same.
5080         * gold/testsuite/script_test_6.t: Same.
5081         * gold/testsuite/script_test_7.t: Same.
5082         * gold/testsuite/script_test_7.t: Same.
5083         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5084
5085 2010-09-14  Cary Coutant  <ccoutant@google.com>
5086
5087         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5088         (Target_x86_64::Relocate::relocate_tls): Replace check for
5089         saw_tls_block_reloc_ with test for executable section.
5090
5091 2010-09-12  Cary Coutant  <ccoutant@google.com>
5092
5093         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5094         position-independent executables to shared libraries need dynamic
5095         relocations.
5096         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5097         position-independent executables.
5098         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5099         * testsuite/Makefile.in: Regenerate.
5100
5101 2010-09-10  Nick Clifton  <nickc@redhat.com>
5102
5103         PR gold/11997
5104         * testsuite/memory_test.t: Discard any sections that are not
5105         needed.
5106
5107 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5108
5109         PR gold/11996
5110         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5111         "This::" to work around a bug in gcc 4.2.
5112
5113         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5114
5115 2010-09-09  Rafael Espindola  <espindola@google.com>
5116
5117         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5118         sections with different PF_X flags in the same segment.
5119         (Layout::find_first_load_seg): Search all segments to find the first
5120         one.
5121         * options.h (rosegment): New.
5122
5123 2010-09-08  Rafael Espindola  <espindola@google.com>
5124
5125         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5126
5127 2010-09-08  Doug Kwan  <dougkwan@google.com>
5128
5129         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5130         (Arm_relobj::do_relocate_sections): Add new parameter for output
5131         file to match the parent.
5132         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5133         of local symbols instead of input values.  Update code to track
5134         changes in gold::relocate_section.
5135         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5136         (Sized_relobj::compute_final_local_value_internal): New methods.
5137         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5138         body into private version of Sized_relobj::compute_final_local_value.
5139         Call the inline method.
5140         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5141         merged symbol value if there is one.
5142         (Symbol_value::has_output_value): New method defintiion.
5143         (Sized_relobj::Compute_final_local_value_status): New enum type.
5144         (Sized_relobj::compute_final_local_value): New methods.
5145         (Sized_relobj::compute_final_local_value_internal): New methods.
5146         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5147         and arm_cortex_a8.sh.
5148         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5149         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5150         New tests.
5151         * Makefile.in: Regenerate.
5152         * testsuite/arm_bl_out_of_range.s: Update test.
5153         * testsuite/thumb_bl_out_of_range.s: Ditto.
5154         * testsuite/thumb_blx_out_of_range.s: Ditto.
5155         * testsuite/arm_branch_out_of_range.sh: New file.
5156         * testsuite/arm_cortex_a8.sh: Ditto.
5157         * testsuite/arm_cortex_a8_b.s: Ditto.
5158         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5159         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5160         * testsuite/arm_cortex_a8_bl.s: Ditto.
5161         * testsuite/arm_cortex_a8_blx.s: Ditto.
5162         * testsuite/arm_cortex_a8_local.s: Ditto.
5163         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5164         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5165
5166 2010-09-08  Rafael Espindola  <espindola@google.com>
5167
5168         * Makefile.am (memory_test.stdout): Run readelf with -W.
5169         * Makefile.in: Regenerate.
5170         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5171         64 bit output.
5172
5173 2010-09-08  Rafael Espindola  <espindola@google.com>
5174
5175         * script-sections.cc (Script_sections::add_memory_region): Convert
5176         field precision to int.
5177         * script.cc (script_set_section_region, script_set_section_region):
5178         Convert field precision to int.
5179
5180 2010-09-08  Rafael Espindola  <espindola@google.com>
5181
5182         * arm.cc (do_finalize_sections): Create the __exidx_start and
5183         __exdix_end symbols even when the section is missing.
5184
5185 2010-09-08  Nick Clifton  <nickc@redhat.com>
5186
5187         * README: Remove claim that MEMORY is not supported.
5188         * expression.cc (script_exp_function_origin)
5189         (script_exp_function_length): Move from here to ...
5190         * script.cc: ... here.
5191         (script_set_section_region, script_add_memory)
5192         (script_parse_memory_attr, script_include_directive): New
5193         functions.
5194         * script-sections.cc
5195         (class Memory_region): New class.
5196         (class Output_section_definition): Add set_memory_region,
5197         set_section_vma, set_section_lma and get_section_name methods.
5198         (class Script_Sections): Add add_memory_region,
5199         find_memory_region, find_memory_region_origin,
5200         find_memory_region_length and set_memory_region methods.
5201         Have set_section_addresses method walk the list of set memory
5202         regions.
5203         Extend the print methos to display memory regions.
5204         * script-sections.h: Add prototypes for new methods.
5205         Add enum for MEMORY region attributes.
5206         * yyscript.y: Add support for parsing MEMORY regions.
5207         * script-c.h: Add prototypes for new functions.
5208         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5209         * testsuite/Makefile.in: Regenerate.
5210         * testsuite/memory_test.sh: New script.
5211         * testsuite/memory_test.s: New assembler source file.
5212         * testsuite/memory_test.t: New linker script.
5213
5214 2010-08-27  Doug Kwan  <dougkwan@google.com>
5215
5216         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5217         reference override an existing dynamic weak reference.
5218         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5219         * testsuite/Makefile.in: Regenerate.
5220         * testsuite/dyn_weak_ref.sh: New file.
5221         * testsuite/dyn_weak_ref_1.c: Ditto.
5222         * testsuite/dyn_weak_ref_2.c: Ditto.
5223
5224 2010-08-27  Ian Lance Taylor  <iant@google.com>
5225
5226         * incremental.h (class Incremental_input_entry): Add virtual
5227         destructor.
5228
5229 2010-08-27  Ian Lance Taylor  <iant@google.com>
5230
5231         * testsuite/start_lib_test_3.c: Mark t3 as used.
5232
5233 2010-08-27  Nick Clifton  <nickc@redhat.com>
5234
5235         * options.cc (version_script): Fix small typo in previous
5236         whitespace tidyup.
5237
5238 2010-08-25  Nick Clifton  <nickc@redhat.com>
5239
5240         * archive.cc: Formatting fixes: Remove whitespace between
5241         typename and following asterisk.  Remove whitespace between
5242         function name and opening parenthesis.
5243         * archive.h: Likewise.
5244         * arm.cc: Likewise.
5245         * attributes.cc: Likewise.
5246         * attributes.h: Likewise.
5247         * common.cc: Likewise.
5248         * copy-relocs.cc: Likewise.
5249         * dirsearch.h: Likewise.
5250         * dynobj.cc: Likewise.
5251         * ehframe.cc: Likewise.
5252         * ehframe.h: Likewise.
5253         * expression.cc: Likewise.
5254         * fileread.cc: Likewise.
5255         * fileread.h: Likewise.
5256         * gc.h: Likewise.
5257         * gold-threads.cc: Likewise.
5258         * gold.cc: Likewise.
5259         * i386.cc: Likewise.
5260         * icf.h: Likewise.
5261         * incremental-dump.cc: Likewise.
5262         * incremental.cc: Likewise.
5263         * layout.cc: Likewise.
5264         * layout.h: Likewise.
5265         * main.cc: Likewise.
5266         * merge.cc: Likewise.
5267         * merge.h: Likewise.
5268         * object.cc: Likewise.
5269         * object.h: Likewise.
5270         * options.cc: Likewise.
5271         * options.h: Likewise.
5272         * output.cc: Likewise.
5273         * output.h: Likewise.
5274         * plugin.cc: Likewise.
5275         * plugin.h: Likewise.
5276         * powerpc.cc: Likewise.
5277         * reloc.cc: Likewise.
5278         * script-c.h: Likewise.
5279         * script-sections.cc: Likewise.
5280         * script.cc: Likewise.
5281         * stringpool.cc: Likewise.
5282         * symtab.cc: Likewise.
5283         * symtab.h: Likewise.
5284         * target.cc: Likewise.
5285         * timer.cc: Likewise.
5286         * timer.h: Likewise.
5287         * version.cc: Likewise.
5288         * x86_64.cc: Likewise.
5289
5290 2010-08-24  Nick Clifton  <nickc@redhat.com>
5291
5292         PR 11899
5293         * layout.cc (segment_precedes): Sort segments by their physical
5294         addresses, if they have been set.
5295
5296 2010-08-23  Cary Coutant  <ccoutant@google.com>
5297
5298         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5299         symbols data.
5300         (Lib_group::include_member): Unlock object after deleting its
5301         symbols data.
5302         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5303         the bug fixed here.
5304
5305 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5306             Cary Coutant  <ccoutant@google.com>
5307
5308         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5309         constructor, and set_blocker.
5310         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5311         readsyms_blocker_.
5312         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5313         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5314         * testsuite/Makefile.am (start_lib_test): New test case.
5315         * testsuite/Makefile.in: Regenerate.
5316         * testsuite/start_lib_test_main.c: New file.
5317         * testsuite/start_lib_test_1.c: New file.
5318         * testsuite/start_lib_test_2.c: New file.
5319         * testsuite/start_lib_test_3.c: New file.
5320
5321 2010-08-19  Ian Lance Taylor  <iant@google.com>
5322
5323         * Makefile.in: Rebuild with automake 1.11.1.
5324         * aclocal.m4: Likewise.
5325         * testsuite/Makefile.in: Likewise.
5326
5327 2010-08-19  Ian Lance Taylor  <iant@google.com>
5328
5329         PR 10893
5330         * i386.cc (class Output_data_plt_i386): Update declarations.
5331         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5332         local_ifuncs_ fields.
5333         (Target_i386::do_plt_section_for_global): New function.
5334         (Target_i386::do_plt_section_for_local): New function.
5335         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5336         parameter; change all callers.  Initialize global_ifuncs_ and
5337         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5338         __rel_iplt_end.
5339         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5340         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5341         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5342         symbols.
5343         (Target_i386::make_plt_section): New function, broken out of
5344         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5345         (Target_i386::make_plt_entry): Call make_plt_section.
5346         (Target_i386::make_local_ifunc_plt_entry): New function.
5347         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5348         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5349         R_386_IRELATIVE to switch.
5350         (Target_i386::Scan::global): Likewise.
5351         (Target_i386::Relocate::relocate): Likewise.
5352         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5353         switch.
5354         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5355         (Target_x86_64::do_plt_section_for_global): New function.
5356         (Target_x86_64::do_plt_section_for_local): New function.
5357         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5358         parameter; change all callers.  If doing a static link define
5359         __rela_iplt_start and __rela_iplt_end.
5360         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5361         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5362         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5363         to point to .plt.
5364         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5365         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5366         switch.
5367         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5368         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5369         R_X86_64_IRELATIVE to switch.
5370         (Target_x86_64::Scan::global): Likewise.
5371         (Target_x86_64::Relocate::relocate): Likewise.
5372         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5373         switch.
5374         * target.h (class Target): Add plt_section_for_global and
5375         plt_section_for_local functions.  Add do_plt_section_for_global
5376         and do_plt_section_for_local virtual functions.
5377         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5378         clarifying comments.
5379         (Symbol::use_plt_offset): Handle IFUNC symbol.
5380         * object.cc (Sized_relobj::Sized_relobj): Initialize
5381         local_plt_offsets_.
5382         (Sized_relobj::local_has_plt_offset): New function.
5383         (Sized_relobj::local_plt_offset): New function.
5384         (Sized_relobj::set_local_plt_offset): New function.
5385         (Sized_relobj::do_count): Handle IFUNC symbol.
5386         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5387         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5388         is_ifunc_symbol functions.
5389         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5390         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5391         local_plt_offsets_ field.
5392         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5393         * output.h (class Output_section_data): Add non-const
5394         output_section function.
5395         (class Output_data_got): Update declarations.
5396         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5397         Add use_plt_offset parameter to global and local constructors.
5398         Change all callers.  Change local_sym_index_ field to 31 bits.
5399         Change GSYM_CODE and CONSTANT_CODE accordingly.
5400         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5401         doing a static link don't set sh_link field.
5402         (Output_data_got::Got_entry::write): Use PLT offset if
5403         appropriate.
5404         (Output_data_got::add_global_plt): New function.
5405         (Output_data_got::add_local_plt): New function.
5406         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5407         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5408         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5409         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5410         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5411         IFUNC conditional.
5412         * testsuite/ifunc-sel.h: New file.
5413         * testsuite/ifuncmain1.c: New file.
5414         * testsuite/ifuncmain1vis.c: New file.
5415         * testsuite/ifuncmod1.c: New file.
5416         * testsuite/ifuncdep2.c: New file.
5417         * testsuite/ifuncmain2.c: New file.
5418         * testsuite/ifuncmain3.c: New file.
5419         * testsuite/ifuncmod3.c: New file.
5420         * testsuite/ifuncmain4.c: New file.
5421         * testsuite/ifuncmain5.c: New file.
5422         * testsuite/ifuncmod5.c: New file.
5423         * testsuite/ifuncmain6pie.c: New file.
5424         * testsuite/ifuncmod6.c: New file.
5425         * testsuite/ifuncmain7.c: New file.
5426         * configure, testsuite/Makefile.in: Rebuild.
5427
5428 2010-08-18  Ian Lance Taylor  <iant@google.com>
5429
5430         * incremental.cc
5431         (Output_section_incremental_inputs::write_input_files): Add cast
5432         to avoid signed/unsigned comparison warning.
5433         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5434
5435 2010-08-12  Cary Coutant  <ccoutant@google.com>
5436
5437         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5438
5439 2010-08-13  Ian Lance Taylor  <iant@google.com>
5440
5441         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5442
5443 2010-08-12  Cary Coutant  <ccoutant@google.com>
5444             Doug Kwan  <dougkwan@google.com>
5445
5446         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5447         defintion overrides non-weak undef, remember that the original undef
5448         is not weak.
5449         * symtab.cc (Symbol_table::sized_write_global): For undef without
5450         an original weak binding, set binding to global in output.
5451         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5452         * testsuite/Makefile.in: Regenerate.
5453         * testsuite/strong_ref_weak_def.sh: New file.
5454         * testsuite/strong_ref_weak_def_1.c: Ditto.
5455         * testsuite/strong_ref_weak_def_2.c: Ditto.
5456
5457 2010-08-12  Cary Coutant  <ccoutant@google.com>
5458
5459         * testsuite/incremental_test.sh: Rewrite.
5460         * testsuite/incremental_test_1.c: Rewrite.
5461         * testsuite/incremental_test_2.c: Rewrite.
5462
5463 2010-08-12  Cary Coutant  <ccoutant@google.com>
5464
5465         * arm.cc (Target_arm::got_size): Add const.
5466         (Target_arm::got_entry_count): New function.
5467         (Target_arm::plt_entry_count): New function.
5468         (Target_arm::first_plt_entry_offset): New function.
5469         (Target_arm::plt_entry_size): New function.
5470         (Output_data_plt_arm::entry_count): New function.
5471         (Output_data_plt_arm::first_plt_entry_offset): New function.
5472         (Output_data_plt_arm::get_plt_entry_size): New function.
5473         * i386.cc (Target_i386::got_size): Add const.
5474         (Target_i386::got_entry_count): New function.
5475         (Target_i386::plt_entry_count): New function.
5476         (Target_i386::first_plt_entry_offset): New function.
5477         (Target_i386::plt_entry_size): New function.
5478         (Output_data_plt_i386::entry_count): New function.
5479         (Output_data_plt_i386::first_plt_entry_offset): New function.
5480         (Output_data_plt_i386::get_plt_entry_size): New function.
5481         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5482         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5483         * incremental.cc: Include target.h.
5484         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5485         parameter.  Adjust all callers.  Find incremental_got_plt section.
5486         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5487         section.
5488         (Output_section_incremental_inputs::set_final_data_size): Calculate
5489         size of incremental_got_plt section.
5490         (Output_section_incremental_inputs::do_write): Write the
5491         incremental_got_plt section.
5492         (Got_plt_view_info): New struct.
5493         (Local_got_offset_visitor): New class.
5494         (Global_got_offset_visitor): New class.
5495         (Global_symbol_visitor_got_plt): New class.
5496         (Output_section_incremental_inputs::write_got_plt): New function.
5497         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5498         Add parameter.  Adjust all callers.
5499         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5500         (Incremental_inputs::got_plt_section): New function.
5501         (Incremental_inputs::got_plt_section_): New data member.
5502         (Incremental_got_plt_reader): New class.
5503         * layout.cc (Layout::create_incremental_info_sections): Add the
5504         incremental_got_plt section.
5505         * object.h (Got_offset_list::get_list): New function.
5506         (Got offset_list::for_all_got_offsets): New function.
5507         (Sized_relobj::local_got_offset_list): New function.
5508         * powerpc.cc (Target_powerpc::got_size): Add const.
5509         (Target_powerpc::got_entry_count): New function.
5510         (Target_powerpc::plt_entry_count): New function.
5511         (Target_powerpc::first_plt_entry_offset): New function.
5512         (Target_powerpc::plt_entry_size): New function.
5513         (Output_data_plt_powerpc::entry_count): New function.
5514         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5515         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5516         * sparc.cc (Target_sparc::got_size): Add const.
5517         (Target_sparc::got_entry_count): New function.
5518         (Target_sparc::plt_entry_count): New function.
5519         (Target_sparc::first_plt_entry_offset): New function.
5520         (Target_sparc::plt_entry_size): New function.
5521         (Output_data_plt_sparc::entry_count): New function.
5522         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5523         (Output_data_plt_sparc::get_plt_entry_size): New function.
5524         * symtab.h (Symbol::got_offset_list): New function.
5525         (Symbol_table::for_all_symbols): New function.
5526         * target.h (Sized_target::got_entry_count): New function.
5527         (Sized_target::plt_entry_count): New function.
5528         (Sized_target::plt_entry_size): New function.
5529         * x86_64.cc (Target_x86_64::got_size): Add const.
5530         (Target_x86_64::got_entry_count): New function.
5531         (Target_x86_64::plt_entry_count): New function.
5532         (Target_x86_64::first_plt_entry_offset): New function.
5533         (Target_x86_64::plt_entry_size): New function.
5534         (Output_data_plt_x86_64::entry_count): New function.
5535         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5536         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5537
5538 2010-08-12  Cary Coutant  <ccoutant@google.com>
5539
5540         * archive.cc: Include incremental.h.
5541         (Archive::Archive): Initialize incremental_info_.
5542         (Archive::include_member): Record archive members in incremental info.
5543         (Add_archive_symbols::run): Record begin and end of an archive in
5544         incremental info.
5545         (Lib_group::include_member): Record objects in incremental info.
5546         * archive.h (Incremental_archive_entry): Forward declaration.
5547         (Archive::set_incremental_info): New member function.
5548         (Archive::incremental_info): New member function.
5549         (Archive::Unused_symbol_iterator): New class.
5550         (Archive::unused_symbols_begin): New member function.
5551         (Archive::unused_symbols_end): New member function.
5552         (Archive::incremental_info_): New data member.
5553         * incremental-dump.cc (find_input_containing_global): New function.
5554         (dump_incremental_inputs): Dump new incremental info sections.
5555         * incremental.cc: Include symtab.h.
5556         (Output_section_incremental_inputs): New class.
5557         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5558         new incremental info sections.
5559         (Sized_incremental_binary::do_check_inputs): Likewise.
5560         (Incremental_inputs::report_archive): Remove.
5561         (Incremental_inputs::report_archive_begin): New function.
5562         (Incremental_inputs::report_archive_end): New function.
5563         (Incremental_inputs::report_object): New function.
5564         (Incremental_inputs::finalize_inputs): Remove.
5565         (Incremental_inputs::report_input_section): New function.
5566         (Incremental_inputs::report_script): Rewrite.
5567         (Incremental_inputs::finalize): Do nothing but finalize string table.
5568         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5569         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5570         (Incremental_inputs::create_data_sections): New function.
5571         (Incremental_inputs::relocs_entsize): New function.
5572         (Output_section_incremental_inputs::set_final_data_size): New function.
5573         (Output_section_incremental_inputs::do_write): New function.
5574         (Output_section_incremental_inputs::write_header): New function.
5575         (Output_section_incremental_inputs::write_input_files): New function.
5576         (Output_section_incremental_inputs::write_info_blocks): New function.
5577         (Output_section_incremental_inputs::write_symtab): New function.
5578         * incremental.h (Incremental_script_entry): Forward declaration.
5579         (Incremental_object_entry): Forward declaration.
5580         (Incremental_archive_entry): Forward declaration.
5581         (Incremental_inputs): Forward declaration.
5582         (Incremental_inputs_header_data): Remove.
5583         (Incremental_inputs_header): Remove.
5584         (Incremental_inputs_header_write): Remove.
5585         (Incremental_inputs_entry_data): Remove.
5586         (Incremental_inputs_entry): Remove.
5587         (Incremental_inputs_entry_write): Remove.
5588         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5589         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5590         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5591         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5592         Likewise.
5593         (Incremental_input_entry): New class.
5594         (Incremental_script_entry): New class.
5595         (Incremental_object_entry): New class.
5596         (Incremental_archive_entry): New class.
5597         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5598         (Incremental_inputs::report_inputs): Remove.
5599         (Incremental_inputs::report_archive): Remove.
5600         (Incremental_inputs::report_archive_begin): New function.
5601         (Incremental_inputs::report_archive_end): New function.
5602         (Incremental_inputs::report_object): Change prototype.
5603         (Incremental_inputs::report_input_section): New function.
5604         (Incremental_inputs::report_script): Change prototype.
5605         (Incremental_inputs::get_reloc_count): New function.
5606         (Incremental_inputs::set_reloc_count): New function.
5607         (Incremental_inputs::create_data_sections): New function.
5608         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5609         (Incremental_inputs::inputs_section): New function.
5610         (Incremental_inputs::symtab_section): New function.
5611         (Incremental_inputs::relocs_section): New function.
5612         (Incremental_inputs::get_stringpool): Add const.
5613         (Incremental_inputs::command_line): Add const.
5614         (Incremental_inputs::inputs): Remove.
5615         (Incremental_inputs::command_line_key): New function.
5616         (Incremental_inputs::input_file_count): New function.
5617         (Incremental_inputs::input_files): New function.
5618         (Incremental_inputs::relocs_entsize): New function.
5619         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5620         (Incremental_inputs::finalize_inputs): Remove.
5621         (Incremental_inputs::Input_info): Remove.
5622         (Incremental_inputs::lock_): Remove.
5623         (Incremental_inputs::inputs_): Change type.
5624         (Incremental_inputs::inputs_map_): Remove.
5625         (Incremental_inputs::current_object_entry_): New data member.
5626         (Incremental_inputs::inputs_section_): New data member.
5627         (Incremental_inputs::symtab_section_): New data member.
5628         (Incremental_inputs::relocs_section_): New data member.
5629         (Incremental_inputs::reloc_count_): New data member.
5630         (Incremental_inputs_reader): New class.
5631         (Incremental_symtab_reader): New class.
5632         (Incremental_relocs_reader): New class.
5633         * layout.cc (Layout::finalize): Move finalization of incremental info
5634         and creation of incremental info sections to follow finalization of
5635         symbol table.  Set offsets for postprocessing sections.
5636         (Layout::create_incremental_info_sections): Call
5637         Incremental_inputs::create_data_sections.  Add incremental symtab
5638         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5639         sections to layout after input sections.
5640         * layout.h (struct Timespec): Forward declaration.
5641         (Layout::incremental_inputs): Add const.
5642         (Layout::create_incremental_info_sections): Add parameter.
5643         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5644         * object.cc: Include incremental.h.
5645         (Relobj::finalize_incremental_relocs): New function.
5646         (Sized_relobj::do_layout): Record input sections in incremental info.
5647         * object.h (Object::output_section): New function.
5648         (Object::output_section_offset): Moved from Relobj.
5649         (Object::get_incremental_reloc_base): New function.
5650         (Object::get_incremental_reloc_count): New function.
5651         (Object::do_output_section): New function.
5652         (Object::do_output_section_offset): Moved from Relobj.
5653         (Object::do_get_incremental_reloc_base): New function.
5654         (Object::do_get_incremental_reloc_count): New function.
5655         (Object::Object): Initialize new data members.
5656         (Relobj::output_section): Renamed do_output_section and moved to
5657         protected.
5658         (Relobj::output_section_offset): Moved to Object.
5659         (Relobj::do_get_incremental_reloc_base): New function.
5660         (Relobj::do_get_incremental_reloc_count): New function.
5661         (Relobj::allocate_incremental_reloc_counts): New function.
5662         (Relobj::count_incremental_reloc): New function.
5663         (Relobj::finalize_incremental_relocs): New function.
5664         (Relobj::next_incremental_reloc_index): New function.
5665         (Relobj::reloc_counts_): New data member.
5666         (Relobj::reloc_bases_): New data member.
5667         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5668         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5669         (Sized_relobj::incremental_relocs_scan): New function.
5670         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5671         (Sized_relobj::incremental_relocs_write): New function.
5672         (Sized_relobj::incremental_relocs_write_reltype): New function.
5673         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5674         incremental link.
5675         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5676         archives and object files elsewhere.
5677         (Add_symbols::run): Report object files here.
5678         (Finish_group::run): Report end of archive at end of group.
5679         * reloc.cc: Include layout.h, incremental.h.
5680         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5681         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5682         (Sized_relobj::incremental_relocs_scan): New function.
5683         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5684         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5685         (Sized_relobj::incremental_relocs_write): New function.
5686         (Sized_relobj::incremental_relocs_write_reltype): New function.
5687         * script.cc (read_input_script): Rewrite test for incremental link.
5688         Change call to Incremental_inputs::report_script.
5689         * symtab.h (Symbol_table::first_global_index): New function.
5690         (Symbol_table::output_count): New function.
5691
5692 2010-08-12  Doug Kwan  <dougkwan@google.com>
5693
5694         * arm.cc (Target_arm::merge_object_attributes): Check command line
5695         options --no-wchar-size-warning and --no-enum-size-warning.
5696         * options.h (General_options): Add ld-compatible options
5697         --no-enum-size-warning and --no-wchar-size-warning.
5698
5699 2010-08-04  Ian Lance Taylor  <iant@google.com>
5700
5701         * x86_64.cc (Target_x86_64::Scan::local): Use
5702         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5703         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5704         (Target_x86_64::Scan::global): Likewise.
5705         (Target_x86_64::Relocate::relocate): Likewise.
5706         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5707         Likewise.
5708
5709 2010-08-03  Cary Coutant  <ccoutant@google.com>
5710
5711         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5712         to reserve space in merged_strings vector. Keep total input size
5713         for stats.
5714         (Output_merge_string::do_print_merge_stats): Print total input size.
5715         * merge.h (Output_merge_string): Add input_size_ field.
5716         * stringpool.cc (Stringpool_template::string_length): Move
5717         implementations out of Stringpool_template class and place in
5718         stringpool.h.
5719         * stringpool.h (string_length): Move out of Stringpool_template.
5720
5721 2010-08-03  Ian Lance Taylor  <iant@google.com>
5722
5723         PR 11712
5724         * layout.cc (relaxation_loop_body): If address of load segment is
5725         set, adjust address to include headers if possible.
5726
5727 2010-08-03  Ian Lance Taylor  <iant@google.com>
5728
5729         * version.cc (version_string): Bump to 1.10.
5730
5731 2010-08-03  Ian Lance Taylor  <iant@google.com>
5732
5733         PR 11805
5734         * layout.h (enum Output_section_order): Define.
5735         (class Layout): Update declarations.
5736         * layout.cc (Layout::get_output_section): Add order parameter.
5737         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5738         is_first_non_relro parameters.  Change all callers.
5739         (Layout::choose_output_section): Likewise.
5740         (Layout::add_output_section_data): Likewise.
5741         (Layout::make_output_section): Likewise.  Set order.
5742         (Layout::default_section_order): New function.
5743         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5744         * output.cc (Output_section::Output_section): Initialize order_.
5745         Don't initialize deleted fields.
5746         (Output_segment::Output_segment): Don't initialize deleted
5747         fields.
5748         (Output_segment::add_output_section_to_load): New function
5749         replacing add_output_section.  Change all callers to call this or
5750         add_output_section_to_nonload.
5751         (Output_segment::add_output_section_to_nonload): New function.
5752         (Output_segment::remove_output_section): Rewrite.
5753         (Output_segment::add_initial_output_data): Likewise.
5754         (Output_segment::has_any_data_sections): Likewise.
5755         (Output_segment::is_first_section_relro): Likewise.
5756         (Output_segment::maximum_alignment): Likewise.
5757         (Output_segment::has_dynamic_reloc): New function replacing
5758         dynamic_reloc_count.  Change all callers.
5759         (Output_segment::has_dynamic_reloc_list): New function replacing
5760         dynamic_reloc_count_list.  Change all callers.
5761         (Output_segment::set_section_addresses): Rewrite.
5762         (Output_segment::set_offset): Rewrite.
5763         (Output_segment::find_first_and_last_list): Remove.
5764         (Output_segment::set_tls_offsets): Rewrite.
5765         (Output_segment::first_section_load_address): Likewise.
5766         (Output_segment::output_section_count): Likewise.
5767         (Output_segment::section_with_lowest_load_address): Likewise.
5768         (Output_segment::write_section_headers): Likewise.
5769         (Output_segment::print_sections_to_map): Likewise.
5770         * output.h (class Output_data): Remove dynamic_reloc_count_
5771         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5772         (Output_data::add_dynamic_reloc): Rewrite.
5773         (Output_data::has_dynamic_reloc): New function.
5774         (Output_data::dynamic_reloc_count): Remove.
5775         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5776         is_last_relro_, is_first_non_relro_, is_interp_,
5777         is_dynamic_linker_section_ fields.  Add order and set_order
5778         functions.  Remove is_relro_local, set_is_relro_local,
5779         is_last_relro, set_is_last_relro, is_first_non_relro,
5780         set_is_first_non_relro functions, is_interp, set_is_interp,
5781         is_dynamic_linker_section, and set_is_dynamic_linker_section
5782         functions.
5783         (class Output_segment): Change Output_data_list from std::list to
5784         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5785         output_bss_ fields.  Update declarations.
5786
5787 2010-08-02  Ian Lance Taylor  <iant@google.com>
5788
5789         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5790         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5791         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5792
5793 2010-08-02  Ian Lance Taylor  <iant@google.com>
5794
5795         PR 11855
5796         * script.cc (Script_options::Script_options): Initialize
5797         symbol_definitions_ and symbol_references_.
5798         (Script_options::add_symbol_assignment): Update
5799         symbol_definitions_ and symbol_references_.
5800         (Script_options::add_symbol_reference): New function.
5801         (script_symbol): New function.
5802         * script.h (class Script_options): Add symbol_definitions_ and
5803         symbol_references_ fields.
5804         (Script_options::referenced_const_iterator): New type.
5805         (Script_options::referenced_begin): New function.
5806         (Script_options::referenced_end): New function.
5807         (Script_options::is_referenced): New function.
5808         (Script_options::any_unreferenced): New function.
5809         * script-c.h (script_symbol): Declare.
5810         * yyscript.y (exp): Call script_symbol.
5811         * symtab.cc: Include "script.h".
5812         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5813         Change all callers.  Check symbols referenced by scripts.
5814         (Symbol_table::add_undefined_symbols_from_command_line): Add
5815         layout parameter.  Change all callers.
5816         (Symbol_table::do_add_undefined_symbols_from_command_line):
5817         Likewise.  Break out loop body.  Check symbols referenced by
5818         scripts.
5819         (Symbol_table::add_undefined_symbol_from_command_line): New
5820         function broken out of
5821         do_add_undefined_symbols_from_command_line.
5822         * symtab.h (class Symbol_table): Update declarations.
5823         * archive.cc: Include "layout.h".
5824         (Archive::should_include_member): Add layout parameter.  Change
5825         all callers.  Check for symbol mentioned in expression.
5826         * archive.h (class Archive): Update declaration.
5827         * object.cc (Sized_relobj::do_should_include_member): Add layout
5828         parameter.
5829         * object.h (Object::should_include_member): Add layout parameter.
5830         Change all callers.
5831         (Object::do_should_include_member): Add layout parameter.
5832         (class Sized_relobj): Update declaration.
5833         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5834         parameter.
5835         * dynobj.h (class Sized_dynobj): Update declaration.
5836         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5837         layout parameter.
5838         * plugin.h (class Sized_pluginobj): Update declaration.
5839
5840 2010-08-02  Ian Lance Taylor  <iant@google.com>
5841
5842         PR 11866
5843         * output.cc (Output_segment::set_offset): Search for the first and
5844         last sections rather than assuming that the list is in order.
5845         (Output_segment::find_first_and_last_list): New function.
5846         * output.h (class Output_segment): Update declarations.
5847         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5848         (relro_strip_test_SOURCES): New variable.
5849         (relro_strip_test_DEPENDENCIES): New variable.
5850         (relro_strip_test_LDFLAGS): New variable.
5851         (relro_strip_test_LDADD): New variable.
5852         (relro_strip_test.so): New target.
5853
5854 2010-08-02  Ian Lance Taylor  <iant@google.com>
5855
5856         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5857         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5858         (Target_i386::got_tlsdesc_section): New function.
5859         (Target_i386::got_section): Create space for GOT entries for
5860         TLSDESC relocations.
5861         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5862         R_386_TLS_GOTDESC.
5863         (Target_i386::Scan::global): Likewise.
5864         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5865         using TLSDESC GOT.
5866         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5867         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5868         (Target_x86_64::got_tlsdesc_section): New function.
5869         (Target_x86_64::got_section): Create space for GOT entries for
5870         TLSDESC relocations.
5871         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5872         R_386_TLS_GOTDESC.
5873         (Target_x86_64::Scan::global): Likewise.
5874         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5875         using TLSDESC GOT.
5876
5877 2010-08-02  Ian Lance Taylor  <iant@google.com>
5878
5879         * testsuite/final_layout.sh: Use dc to convert from hex to
5880         decimal.
5881
5882 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5883
5884         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5885         paramter to the call to gold::gc_process_relocs.
5886         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5887         paramter to the call to gold::gc_process_relocs.
5888         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5889         parameter to the call to gold::gc_process_relocs.
5890         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5891         template parameter to the call to gold::gc_process_relocs.
5892         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5893         paramter to the call to gold::gc_process_relocs.
5894         * gc.h (get_embedded_addend_size): New function.
5895         (gc_process_relocs): Save the size of the reloc for use by ICF.
5896         * icf.cc (get_section_contents): Get the addend from the text section
5897         for SHT_REL relocation sections.
5898         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5899         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5900         * int_encoding.h (read_from_pointer): New overloaded function.
5901         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5902         * testsuite/icf_sht_rel_addend_test.sh: New file.
5903         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5904         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5905
5906 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5907
5908         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5909         * Makefile.in: Regenerate.
5910         * testsuite/Makefile.in: Regenerate.
5911
5912 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5913
5914         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
5915         * gold/testsuite/debug_msg.cc: Likewise.
5916         * gold/testsuite/odr_violation1.cc
5917         * gold/testsuite/odr_violation2.cc
5918
5919 2010-07-21  Cary Coutant  <ccoutant@google.com>
5920
5921         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
5922         string, and length fields.
5923         (Output_merge_string::Merged_strings_list): New type.
5924         (Output_merge_string::Merged_strings_lists): New typedef.
5925         (Output_merge_string): Replace merged_strings_ with
5926         merged_strings_lists_.
5927         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
5928         Merged_strings_list per input object and section.  Don't store pointer
5929         to the string.  Don't store length with each merged string entry.
5930         (Output_merge_string::finalize_merged_data): Loop over list of merged
5931         strings lists.  Recompute length of each merged string.
5932
5933 2010-07-15  Cary Coutant  <ccoutant@google.com>
5934
5935         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
5936         here.
5937
5938 2010-07-14  Ian Lance Taylor  <iant@google.com>
5939
5940         * descriptors.cc (Descriptors::open): Report correct name in error
5941         message.
5942
5943 2010-07-13  Doug Kwan  <dougkwan@google.com>
5944
5945         * arm.cc (Arm_input_section::Arm_input_section): For a
5946         SHT_ARM_EXIDX section, always keeps the input sections.
5947         (Arm_input_section::set_exidx_section_link): New method.
5948         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
5949         has_errors_ to false.
5950         (Arm_exidx_input_section::has_errors,
5951         Arm_exidx_input_section::set_has_errors): New methods.
5952         (Arm_exidx_input_section::has_errors_): New data member.
5953         (Arm_relobj::get_exidx_shndx_list): New method.
5954         (Arm_output_section::append_text_sections_to_list): Do not skip
5955         section without SHF_EXECINSTR.
5956         (Arm_output_section::fix_exidx_coverage): Skip input sections with
5957         errors.
5958         (Arm_relobj::make_exidx_input_section): Add new parameter for text
5959         section header.  Make error messages more verbose.  Check for
5960         a non-executable section linked to an EXIDX section.
5961         (Arm_relobj::do_read_symbols): Remove error checking, which has been
5962         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
5963         check that there is no deferred EXIDX section if we exit early.
5964         Instead of not making an EXIDX section in case of an error, make one
5965         and set the has_errors flag of it.
5966         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
5967         in a relocatable link.
5968         (Target_arm::do_relax): Look for the EXIDX output section instead of
5969         assuming that it is called .ARM.exidx.
5970         (Target_arm::fix_exidx_coverage): Add a new parameter for input
5971         section list.  Do not check for SHF_EXECINSTR section flags but
5972         skip any input section with errors.
5973         * output.cc (Output_section::Output_section): Initialize
5974         always_keeps_input_sections_ to false.
5975         (Output_section::add_input_section): Check for
5976         always_keeps_input_sections_.
5977         *  output.h (Output_section::always_keeps_input_sections,
5978         Output_section::set_always_keeps_input_sections): New methods.
5979         (Output_section::always_keeps_input_sections): New data member.
5980
5981 2010-07-13  Rafael Espindola  <espindola@google.com>
5982
5983         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
5984         * fileread.h (Input_file): Add try_extra_search_path and find_file.
5985
5986 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
5987             Ian Lance Taylor  <iant@google.com>
5988
5989         * output.h (Output_section_lookup_maps::add_merge_section):
5990         Correct check of whether value was inserted.
5991         (Output_section_lookup_maps::add_merge_input_section): Likewise.
5992         (Output_section_lookup_maps::add_relaxed_input_section):
5993         Likewise.
5994         * arm.cc (Target_arm::got_section): Remove used local os.
5995         * i386.cc (Target_i386::got_section): Likewise.
5996         * x86_64.cc (Target_x86_64::got_section): Likewise.
5997         * sparc.cc (Target_sparc::got_section): Likewise.
5998         (Target_sparc::relocate): Remove unused local have_got_offset.
5999         * powerpc.cc (Target_powerpc::relocate): Likewise.
6000
6001 2010-07-13  Ian Lance Taylor  <iant@google.com>
6002
6003         * compressed_output.cc (zlib_decompress): Fix signature in
6004         !HAVE_ZLIB_H case.
6005
6006         * archive.cc (Archive::include_member): Unlock an external member
6007         of a thin archive.  Don't bother to delete an object we know is
6008         NULL.
6009
6010 2010-07-12  Cary Coutant  <ccoutant@google.com>
6011
6012         * compressed_output.cc (zlib_decompress): New function.
6013         (get_uncompressed_size): New function.
6014         (decompress_input_section): New function.
6015         * compressed_output.h (get_uncompressed_size): New function.
6016         (decompress_input_section): New function.
6017         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6018         Handle compressed debug sections.
6019         * layout.cc (is_compressed_debug_section): New function.
6020         (Layout::output_section_name): Map compressed section names to
6021         canonical names.
6022         * layout.h (is_compressed_debug_section): New function.
6023         (is_debug_info_section): Recognize compressed debug sections.
6024         * merge.cc: Include compressed_output.h.
6025         (Output_merge_data::do_add_input_section): Handle compressed
6026         debug sections.
6027         (Output_merge_string::do_add_input_section): Handle compressed
6028         debug sections.
6029         * object.cc: Include compressed_output.h.
6030         (Sized_relobj::Sized_relobj): Initialize new data members.
6031         (build_compressed_section_map): New function.
6032         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6033         * object.h (Object::section_is_compressed): New method.
6034         (Object::do_section_is_compressed): New method.
6035         (Sized_relobj::Compressed_section_map): New type.
6036         (Sized_relobj::do_section_is_compressed): New method.
6037         (Sized_relobj::compressed_sections_): New data member.
6038         * output.cc (Output_section::add_input_section): Handle compressed
6039         debug sections.
6040         * reloc.cc: Include compressed_output.h.
6041         (Sized_relobj::write_sections): Handle compressed debug sections.
6042
6043 2010-07-08  Cary Coutant  <ccoutant@google.com>
6044
6045         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6046         weak when resolving to a dynamic def.
6047         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6048         for weak undef/dynamic def cases. Adjust callers.
6049         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6050         undef_binding_weak_.
6051         (Symbol_table::sized_write_globals): Adjust symbol binding.
6052         (Symbol_table::sized_write_symbol): Add binding parameter.
6053         * symtab.h (Symbol::set_undef_binding): New method.
6054         (Symbol::is_undef_binding_weak): New method.
6055         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6056         (Symbol_table::should_override): Add new parameter.
6057         (Symbol_table::sized_write_symbol): Add new parameter.
6058
6059         * testsuite/weak_undef_file1.cc: Add new test case.
6060         * testsuite/weak_undef_file2.cc: Fix header comment.
6061         * testsuite/weak_undef_test.cc: Add new test case.
6062
6063 2010-06-29  Doug Kwan  <dougkwan@google.com>
6064
6065         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6066         Initialize USE_SYMBOL_.
6067         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6068         definition.
6069         (Arm_reloc_property::uses_symbol_): New data member declaration.
6070         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6071         uses symbol value and symbol is undefined but not weakly undefined.
6072
6073 2010-06-28  Rafael Espindola  <espindola@google.com>
6074
6075         * plugin.cc (Plugin::load): Use dlerror.
6076
6077 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6078
6079         * symtab.cc (detect_odr_violations): When reporting an ODR
6080         violation, report an object where the symbol is defined.
6081
6082 2010-06-25  Doug Kwan  <dougkwan@google.com>
6083
6084         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6085         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6086         definition.
6087         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6088         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6089         target hook to detect function points.
6090         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6091         * icf.h (Icf::check_section_for_function_pointers): Change type of
6092         parameter SECTION_NAME to const reference to std::string.  Use
6093         target hook to determine if section may have unsafe pointers.
6094         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6095         method definition.
6096
6097 2010-06-21  Rafael Espindola  <espindola@google.com>
6098
6099         * fileread.cc (Input_file::find_fie): New
6100         (Input_file::open): Use Input_file::find_fie.
6101         * fileread.h (Input_file::find_fie): New
6102         * plugin.cc (set_extra_library_path): New.
6103         (Plugin::load): Add set_extra_library_path to the transfer vector.
6104         (Plugin_manager::set_extra_library_path): New.
6105         (Plugin_manager::add_input_file): Use the extra search path if set.
6106         (set_extra_library_path(): New.
6107         * plugin.h (Plugin_manager): Add set_extra_library_path and
6108         extra_search_path_.
6109
6110 2010-06-19  Cary Coutant  <ccoutant@google.com>
6111
6112         * layout.cc (gdb_sections): Add .debug_types.
6113         (lines_only_debug_sections): Likewise.
6114
6115 2010-06-18  Rafael Espindola  <espindola@google.com>
6116
6117         * plugin.cc (add_input_file,add_input_library)
6118         (Plugin_manager::add_input_file): Make filename arguments const.
6119         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6120         const.
6121
6122 2010-06-16  Doug Kwan  <dougkwan@google.com>
6123
6124         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6125         .ARM.attributes section if we have not merged any input
6126         attributes sections.
6127
6128 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6129
6130         * arm.cc: Allow combining objects with no EABI version
6131         information.
6132
6133 2010-06-15  Rafael Espindola  <espindola@google.com>
6134
6135         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6136
6137 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6138
6139         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6140         (struct iovec): Correct !HAVE_READV definition.
6141
6142 2010-06-10  Cary Coutant  <ccoutant@google.com>
6143
6144         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6145         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6146         reloc sections.
6147         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6148
6149         PR 11683
6150         * symtab.h (Symbol::is_placeholder): New member function.
6151         * target-reloc.h (relocate_section): Check for placeholder symbols.
6152
6153         * testsuite/Makefile.am (plugin_test_8): New test.
6154         (plugin_test_9): New test.
6155         * testsuite/Makefile.in: Regenerate.
6156
6157 2010-06-09  Nick Clifton  <nickc@redhat.com>
6158
6159         * yyscript.y (input_list_element): Allow strings prefixed with
6160         the '-' character.  Treat these as libraries.
6161         * script.cc (script_add_library): New function.  Adds a library
6162         specified by "-l<name>" found in an input script.
6163         * script-c.h: Add prototype for script_add_library.
6164
6165 2010-06-07  Doug Kwan  <dougkwan@google.com>
6166
6167         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6168         Restrict stub-group size to be within long conditional branch
6169         range when working around cortex-A8 erratum.
6170
6171 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6172
6173         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6174         #ifdef typo.
6175
6176 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6177
6178         PR gold/11658
6179         * output.cc
6180         (Output_section::Input_section_sort_entry::compare_section_ordering):
6181         Change to return non-zero correctly.
6182         (Output_section::Input_section_sort_section_order_index_compare
6183         ::operator()): Change to fix ambiguity in comparisons.
6184
6185 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6186
6187         * gold.h (is_wildcard_string): New function.
6188         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6189         (Layout::layout_eh_frame): Ditto.
6190         (Layout::find_section_order_index): New method.
6191         (Layout::read_layout_from_file): New method.
6192         * layout.h (Layout::find_section_order_index): New method.
6193         (Layout::read_layout_from_file): New method.
6194         (Layout::input_section_position_): New private member.
6195         (Layout::input_section_glob_): New private member.
6196         * main.cc (main): Call read_layout_from_file here.
6197         * options.h (--section-ordering-file): New option.
6198         * output.cc (Output_section::input_section_order_specified_): New
6199         member.
6200         (Output_section::Output_section): Initialize new member.
6201         (Output_section::add_input_section): Add new parameter.
6202         Keep input sections when --section-ordering-file is used.
6203         (Output_section::set_final_data_size): Sort input sections when
6204         section ordering file is specified.
6205         (Output_section::Input_section_sort_entry): Add new parameter.
6206         Check sorting type.
6207         (Output_section::Input_section_sort_entry::compare_section_ordering):
6208         New method.
6209         (Output_section::Input_section_sort_compare::operator()): Change to
6210         consider section_order_index.
6211         (Output_section::Input_section_sort_init_fini_compare::operator()):
6212         Change to consider section_order_index.
6213         (Output_section::Input_section_sort_section_order_index_compare
6214         ::operator()): New method.
6215         (Output_section::sort_attached_input_sections): Change to sort
6216         according to section order when specified.
6217         (Output_section::add_input_section<32, true>): Add new parameter.
6218         (Output_section::add_input_section<64, true>): Add new parameter.
6219         (Output_section::add_input_section<32, false>): Add new parameter.
6220         (Output_section::add_input_section<64, false>): Add new parameter.
6221         * output.h (Output_section::add_input_section): Add new parameter.
6222         (Output_section::input_section_order_specified): New
6223         method.
6224         (Output_section::set_input_section_order_specified): New method.
6225         (Input_section::Input_section): Initialize section_order_index_.
6226         (Input_section::section_order_index): New method.
6227         (Input_section::set_section_order_index): New method.
6228         (Input_section::section_order_index_): New member.
6229         (Input_section::Input_section_sort_section_order_index_compare): New
6230         struct.
6231         (Output_section::input_section_order_specified_): New member.
6232         * script-sections.cc (is_wildcard_string): Delete and move modified
6233         method to gold.h.
6234         (Output_section_element_input::Output_section_element_input): Modify
6235         call to is_wildcard_string.
6236         (Output_section_element_input::Input_section_pattern
6237         ::Input_section_pattern): Ditto.
6238         (Output_section_element_input::Output_section_element_input): Ditto.
6239         * testsuite/Makefile.am (final_layout): New test case.
6240         * testsuite/Makefile.in: Regenerate.
6241         * testsuite/final_layout.cc: New file.
6242         * testsuite/final_layout.sh: New file.
6243
6244 2010-06-01  Rafael Espindola  <espindola@google.com>
6245
6246         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6247
6248 2010-06-01  Rafael Espindola  <espindola@google.com>
6249
6250         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6251         visibility of symbols.
6252
6253 2010-05-27  Doug Kwan  <dougkwan@google.com>
6254
6255         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6256         from start of output section instead of address for a local symbol
6257         in a merged or relaxed section when doing a relocatable link.
6258
6259 2010-05-26  Rafael Espindola  <espindola@google.com>
6260
6261         PR 11604
6262         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6263         adding sections the garbage collector removed.
6264         * gold/testsuite/Makefile.am: Add test.
6265         * gold/testsuite/Makefile.in: Regenerate.
6266         * gold/testsuite/plugin_test_7.sh: New.
6267         * gold/testsuite/plugin_test_7_1.c: New.
6268         * gold/testsuite/plugin_test_7_2.c: New.
6269
6270 2010-05-26  Rafael Espindola  <espindola@google.com>
6271
6272         * script-sections.cc (Output_section_definition::set_section_addresses):
6273         Check for --section-start.
6274
6275 2010-05-26  Doug Kwan  <dougkwan@google.com>
6276
6277         * arm.cc (Arm_scan_relocatable_relocs): New class.
6278         (Target_arm::relocate_special_relocatable): New method.
6279         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6280         (Arm_relocate_functions::thumb_branch_common): Same.
6281         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6282         instead of Default_scan_relocatable_relocs.
6283         * target-reloc.h (relocate_for_relocatable): Let target handle
6284         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6285         * target.h (Sized_target::relocate_special_relocatable): New method.
6286
6287 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6288
6289         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6290
6291 2010-05-23  Doug Kwan  <dougkwan@google.com>
6292
6293         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6294         instead of a cast.
6295         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6296         with a direct branch, not a conditional branch, to a stub.
6297         * merge.cc (Output_merge_base::record_input_section): New method
6298         defintion.
6299         (Output_merge_data::do_add_input_section): Record input section if
6300         keeps-input-sections flag is set.
6301         (Output_merge_string::do_add_input_section): Ditto.
6302         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6303         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6304         INPUT_SECTIONS_.
6305         (Output_merge_base::keeps_input_sections,
6306         Output_merge_base::set_keeps_input_sections,
6307         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6308         method definitions.
6309         (Output_merge_base::Input_sections): New type declaration.
6310         (Output_merge_base::input_sections_begin,
6311         Output_merge_base::input_sections_end,
6312         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6313         (Output_merge_base::bool keeps_input_sections_,
6314         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6315         Output_merge_base::input_sections_): New data members.
6316         (Output_merge_data::do_set_keeps_input_sections): New method
6317         defintion.
6318         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6319         * output.cc (Output_section::Input_section::relobj): Move method
6320         defintion from class declaration to here and handle merge sections.
6321         (Output_section::Input_section::shndx): Ditto.
6322         (Output_section::Output_section): Remove initializations of removed
6323         data members and initialize new data member LOOKUP_MAPS_.
6324         (Output_section::add_input_section): Set keeps-input-sections flag
6325         for a newly created merge output section as appropriate.  Adjust code
6326         to use Output_section_lookup_maps class.
6327         (Output_section::add_relaxed_input_section): Adjst code for lookup
6328         maps code refactoring.
6329         (Output_section::add_merge_input_section): Add a new parameter
6330         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6331         class.  If adding input section to a newly created merge output
6332         section fails, remove the new merge section.
6333         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6334         Adjust code for use of the Output_section_lookup_maps class.
6335         (Output_section::find_merge_section): Ditto.
6336         (Output_section::build_lookup_maps): New method defintion.
6337         (Output_section::find_relaxed_input_section): Adjust code to use
6338         Output_section_lookup_maps class.
6339         (Output_section::get_input_sections): Export merge sections.  Adjust
6340         code to use Output_section_lookup_maps class.
6341         (Output_section:::add_script_input_section): Adjust code to use
6342         Output_section_lookup_maps class.  Update lookup maps for merge
6343         sections also.
6344         (Output_section::discard_states): Use Output_section_lookup_maps.
6345         (Output_section::restore_states): Same.
6346         * output.h (Merge_section_properties): Move class defintion out of
6347         Output_section.
6348         (Output_section_lookup_maps): New class.
6349         (Output_section::Input_section::is_merge_section): New method
6350         defintion.
6351         (Output_section::Input_section::relobj): Move defintion out of class
6352         defintion.  Declare method only.
6353         (Output_section::Input_section::shndx): Ditto.
6354         (Output_section::Input_section::output_merge_base): New method defintion.
6355         (Output_section::Input_section::u2_.pomb): New union field.
6356         (Output_section::Merge_section_by_properties_map,
6357         Output_section::Output_section_data_by_input_section_map,
6358         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6359         Remove types.
6360         (Output_section::add_merge_input_section): Add new parameter
6361         KEEPS_INPUT_SECTIONS.
6362         (Output_section::build_lookup_maps): New method declaration.
6363         (Output_section::merge_section_map_,
6364         Output_section::merge_section_by_properties_map_,
6365         Output_section::relaxed_input_section_map_,
6366         Output_section::is_relaxed_input_section_map_valid_): Remove data
6367         members.
6368         (Output_section::lookup_maps_): New data member.
6369
6370 2010-05-21  Doug Kwan  <dougkwan@google.com>
6371
6372         PR gold/11619
6373         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6374         avoid a compilation error.
6375
6376 2010-05-19  Rafael Espindola  <espindola@google.com>
6377
6378         * script-sections.cc (Output_section_definition::allocate_to_segment):
6379         Update the phdrs_list even when the output section is NULL.
6380         * testsuite/Makefile.am: Add test.
6381         * testsuite/Makefile.in: Regenerate.
6382         * testsuite/script_test_9.cc: New.
6383         * testsuite/script_test_9.sh: New.
6384         * testsuite/script_test_9.t: New.
6385
6386 2010-05-19  Doug Kwan  <dougkwan@google.com>
6387
6388         * arm.cc (Arm_input_section::original_size): New method.
6389         (Arm_input_section::do_addralign): Add a cast.
6390         (Arm_input_section::do_output_offset): Remove static cast.
6391         (Arm_input_section::original_addralign,
6392          Arm_input_section::original_size_): Change type to uint32_t.
6393         (Arm_input_section::init): Add safe casts for section alignment
6394         and size.
6395         (Arm_input_section::set_final_data_size): Do not set address and
6396         offset of stub table.
6397         (Arm_output_section::fix_exidx_coverage): Change use of of
6398         Output_section::Simple_input_section to that of
6399         Output_section::Input_section.
6400         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6401         except for the first pass.
6402         * output.cc (Output_section::get_input_sections): Change type of
6403         input_sections to std::list<Input_section>.
6404         (Output_section::add_script_input_section): Rename from
6405         Output_section::add_simple_input_section.  Change type of SIS
6406         parameter from Simple_input_section to Input_section.
6407         * output.h (Output_section::Simple_input_section): Remove class.
6408         (Output_section::Input_section): Change class visibility to public.
6409         (Output_section::Input_section::addralign): Use stored alignments
6410         for special input sections if set.
6411         (Output_section::Input_section::set_addralign): New method.
6412         (Output_section::get_input_sections): Change parameter type from
6413         list of Simple_input_section to list of Input_section.
6414         (Output_section::add_script_input_section): Rename from
6415         Output_section::add_simple_input_section. Change first parameter's
6416         type from Simple_input_section to Input_section and remove the
6417         second and third parameters.
6418         * script-sections.cc (Input_section::Input_section_list): Change
6419         type to list of Output_section::Input_section/
6420         (Input_section_info::Input_section_info): Change parameter type of
6421         INPUT_SECTION to Output_section::Input_section.
6422         (Input_section_info::input_section): Change return type.
6423         (Input_section_info::input_section_): Change type to
6424         Output_section::Input_section.
6425         (Output_section_element_input::set_section_addresses): Adjust code
6426         to use Output_section::Input_section instead of
6427         Output_section::Simple_input_section.  Adjust code for renaming
6428         of Output_section::add_simple_input_section.
6429         (Orphan_output_section::set_section_addresses): Ditto.
6430
6431 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6432
6433         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6434         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6435
6436 2010-05-18  Rafael Espindola  <espindola@google.com>
6437
6438         * options.cc (General_options::finalize): Handle -nostdlib.
6439         * options.h (nostdlib): New option.
6440         * script.cc (script_add_search_dir): Handle -nostdlib.
6441
6442 2010-05-12  Doug Kwan  <dougkwan@google.com>
6443
6444         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6445         attributes section only if there no attributes section after merging.
6446         (Target_arm::merge_object_attributes): Move value of
6447         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6448         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6449         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6450         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6451         and arm_attr_merge_7.stdout.
6452         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6453         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6454         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6455         arm_attr_merge_7b.o): New rules.
6456         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6457         arm_attr_merge_7
6458         * testsuite/Makefile.in: Regenerate.
6459         * testsuite/arm_attr_merge.sh: New file.
6460         * testsuite/arm_attr_merge_[67][ab].s: Same.
6461
6462 2010-05-05  Nick Clifton  <nickc@redhat.com>
6463
6464         * po/es.po: Updated Spanish translation.
6465
6466 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6467
6468         * Makefile.am (install-exec-local): Properly install gold as
6469         default cross linker.
6470         * Makefile.in: Regenerated.
6471
6472 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6473             Nick Clifton  <nickc@redhat.com>
6474
6475         * configure.ac (install_as_default): Define and set to false
6476         unless --enable-gold or --enable-gold=both/gold has been
6477         specified.
6478         * configure: Regenerate.
6479
6480         * Makefile.am (install-exec-local): Install the executable as
6481         'ld.gold'.  If install_as_default is true then also install it as
6482         'ld'.
6483         * Makefile.in: Regenerated.
6484
6485 2010-04-24  Ian Lance Taylor  <iant@google.com>
6486
6487         * layout.cc (Layout::layout_reloc): In relocatable link don't
6488         combine reloc sections for grouped sections.
6489
6490 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6491
6492         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6493         sections that are not ordinary to icf.
6494         * icf.cc (get_section_contents): Handle relocation pointing to section
6495         with no object or shndx information.
6496         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6497         * testsuite/Makefile.in: Regenerate.
6498         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6499         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6500
6501 2010-04-22  Ian Lance Taylor  <iant@google.com>
6502
6503         * expression.cc (Expression::Expression_eval_info): Add
6504         result_alignment_pointer field.
6505         (Expression::eval_with_dot): Add result_alignment_pointer
6506         parameter.  Change all callers.
6507         (Expression::eval_maybe_dot): Likewise.
6508         (class Binary_expression): Add alignment_pointer parameter to
6509         left_value and right_value.  Change all callers.
6510         (BINARY_EXPRESSION): Set result alignment.
6511         (class Trinary_expression): Add alignment_pointer parameter to
6512         arg2_value and arg3_value.  Change all callers.
6513         (Trinary_cond::value): Set result alignment.
6514         (Max_expression::value, Min_expression::value): Likewise.
6515         (Align_expression::value): Likewise.
6516         * script-sections.cc (class Sections_element): Add dot_alignment
6517         parameter to set_section_addresses virtual function.  Update
6518         instantiations.
6519         (class Output_section_element): Likewise.
6520         (Script_sections::create_segments): Add dot_alignment parameter.
6521         Change all callers.
6522         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6523         (Script_sections::set_phdrs_clause_addresses): Likewise.
6524         * script-sections.h: Update declarations.
6525         * script.h: Update declarations.
6526         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6527         min_p_align.
6528         * testsuite/script_test_3.t: Set large alignment.
6529         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6530         segment has expected alignment.
6531
6532 2010-04-22  Nick Clifton  <nickc@redhat.com>
6533
6534         * po/gold.pot: Updated by the Translation project.
6535         * po/vi.po: Updated Vietnamese translation.
6536
6537 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6538
6539         * testsuite/Makefile.am (check_PROGRAMS): Add
6540         icf_virtual_function_folding_test.
6541         * testsuite/Makefile.in: Regenerated.
6542
6543 2010-04-15  Andrew Haley  <aph@redhat.com>
6544
6545         * options.h (merge_exidx_entries): New option.
6546         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6547         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6548         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6549         (Target_arm::merge_exidx_entries): New function.
6550         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6551         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6552         to Arm_exidx_fixup constructor.
6553         Add new arg, merge_exidx_entries.
6554         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6555         Arm_output_section::fix_exidx_coverage.
6556
6557 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6558
6559         * icf.cc (get_section_contents): Check for preemptible functions.
6560         Ignore addend when appropriate.
6561         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6562         section folded.
6563         (add_from_relobj): Check for section folded.
6564         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6565         * symtab.h (should_add_dynsym_entry): Add new parameter.
6566         * target-reloc.h (scan_relocs): Check for section folded.
6567         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6568         Check reloc types for function pointers in shared objects.
6569         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6570         case.
6571         (icf_preemptible_functions_test): New test case.
6572         (icf_string_merge_test): New test case.
6573         * testsuite.Makefile.in: Regenerate.
6574         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6575         bar_glob.  Refactor code.
6576         * testsuite/icf_preemptible_functions_test.cc: New file.
6577         * testsuite/icf_preemptible_functions_test.sh: New file.
6578         * testsuite/icf_string_merge_test.cc: New file.
6579         * testsuite/icf_string_merge_test.sh: New file.
6580         * testsuite/icf_virtual_function_folding_test.cc: New file.
6581         * testsuite/icf_virtual_function_folding_test.sh: New file.
6582
6583 2010-04-14  Doug Kwan  <dougkwan@google.com>
6584
6585         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6586         for local symbol recounting if we remove a section due to ICF.
6587         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6588         there are no regular objects in input.
6589
6590 2010-04-13  Doug Kwan  <dougkwan@google.com>
6591
6592         * arm.cc (Arm_input_section::set_final_data_size): Compute
6593         accurate final data size instead of using current data size.
6594
6595 2010-04-09  Doug Kwan  <dougkwan@google.com>
6596
6597         * layout.cc (Layout::choose_output_section): Handle script section
6598         types.
6599         (Layout::make_output_section_for_script): Add section type parameter.
6600         Handle script section types.
6601         * layout.h (Layout::make_output_section_for_script): Add section
6602         type parameter.
6603         * output.cc (Output_section::Output_section): Initialize data member
6604         is_noload_.
6605         (Output_section::do_reset_address_and_file_offset): Do not set address
6606         to 0 if section is a NOLOAD section.
6607         * output.h (Output_section::is_noload): New method.
6608         (Output_section::set_is_noload): Ditto.
6609         (Output_section::is_noload_): New data member.
6610         * script-c.h (Script_section_type): New enum type.
6611         (struct Parser_output_section_header): Add new file section_type.
6612         * script-sections.cc (Sections_element::output_section_name): Add
6613         parameter for returning script section type.
6614         (Output_section_definition::output_section_name): Ditto.
6615         (Output_section_definition::section_type)P; New method.
6616         (Output_section_definiton::script_section_type_name): Ditto.
6617         (Output_section_definition::script_section_type_): New data member.
6618         (Output_section_definition::Output_section_definition): Initialize
6619         data member Output_section_definition::script_section_type_.
6620         (Output_section_definition::create_sections): Pass script section type
6621         to Layout::make_output_section_for_script.
6622         (Output_section_definition::output_section_name): Return script
6623         section type to caller.
6624         (Output_section_definition::set_section_address): Do not advance
6625         dot value and load address if section type is NOLOAD.  Set address
6626         of NOLOAD sections regardless of section flags.
6627         (Output_section_definition::print): Print section type if it is
6628         not SCRIPT_SECTION_TYPE_NONE.
6629         (Output_section_definition::section_type): New method.
6630         (Output_section_definition::script_section_type_name): Ditto.
6631         (Script_sections::output_section_name): Add new parameter
6632         PSECTION_TYPE for returning script section type.  Pass it to
6633         section elements.  Handle discard sections.
6634         (Sort_output_sections::operator()): Handle NOLOAD sections.
6635         * script-sections.h (Script_sections::Section_type): New enum type.
6636         (Script_sections::output_section_name): Add a new parameter for
6637         returning script section type.
6638         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6639         INFO and NOLOAD.
6640         * yyscript.y (union): Add new field SECTION_TYPE.
6641         (COPY, DSECT, INFO, NOLOAD): New tokens.
6642         (opt_address_and_section_type): Change type to output_section_header.
6643         (section_type): New non-terminal
6644         (section_header): Handle section type.
6645         (opt_address_and_section_type): Return section type value.
6646
6647 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6648
6649         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6650         * testsuite/plugin_common_test_2.c (foo): Likewise.
6651
6652 2010-04-08  Doug Kwan  <dougkwan@google.com>
6653
6654         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6655         Output_merge_data.
6656         * output.cc (Output_section::add_merge_input_section): Simplify
6657         code and return status of Output_merge_base::add_input_section.
6658         Update merge section map only if Output_merge_base::add_input_section
6659         returns true.
6660
6661 2010-04-07  Doug Kwan  <dougkwan@google.com>
6662
6663         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6664         if section is marked as containing instructions but has no mapping
6665         symbols.
6666         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6667         correct section index.
6668         (Arm_relobj::find_linked_text_section): Ditto.
6669
6670 2010-04-07  Cary Coutant  <ccoutant@google.com>
6671
6672         * archive.cc (include_member): Destroy Read_symbols_data object before
6673         releasing file.
6674         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6675         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6676         (Read_symbols_data::~Read_symbols_data) New destructor.
6677         (Section_relocs::Section_relocs) New constructor.
6678         (Section_relocs::~Section_relocs) New destructor.
6679         (Read_relocs_data::Read_relocs_data) New constructor.
6680         (Read_relocs_data::~Read_relocs_data) New destructor.
6681         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6682         pointers to NULL after deleting.
6683
6684 2010-04-07  Doug Kwan  <dougkwan@google.com>
6685
6686         * arm.cc: Replace "endianity" with "endianness" in comments.
6687         (Arm_exidx_cantunwind): Ditto.
6688         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6689         (Arm_relobj::merge_flags_and_attributes): New method.
6690         (Arm_relobj::merge_flags_and_attributes_): New data member.
6691         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6692         (Arm_relobj::scan_sections_for_stubs): Ditto.
6693         (Arm_relobj::do_read_symbols): Check to see if we really want to
6694         merge processor-specific flags and attributes.  Exit early if
6695         an object is empty except for section names and the undefined symbol.
6696         (Target_arm::do_finalize_sections): Move check for ELF format to
6697         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6698         attributes from a regular object only when we have determined that
6699         it is aapropriate.  Do not create an .ARM.attributes section in
6700         output if there is no regular input object.
6701         (Target_arm::merge_processor_specific_flags): Check
6702         --warn-mismatch before printing any error.
6703         (Target_arm::merge_object_attributes): Ditto.
6704         * gold.cc (queue_middle_tasks): Handle the case in which there is
6705         no regular object in input.
6706         * options.cc (General_options::parse_EB): New method.
6707         (General_options::parse_EL): Same.
6708         (General_options::General_options): Initialize endianness_.
6709         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6710         New options.
6711         (General_options::Endianness): New enum.
6712         (General_options::endianness): New method.
6713         (General_options::endianness_): New data member.
6714         * parameters.cc (Parameters::set_options): Check target endianness.
6715         (Parameters::set_target_once): Ditto.
6716         (Parameters::check_target_endianness): New method.
6717         (parameters_force_valid_target): If either -EL or -EB is specified,
6718         use it to define endianness of default target.
6719         * parameters.h (Parameters::check_target_endianness): New method
6720         declaration.
6721         * target.h (class Target): Change "endianity" to "endianness"
6722         in comments.
6723
6724 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6725
6726         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6727         * configure: Regenerate.
6728         * Makefile.in: Regenerate.
6729         * testsuite/Makefile.in: Regenerate.
6730
6731 2010-04-06  Cary Coutant  <ccoutant@google.com>
6732
6733         gcc PR lto/42757
6734         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6735         prevailing definitions of common symbols.
6736         * testsuite/plugin_test_6.sh: New test case.
6737         * testsuite/plugin_common_test_1.c: New test case.
6738         * testsuite/plugin_common_test_2.c: New test case.
6739         * testsuite/Makefile.am (plugin_test_6): New test case.
6740         * testsuite/Makefile.in: Regenerate.
6741
6742 2010-04-06  Nick Clifton  <nickc@redhat.com>
6743
6744         * po/vi.po: New Vietnamese translation.
6745
6746 2010-03-30  Doug Kwan  <dougkwan@google.com>
6747
6748         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6749
6750 2010-03-25  Doug Kwan  <dougkwan@google.com>
6751
6752         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6753         to avoid a conversion warning on a 32-bit host.
6754
6755 2010-03-24  Ian Lance Taylor  <iant@google.com>
6756
6757         * testsuite/script_test_3.t: Add a TLS segment.
6758         * testsuite/Makefile.am (check_PROGRAMS): Add
6759         tls_phdrs_script_test.
6760         (tls_phdrs_script_test_SOURCES): Define.
6761         (tls_phdrs_script_test_DEPENDENCIES): Define.
6762         (tls_phdrs_script_test_LDFLAGS): Define.
6763         (tls_phdrs_script_test_LDADD): Define.
6764         * testsuite/Makefile.in: Rebuild.
6765
6766 2010-03-23  Cary Coutant  <ccoutant@google.com>
6767
6768         * fileread.cc (find_or_make_view): Fix comment.
6769
6770 2010-03-23  Ian Lance Taylor  <iant@google.com>
6771
6772         * script-sections.cc (class Orphan_section_placement): Define
6773         PLACE_TLS and PLACE_TLS_BSS.
6774         (Orphan_section_placement::Orphan_section_placement): Initialize
6775         new places.
6776         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6777         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6778         (tls_script_test_SOURCES): Define.
6779         (tls_script_test_DEPENDENCIES): Define.
6780         (tls_script_test_LDFLAGS): Define.
6781         (tls_script_test_LDADD): Define.
6782         * testsuite/Makefile.in: Rebuild.
6783
6784 2010-03-22  Doug Kwan  <dougkwan@google.com>
6785
6786         * arm.cc (Arm_relocate_functions::abs8,
6787         Arm_relocate_functions::abs16): Use correct check for overflow
6788         specified in the ARM ELF specs.
6789         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6790         target of a BLX instruction specially.
6791         (Reloc_stub::stub_type_for_reloc): Ditto.
6792         (Relocate::relocate): Use symbolic names instead of numeric relocation
6793         codes to report error.
6794         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6795         workaround.
6796         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6797         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6798         thumb2_blx_out_of_range.stdout
6799         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6800         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6801         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6802         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6803         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6804         thumb2_blx_in_range, thumb2_blx_in_range.o,
6805         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6806         thumb2_blx_out_of_range.o): New rules.
6807         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6808         thumb2_blx_in_range and thumb2_blx_out_of_range.
6809         * testsuite/Makefile.in: Regenerate.
6810         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6811         * testsuite/thumb_blx_in_range.s: New file.
6812         * testsuite/thumb_blx_out_of_range.s: New file.
6813
6814 2010-03-22  Rafael Espindola  <espindola@google.com>
6815
6816         * archive.cc (Should_include): Move to archive.h.
6817         (should_include_member): Make it a member of Archive.
6818         (Lib_group): New.
6819         (Add_lib_group_symbols): New.
6820         * archive.h: Include options.h.
6821         (Archive_member): Moved from Archive.
6822         (Should_include): Moved from archive.cc.
6823         (Lib_group): New.
6824         (Add_lib_group_symbols): New.
6825         * dynobj.cc (do_should_include_member): New.
6826         * dynobj.h (do_should_include_member): New.
6827         * gold.cc (queue_initial_tasks): Update call to queue.
6828         * main.cc (main): Print lib group stats.
6829         * object.cc (do_should_include_member): New.
6830         * object.h: Include archive.h.
6831         (Object::should_include_member): New.
6832         (Object::do_should_include_member): New.
6833         (Sized_relobj::do_should_include_member): New.
6834         * options.cc (General_options::parse_start_lib): New.
6835         (General_options::parse_end_lib): New.
6836         (Input_arguments::add_file): Handle lib groups.
6837         (Input_arguments::start_group): Check we are not in a lib.
6838         (Input_arguments::start_lib): New.
6839         (Input_arguments::end_lib): New.
6840         * options.h (General_options): Add start_lib and end_lib.
6841         (Input_argument::lib_): New.
6842         (Input_argument::lib): New.
6843         (Input_argument::is_lib): New.
6844         (Input_file_lib): New.
6845         (Input_arguments::in_lib_): New.
6846         (Input_arguments::in_lib): New.
6847         (Input_arguments::start_lib): New.
6848         (Input_arguments::end_lib_): New.
6849         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6850         in unused members as preempted.
6851         (Sized_pluginobj::do_should_include_member): New.
6852         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6853         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6854         return the blocker.
6855         (Read_symbols::do_whole_lib_group): New.
6856         (Read_symbols::do_lib_group): New.
6857         (Read_symbols::do_read_symbols): Handle lib groups.
6858         (Read_symbols::get_name): Handle lib groups.
6859         * readsyms.h (Read_symbols): Add an archive member pointer.
6860         (Read_symbols::do_whole_lib_group): New.
6861         (Read_symbols::do_lib_group): New.
6862         (Read_symbols::member_): New.
6863         * script.cc (read_input_script): Update call to queue_soon.
6864
6865 2010-03-19  Doug Kwan  <dougkwan@google.com>
6866
6867         * arm.cc (Stub_table::Stub_table): Initialize new data members
6868         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6869         (Stub_table::add_reloc_stub): Assign stub offset and update
6870         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6871         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6872         New data members.
6873         (Stub_table::update_data_size_and_addralign): Use
6874         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6875         instead of going over all reloc stubs.
6876         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6877         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6878         Stringpool_template::offset_ to size of Stringpool_char.
6879         (Stringpool_template::new_key_offset): Remove code to initialize
6880         Stringpool_template::offset_.
6881         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6882         Stringpool_template::offset_ to zero.
6883
6884 2010-03-15  Doug Kwan  <dougkwan@google.com>
6885
6886         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6887         offset_.
6888         (Stringpool_template::new_key_offset): New method.
6889         (Stringpool_template::add_string): Assign offsets when adding new
6890         strings.
6891         (Stringpool_template::set_string_offsets): Do not set string offsets
6892         when not optimizing.
6893         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6894         member size_.
6895         (Chunked_vector::clear): Clear size_.
6896         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6897         (Chunked_vector::size): Return size_.
6898         (Chunked_vector::push_back): Use size_ to find insert position.
6899         (Chunked_vector::size_): New data member.
6900         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6901         (Stringpool_template::new_key_offset): New method declaration.
6902         (Stringpool_template::offset_): New data member.
6903
6904 2010-03-15   Rafael Espindola  <espindola@google.com>
6905
6906         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6907         Add_symbols' constructor.
6908         * readsyms.h (Add_symbols): Remove the input_group member.
6909
6910 2010-03-10  Ian Lance Taylor  <iant@google.com>
6911
6912         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6913         target to ask whether a reference to a symbol requires a stack
6914         split.
6915         * target.h (Target::is_call_to_non_split): New function.
6916         (Target::do_is_call_to_non_split): Declare virtual function.
6917         * target.cc: Include "symtab.h".
6918         (Target::do_is_call_to_non_split): New function.
6919         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
6920
6921 2010-03-10  Cary Coutant  <ccoutant@google.com>
6922
6923         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
6924         (File_read::open[1]): Remove initial mapping of whole_file_view_.
6925         (File_read::open[2]): Add whole_file_view_ to list of views.
6926         (File_read::make_view): Remove test of whole_file_view_.
6927         (File_read::find_or_make_view): Create whole_file_view_ if
6928         necessary.
6929         (File_read::clear_views): Replace bool parameter with enum;
6930         adjust all callers.  Don't delete views with permanent data;
6931         do delete cached views and views from archives if
6932         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
6933         if clearing the corresponding view.
6934         * fileread.h (File_read::Clear_views_mode): New enum.
6935         (File_read::View::is_permanent_view): New method.
6936         (File_read::clear_views): Replace bool parameter
6937         with enum; adjust all callers.
6938         * options.h (General_options): Change keep_files_mapped option;
6939         add map_whole_files.
6940         * readsyms.cc (Add_symbols::run): Delete sd_ object before
6941         releasing the file.
6942         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
6943         the file.
6944
6945 2010-03-10  David S. Miller  <davem@davemloft.net>
6946
6947         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
6948
6949 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
6950
6951         * icf.cc (get_section_contents): Add '@' marker after processing the
6952         merge reloc.
6953
6954 2010-03-08  Doug Kwan  <dougkwan@google.com>
6955
6956         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
6957         due to a conversion warning.
6958         (Arm_relobj::update_output_local_symbol_count): Check for local
6959         symbol with unset output index.
6960
6961 2010-03-05  Ian Lance Taylor  <iant@google.com>
6962
6963         * options.h (class General_options): Add --spare-dynamic-tags.
6964         * output.cc (Output_data_dynamic::set_final_data_size): Implement
6965         --spare-dynamic-tags.
6966
6967 2010-03-05  Ian Lance Taylor  <iant@google.com>
6968
6969         * incremental.cc: Include "libiberty.h".
6970
6971 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
6972
6973         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
6974         function, is_info_ member.
6975         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
6976         (Versions::Versions): Update caller.
6977         (Versions::define_base_version): Likewise.
6978         (Versions::add_def): Likewise.
6979
6980 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
6981
6982         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
6983         (Scan::possible_function_pointer_reloc): New function.
6984         (Scan::local_reloc_may_be_function_pointer): Change to call
6985         possible_function_pointer_reloc.
6986         (Scan::global_reloc_may_be_function_pointer): Ditto.
6987         * icf.h (Icf::check_section_for_function_pointers): Change to reject
6988         relocations in ".data.rel.ro._ZTV" section.
6989         * testsuite/icf_safe_so_test.sh: Change to pass i386.
6990         * testsuite/icf_safe_so_test.cc: Ditto.
6991         * testsuite/icf_safe_test.cc: Ditto.
6992         * testsuite/icf_safe_test.sh: Ditto.
6993
6994 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6995             Ian Lance Taylor  <iant@google.com>
6996
6997         * target-reloc.h (relocate_section): Check the symbol table index
6998         for -1U before setting the local symbol index.
6999         (scan_relocatable_relocs): If copying the relocation, record that
7000         the local symbol is required.
7001         * object.h (Symbol_value::is_output_symtab_index_set): New
7002         function.
7003         (Symbol_value::may_be_discarded_from_output_symtab): New
7004         function.
7005         (Symbol_value::has_output_symtab_entry): New function.
7006         (Symbol_value::needs_output_symtab_entry): Remove.
7007         (Symbol_value::output_symtab_index): Make sure the symbol index is
7008         set.
7009         (Symbol_value::set_output_symtab_index): Make sure the symbol
7010         index is not set.  Make sure the new index is valid.
7011         (Symbol_value::set_must_have_output_symtab_entry): New function.
7012         (Symbol_value::has_output_dynsym_entry): New function.
7013         (Symbol_value::set_output_dynsym_index): Make sure the new index
7014         is valid.
7015         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7016         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7017         local symbol if permitted.
7018         (Sized_relobj::do_finalize_local_symbols): Call
7019         is_output_symtab_index_set rather than needs_output_symtab_entry.
7020         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7021         rather than needs_output_symtab_entry.  Call
7022         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7023         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7024         is_output_symtab_index_set rather than needs_output_symtab_entry.
7025         * testsuite/discard_locals_relocatable_test.c: New file.
7026         * testsuite/discard_locals_test.sh: Test -r.
7027         * testsuite/Makefile.am (check_DATA): Add
7028         discard_locals_relocatable_test1.syms,
7029         discard_local_relocatable_test2.syms.
7030         (MOSTLYCLEANFILES): Likewise.  Also add
7031         discard_locals_relocatable_test1.lout and
7032         discard_locals_relocatable_test2.out.
7033         (discard_locals_relocatable_test1.syms): New target.
7034         (discard_locals_relocatable_test.o): New target.
7035         (discard_locals_relocatable_test1.out): New target.
7036         (discard_locals_relocatable_test2.syms): New target.
7037         (discard_locals_relocatable_test2.out): New target.
7038         (various): Add missing ../ld-new dependencies.
7039         * testsuite/Makefile.in: Rebuild.
7040
7041 2010-03-03  Nick Clifton  <nickc@redhat.com>
7042
7043         * po/fi.po: New Finnish translation.
7044
7045 2010-03-01  Doug Kwan  <dougkwan@google.com>
7046
7047         * layout.cc (Layout::Layout): Force section types of .init_array*,
7048         .preinit_array* and .fini_array* sections.
7049         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7050         Fix check of return value of std::string::find.().
7051         (Output_section::Input_section_sort_compare::operator()): Remove
7052         comment about .init_array.
7053         (Output_section::Input_section_sort_init_fini_compare::operator()):
7054         New method.
7055         (Output_section::sort_attached_input_sections): Handle .init_array
7056         and .fini_array specially.
7057         * output.h (Output_section::Inut_section_sort_compare): Update
7058         comment.
7059         (Output_section::Input_section_sort_init_fini_compare): New struct.
7060
7061 2010-02-26  Doug Kwan  <dougkwan@google.com>
7062
7063         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7064         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7065         * testsuite/debug_msg.sh: Avoid matching source line number for
7066         use of global variable undef_int.
7067
7068 2010-02-26  Doug Kwan  <dougkwan@google.com>
7069
7070         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7071         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7072         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7073         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7074         * options.cc (General_options::General_options): Initialize member
7075         fix_v4bx_.
7076         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7077         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7078         and rm_no_fix_v4bx.stdout
7079         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7080         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7081         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7082         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7083         and arm_no_fix_v4bx.
7084         * Makefile.in: Regenerate.
7085         * testsuite/arm_fix_v4bx.s: New file.
7086         * testsuite/arm_fix_v4bx.sh: Ditto.
7087
7088 2010-02-24  Doug Kwan  <dougkwan@google.com>
7089
7090         * arm.cc (Target_arm::got_section): Make the .got section the first
7091         non RELRO section in the data segment.
7092         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7093         suffixes of section names.
7094
7095 2010-02-24  Doug Kwan  <dougkwan@google.com>
7096
7097         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7098         flags and attributes merging if an input file is a binary file.
7099         * fileread.cc (Input_file::open): Record format of original file.
7100         * fileread.h (Input_file::Format): New enum type.
7101         (Input_file::Input_file): Initialize data member format_.
7102         (Input_file::format): New method definition.
7103         (Input_file::format_):: New data member.
7104
7105 2010-02-24  Doug Kwan  <dougkwan@google.com>
7106
7107         * arm.cc (Arm_output_data_got): New class.
7108         (ARM_TCB_SIZE): New constant
7109         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7110         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7111         If user uses a script with a SECTIONS clause, issue only a warning
7112         for a misplaced EXIDX input section.  Otherwise, issue an error.
7113         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7114         garbage collection.
7115         (Target_arm::got_mode_index_entry): Handle static linking.
7116         (Target_arm::Scan::local): Ditto.
7117         (Target_arm::Scan::global): Ditto.
7118         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7119         all incorrectly implemented relocations.
7120         (Target_arm::fix_exidx_coverage): Pass layout to
7121         Arm_output_section::fix_exidx_coverage.
7122         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7123         from ".ARM.exidx." and ".ARM.extab.".
7124
7125 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7126
7127         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7128         section if it does not already exist.
7129         * attributes.cc (Attributes_section_data::Attributes_section_data):
7130         Don't crash if size is zero.
7131
7132 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7133             Ian Lance Taylor  <iant@google.com>
7134
7135         * gold.cc (queue_middle_tasks): If no input files were opened,
7136         exit.
7137         * workqueue.h (Task_function::Task_function): Assert that there is
7138         a blocker.
7139
7140 2010-02-22  Doug Kwan  <dougkwan@google.com>
7141
7142         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7143         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7144         types to avoid warnings due to different uint64_t implementations
7145         on different hosts.
7146
7147 2010-02-21  Doug Kwan  <dougkwan@google.com>
7148
7149         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7150         handling of the maximum backward branch offset.
7151         (Arm_relocate_functions::thumb_branch_common): Ditto.
7152         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7153         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7154         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7155         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7156         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7157         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7158         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7159         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7160         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7161         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7162         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7163         thumb2_bl_out_of_range.o): New rules.
7164         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7165         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7166         thumb2_bl_out_of_range
7167         * testsuite/Makefile.in: Regenerate.
7168         * testsuite/arm_bl_in_range.s: New file.
7169         * testsuite/arm_bl_out_of_range.s: Ditto.
7170         * testsuite/arm_branch_in_range.sh: Ditto.
7171         * testsuite/arm_branch_range.t: Ditto.
7172         * testsuite/thumb2_branch_range.t: Ditto.
7173         * testsuite/thumb_bl_in_range.s: Ditto.
7174         * testsuite/thumb_bl_out_of_range.s: Ditto.
7175         * testsuite/thumb_branch_range.t: Ditto.
7176
7177 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7178
7179         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7180         Add reloc offset information.
7181         * icf.cc (get_section_contents): Change iterators to point to the new
7182         vectors. Add reloc offset information to the contents.
7183         * icf.h (Icf::Sections_reachable_info): New typedef.
7184         (Icf::Sections_reachable_list): New typedef.
7185         (Icf::Offset_info): New typedef.
7186         (Icf::Reloc_info): New struct typedef.
7187         (Icf::Reloc_info_list): New typedef.
7188         (Icf::symbol_reloc_list): Delete method.
7189         (Icf::addend_reloc_list): Delete method.
7190         (Icf::section_reloc_list): Delete method.
7191         (Icf::reloc_info_list): New method.
7192         (Icf::reloc_info_list_): New member.
7193
7194 2010-02-19  Doug Kwan  <dougkwan@google.com>
7195
7196         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7197         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7198         * arm.cc (Arm_relocation_functions): New forward declaration.
7199         (Target_arm::Target_arm): Initialize new data members
7200         got_mod_index_offset_ and tls_base_symbol_defined_.
7201         (Target_arm::Relocate::relocate_tls): New method.
7202         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7203          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7204         New methods.
7205         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7206         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7207         (Target_arm::got_mod_index_offset_,
7208         Target_arm::tls_base_symbol_defined_): New data members.
7209         (Target_arm::Scan::local, Target::Scan::global,
7210         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7211         relocations.
7212
7213 2010-02-18  Doug Kwan  <dougkwan@google.com>
7214
7215         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7216         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7217         text section as a parameter becuase some broken tools may not set
7218         the link in section header.
7219         (Target_arm::has_got_section): New method.
7220         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7221         without any mapping symbol as data only.  Remove warning.
7222         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7223         link in its section header, try to discover the link by inspecting the
7224         REL31 relocation at the beginning of the section.
7225         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7226         in error message.
7227         (Target_arm::Scan::global): Treat any reference to the symbol
7228         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7229
7230 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7231
7232         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7233         (Scan::global_reloc_may_be_function_pointer): New function.
7234         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7235         (Scan::global_reloc_may_be_function_pointer): New function.
7236         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7237         (Scan::global_reloc_may_be_function_pointer): New function.
7238         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7239         (Scan::global_reloc_may_be_function_pointer): New function.
7240         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7241         (Scan::global_reloc_may_be_function_pointer): New function.
7242         (Scan::possible_function_pointer_reloc): New function.
7243         (Target_x86_64::can_check_for_function_pointers): New function.
7244         * gc.h (gc_process_relocs): Scan relocation types to determine if
7245         function pointers were taken for targets that support it.
7246         * icf.cc (Icf::find_identical_sections): Include functions for
7247         folding in safe ICF whose pointer is not taken.
7248         * icf.h (Secn_fptr_taken_set): New typedef.
7249         (fptr_section_id_): New member.
7250         (section_has_function_pointers): New function.
7251         (set_section_has_function_pointers): New function.
7252         (check_section_for_function_pointers): New function.
7253         * options.h: Fix comment for safe ICF option.
7254         * target.h (can_check_for_function_pointers): New function.
7255         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7256         Modify icf_safe_test for X86-64.
7257         * testsuite/Makefile.in: Regenerate.
7258         * testsuite/icf_safe_so_test.cc: New file.
7259         * testsuite/icf_safe_so_test.sh: New file.
7260         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7261         (main): Change to take pointer to function kept_func_3.
7262         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7263         folding is done correctly for X86-64.
7264
7265 2010-02-12  David S. Miller  <davem@davemloft.net>
7266
7267         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7268         is_symbolless parameter.
7269         (Output_reloc<SHT_REL>::is_symbolless): New.
7270         (Output_reloc<SHT_REL>::is_symbolless_): New.
7271         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7272         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7273         (Output_reloc<SHT_RELA>::is_symbolless): New.
7274         (Output_data_reloc::add_global): Handle is_symbolless.
7275         (Output_data_reloc::add_global_relative): Likewise.
7276         (Output_data_reloc::add_local): Likewise.
7277         (Output_data_reloc::add_local_relative): Likewise.
7278         (Output_data_reloc::add_symbolless_global_addend): New.
7279         (Output_data_reloc::add_symbolless_local_addend): New.
7280         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7281         is_symbolless.
7282         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7283         instead of ->is_relative_
7284         (Output_reloc::write): Likewise.
7285         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7286         (Output_reloc::write_rel): Simplify.
7287
7288         * sparc.cc (Target_sparc::Scan::local): Use
7289         ->add_symbolless_local_addend as needed.
7290         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7291         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7292         based upon relocation offset.
7293
7294 2010-02-11  Doug Kwan  <dougkwan@google.com>
7295
7296         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7297         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7298         beginning of function.
7299         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7300         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7301         parameter is_32bit in calls to should_apply_static_reloc.
7302         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7303         (check_DATA): Add arm_abs_global.stdout.
7304         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7305         arm_abs_global.stdout): New rules.
7306         (MOSTLLYCLEANFILES): Add arm_abs_global
7307         * Makefile.in: Regenerate.
7308         * testsuite/arm_abs_global.s: New file.
7309         * testsuite/arm_abs_global.sh: Ditto.
7310         * testsuite/arm_abs_lib.s: Ditto.
7311
7312 2010-02-11  Ian Lance Taylor  <iant@google.com>
7313
7314         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7315         Read_relocs task.
7316         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7317         Allocate_commons_task first.
7318         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7319         task, rather than symtab_lock_.
7320         (Gc_process_relocs::~Gc_process_relocs): New function.
7321         (Gc_process_relocs::is_runnable): Check this_blocker_.
7322         (Gc_process_relocs::locks): Use next_blocker_ rather than
7323         blocker_.
7324         (Scan_relocs::~Scan_relocs): New function.
7325         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7326         symtab_lock_.
7327         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7328         next_blocker_.
7329         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7330         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7331         constructor accordingly.
7332         (class Gc_process_relocs): Likewise.
7333         (class Scan_relocs): Likewise.
7334         * common.h (class Allocate_commons_task): Remove symtab_lock_
7335         field, and corresponding constructor parameter.
7336         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7337         symtab_lock_.
7338         (Allocate_commons_task::locks): Likewise.
7339
7340 2010-02-11  Ian Lance Taylor  <iant@google.com>
7341
7342         * gold-threads.h (class Once): Define.
7343         (class Initialize_lock): Rewrite as child of Once.
7344         * gold-threads.cc (class Once_initialize): Define.
7345         (once_pointer_control): New static variable.
7346         (once_pointer, once_arg): New static variables.
7347         (c_run_once): New static function.
7348         (Once::Once, Once::run_once, Once::internal_run): New functions.
7349         (class Initialize_lock_once): Remove.
7350         (initialize_lock_control): Remove.
7351         (initialize_lock_pointer): Remove.
7352         (initialize_lock_once): Remove.
7353         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7354         (Initialize_lock::initialize): Rewrite.
7355         (Initialize_lock::do_run_once): New function.
7356         * archive.cc (Archive::interpret_header): Only clear name if it is
7357         not already empty.
7358         * fileread.cc: Include "gold-threads.h"
7359         (file_counts_lock): New static variable.
7360         (file_counts_initialize_lock): Likewise.
7361         (File_read::release): Only increment counts when using --stats.
7362         Use a lock around the increment.
7363         * parameters.cc (class Set_parameters_target_once): Define.
7364         (set_parameters_target_once): New static variable.
7365         (Parameters::Parameters): Move here from parameters.h.
7366         (Parameters::set_target): Rewrite.
7367         (Parameters::set_target_once): New function.
7368         (Parameters::clear_target): Move here and rewrite.
7369         * parameters.h (class Parameters): Update declarations.  Add
7370         set_parameters_target_once_ field.
7371         (Parameters::Parameters): Move to parameters.cc.
7372         (Parameters::clear_target): Likewise.
7373         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7374         task.
7375         (Start_group::~Start_group): New function.
7376         (Start_group::is_runnable): New function.
7377         (Start_group::locks, Start_group::run): New functions.
7378         (Finish_group::run): Change saw_undefined to size_t.
7379         * readsyms.h (class Start_group): Define.
7380         (class Finish_group): Change saw_undefined_ field to size_t.
7381         (Finish_group::Finish_group): Remove saw_undefined and
7382         this_blocker parameters.  Change all callers.
7383         (Finish_group::set_saw_undefined): New function.
7384         (Finish_group::set_blocker): New function.
7385         * symtab.h (class Symbol_table): Change saw_undefined to return
7386         size_t.  Change saw_undefined_ field to size_t.
7387         * target-select.cc (Set_target_once::do_run_once): New function.
7388         (Target_selector::Target_selector): Initialize set_target_once_
7389         field.  Don't initialize lock_ and initialize_lock_ fields.
7390         (Target_selector::instantiate_target): Rewrite.
7391         (Target_selector::set_target): New function.
7392         * target-select.h (class Set_target_once): Define.
7393         (class Target_selector): Update declarations.  Make
7394         Set_target_once a friend.  Remove lock_ and initialize_lock_
7395         fields.  Add set_target_once_ field.
7396
7397 2010-02-10  Ian Lance Taylor  <iant@google.com>
7398
7399         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7400         queueing any tasks.
7401         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7402         (queue_middle_tasks): Add all blockers before queueing any tasks.
7403         (queue_final_tasks): Likewise.
7404         * token.h (Task_token::add_blockers): New function.
7405         * object.h (Input_objects::number_of_relobjs): New function.
7406
7407 2010-02-10  Ian Lance Taylor  <iant@google.com>
7408
7409         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7410         shared, not if not position independent.
7411         * x86_64.cc (Relocate::relocate_tls): Likewise.
7412         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7413         (tls_pie_pic_test): New target.
7414         * testsuite/Makefile.in: Rebuild.
7415
7416         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7417         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7418         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7419         * testsuite/Makefile.in: Rebuild.
7420
7421 2010-02-09  David S. Miller  <davem@davemloft.net>
7422
7423         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7424         R_SPARC_RELATIVE using ->add_local_relative().
7425         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7426
7427         * output.h (Output_data_dynamic::add_section_size): New method
7428         that takes two Output_data objects.
7429         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7430         entry param.  Handle it in initializers.
7431         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7432         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7433         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7434         arg.
7435         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7436         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7437         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7438         for dynrel_includes_plt.
7439         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7440         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7441         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7442         before .rela.plt
7443         (Target_sparc::do_finalize_sections): Update to pass true for
7444         dynrel_includes_plt.
7445         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7446         output before .rela.plt
7447         (Target_powerpc::do_finalize_sections): Update to pass true for
7448         dynrel_includes_plt when 32-bit.
7449
7450 2010-02-08  Doug Kwan  <dougkwan@google.com>
7451
7452         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7453         method.
7454         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7455         Arm_relobj::scan_section_for_cortex_a8_stubs,
7456         Arm_relobj::do_relocation_section): Instead of calling
7457         Output_section::output_address, use faster
7458         Arm_relobj::simple_input_section_output_address.
7459
7460 2010-02-08  David S. Miller  <davem@davemloft.net>
7461
7462         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7463         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7464         relocation helper function.
7465
7466         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7467         just like R_SPARC_GOT{10,13,22}.
7468         (Target_sparc::Scan::local): Likewise.
7469         (Target_sparc::Relocate:relocate): Likewise.
7470
7471 2010-02-06  Ian Lance Taylor  <iant@google.com>
7472
7473         * configure.ac: Rewrite targetobjs duplicate removal code to use
7474         only shell constructs.
7475         * configure: Rebuild.
7476
7477 2010-02-05  Doug Kwan  <dougkwan@google.com>
7478
7479         PR 11247
7480         * arm.cc (Arm_relobj::section_is_scannable): New method.
7481         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7482         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7483
7484 2010-02-04  Doug Kwan  <dougkwan@google.com>
7485
7486         PR 11247
7487         * arm-reloc-property.cc (cstdio): Include.
7488         * configure.ac (targetobjs): Remove duplicates.
7489         * configure: Regenerate.
7490         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7491         big and little endian version for a given address size.
7492
7493 2010-02-03  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm-reloc-property.cc
7496         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7497         definition.
7498         * arm-reloc-property.h
7499         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7500         New method definition.
7501         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7502         declaration.
7503         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7504         overflow to N.
7505         (GOT_PREL): Change implemented to Y.
7506         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7507         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7508         (Arm_relocate_functions::movw_abs_nc): Remove method.
7509         (Arm_relocate_functions::movt_abs): Ditto.
7510         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7511         (Arm_relocate_functions::thm_movt_abs): Ditto.
7512         (Arm_relocate_functions::movw_rel_nc): Ditto.
7513         (Arm_relocate_functions::movw_rel): Ditto.
7514         (Arm_relocate_functions::movt_rel): Ditto.
7515         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7516         (Arm_relocate_functions:thm_movw_rel): Ditto.
7517         (Arm_relocate_functions:thm_movt_rel): Ditto.
7518         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7519         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7520         New method definitions.
7521         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7522         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7523         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7524         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7525         (Target_arm::Relocate::relocate): Check for non-static or
7526         unimplemented relocation code and exit early.  Change calls to
7527         Target_arm::reloc_uses_thumb_bit and
7528         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7529         instead.  Refactor code to handle similar relocations to increase
7530         code sharing.  Remove check for unsupported relocation code in switch
7531         statement.
7532         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7533         relocation property table to find out size.  Change error message to
7534         print out the name of a relocation code instead of the numeric value.
7535         (Target_arm::scan_reloc_for_stub): Use relocation property table
7536         instead of calling Target_arm::reloc_uses_thumb_bit().
7537
7538 2010-02-02  Doug Kwan  <dougkwan@google.com>
7539
7540         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7541         types of relaxed input section.
7542
7543 2010-02-02  Doug Kwan  <dougkwan@google.com>
7544
7545         * Makefile.am (HFILES): Add arm-reloc-property.h.
7546         (DEFFILES): New.
7547         (TARGETSOURCES): Add arm-reloc-property.cc
7548         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7549         (libgold_a_SOURCES): $(DEFFILES)
7550         * Makefile.in: Regenerate.
7551         * arm-reloc-property.cc: New file.
7552         * arm-reloc-property.h: New file.
7553         * arm-reloc.def: New file.
7554         * arm.cc: Update comments.
7555         (arm-reloc-property.h): New included header.
7556         (arm_reloc_property_table): New global variable.
7557         (Target_arm::do_select_as_default_target): New method definition.
7558         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7559         arm-reloc-property to targ_extra_obj.
7560         * parameters.cc (set_parameters_target): Call
7561         Target::select_as_default_target().
7562         * target.h (Target::select_as_default_target): New method definition.
7563         (Target::do_select_as_default_target): Same.
7564
7565 2010-02-01  Doug Kwan  <dougkwan@google.com>
7566
7567         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7568         first_output_text_section_.
7569         (Arm_exidx_fixup::first_output_text_section): New method definition.
7570         (Arm_exidx_fixup::first_output_text_section_): New data member.
7571         (Arm_exidx_fixup::process_exidx_section): Record the first text
7572         output section seen.
7573         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7574         and entsize in output section header.
7575
7576 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7577
7578         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7579         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7580         (Arm_relocate_functions::thm_alu11): New Method.
7581         (Arm_relocate_functions::thm_pc8): New Method.
7582         (Arm_relocate_functions::thm_pc12): New Method.
7583         (Target_arm::Scan::local): Handle the relocations.
7584         (Target_arm::Scan::global): Likewise.
7585         (Target_arm::Relocate::relocate): Likewise.
7586         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7587
7588 2010-01-29  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7591         of relocation types as ld.
7592
7593 2010-01-29  Doug Kwan  <dougkwan@google.com>
7594
7595         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7596         to public.
7597         (Arm_relocate_functions::thumb_branch_common): Ditto.
7598         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7599         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7600         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7601         Arm_relocate_functions::jump24): Remove.
7602         (Target_arm::Relocate::relocate): Adjust code to call
7603         Arm_relocation_functions::arm_branch_common and
7604         Arm_relocation_functions::thumb_branch_common instead of their removed
7605         wrappers.  Merge switch-cases together to reduce source code size.
7606
7607 2010-01-29  Doug Kwan  <dougkwan@google.com>
7608
7609         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7610         output_local_symbol_count_needs_update_.
7611         (Arm_relobj::output_local_symbol_count_needs_update,
7612          Arm_relobj::set_output_local_symbol_count_needs_update,
7613          Arm_relobj::update_output_local_symbol_count): New methods.
7614         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7615         member.
7616         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7617         of pointed function as in a R_ARM_PREL31 relocation.
7618         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7619         for output local symbol count updating.
7620         (Target_arm::do_relax): Update output local symbol counts in objects
7621         if necessary.
7622         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7623
7624 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7625
7626         * arm.cc: Added support for the ARM relocations:
7627         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7628         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7629         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7630         movw_prel_nc).
7631         (Arm_relocate_functions::movw_rel): New method.
7632         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7633         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7634         thm_movw_prel_nc).
7635         (Arm_relocate_functions::thm_movw_rel): New method.
7636         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7637         thm_movt_prel).
7638         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7639         relocations.
7640         (Target_arm::Scan::global): Likewise.
7641         (Target_arm::Relocate::relocate): Likewise.
7642         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7643         Likewise.
7644
7645 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7646
7647         * arm.cc: Added support for ARM group relocations.
7648         (Target_arm::reloc_needs_sym_origin): New method.
7649         (Arm_relocate_functions::calc_grp_kn): New method.
7650         (Arm_relocate_functions::calc_grp_residual): New method.
7651         (Arm_relocate_functions::calc_grp_gn): New method.
7652         (Arm_relocate_functions::arm_grp_alu): New Method.
7653         (Arm_relocate_functions::arm_grp_ldr): New Method.
7654         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7655         (Arm_relocate_functions::arm_grp_ldc): New Method.
7656         (Target_arm::Scan::local): Handle the ARM group relocations.
7657         (Target_arm::Scan::global): Likewise.
7658         (Target_arm::Relocate::relocate): Likewise.
7659         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7660         Likewise.
7661
7662 2010-01-26  Doug Kwan  <dougkwan@google.com>
7663
7664         * arm.cc (set): Include.
7665         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7666         pointer type.
7667         (Arm_output_section::Text_section_list): New type.
7668         (Arm_output_section::append_text_sections_to_list): New method.
7669         (Arm_output_section::fix_exidx_coverage): Ditto.
7670         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7671         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7672         Relobj::set_section_offset() instead of
7673         Sized_relobj::invalidate_section_offset().
7674         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7675         parameter for section headers. Ignore relocation sections for
7676         unallocated sections and EXIDX sections.
7677         (Target_arm::fix_exidx_coverage): New method.
7678         (Target_arm::output_section_address_less_than): New type.
7679         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7680         linked text section instead of the EXIDX section.
7681         (Arm_output_section::create_stub_group): Add an assertion to check
7682         that this is not an EXIDX output section.
7683         (Arm_output_section::append_text_sections_to_list): New method.
7684         (Arm_output_section::fix_exidx_coverage): Ditto.
7685         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7686         Arm_relobj::section_needs_reloc_stub_scanning.
7687         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7688         first pass.
7689         (Target_arm::fix_exidx_coverage): New method.
7690         * object.h (Relobj::set_output_section): New method.
7691         (Sized_relobj::invalidate_section_offset): Remove method.
7692         (Sized_relobj::do_invalidate_section_offset): Remove method.
7693         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7694
7695 2010-01-25  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7698         Fix warning due to signed and unsigned comparison on a 32-bit host.
7699
7700 2010-01-22  Doug Kwan  <dougkwan@google.com>
7701
7702         * arm.cc (Target_arm::do_relax): Record an output section for section
7703         offset adjustment it contains any stub table that has changed.
7704         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7705         offsets in an output section if necessary.
7706         * output.cc (Output_section::Output_section): Initialize
7707         section_offsets_need_adjustments_.
7708         (Output_section::add_input_section_for_script): Renamed to
7709         Output_section::add_simple_input_section.
7710         (Output_section::save_states): Add a comment.
7711         (Output_section::discard_states): New method defintion.
7712         (Output_section::adjust_section_offsets): Same.
7713         * output.h (Output_section::add_input_section_for_script): Renamed to
7714         Output_section::add_simple_input_section.
7715         (Output_section::discard_states): New method declaration.
7716         (Output_section::adjust_section_offsets): Same.
7717         (Output_section::section_offsets_need_adjustment,
7718         Output_section::set_section_offsets_need_adjustment): New method
7719         definitions.
7720         (Output_section::section_offsets_need_adjustment_): New data member.
7721         * script-sections.cc
7722         (Output_section_element_input::set_section_address): Adjust code for
7723         renaming of Output_section::add_input_section_for_script.
7724         (Orphan_output_section::set_section_address): Same.
7725
7726 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7727
7728         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7729         Fix_v4bx enum values .
7730         * gold/options.h (General_options): New option definitions.
7731         (General_options::fix_v4bx): New method.
7732         (General_options::Fix_v4bx): New enum.
7733         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7734         (General_options::parse_fix_v4bx_interworking): New method.
7735
7736 2010-01-22  Doug Kwan  <dougkwan@google.com>
7737
7738         * arm.cc (Arm_exidx_fixup): New class.
7739
7740 2010-01-21  Doug Kwan  <dougkwan@google.com>
7741
7742         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7743         classes.
7744         (Arm_exidx_section_offset_map): New type.
7745
7746 2010-01-21  Doug Kwan  <dougkwan@google.com>
7747
7748         * arm.cc (Arm_exidx_input_section): New class.
7749         (Arm_relobj::exidx_input_section_by_link,
7750         Arm_relobj::exidx_input_section_by_shndx,
7751         Arm_relobj::make_exidx_input_section): New methods.
7752         (read_arm_attributes_section): Remove.
7753         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7754         information about them.
7755         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7756         to here.
7757
7758 2010-01-20  Doug Kwan  <dougkwan@google.com>
7759
7760         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7761         Input_section_specifier to Section_id.
7762         (Target_arm::new_arm_input_section: Adjust code for change of key
7763         type.
7764         (Target_arm::find_arm_input_section): Ditto.
7765         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7766         (Section_id): Remove.
7767         (Garbage_collection::Section_id_hash): Remove.
7768         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7769         (Section_id): Remove.
7770         (Icf::Section_id_hash): Remove.
7771         * object.h (Section_id, Const_section_id, Section_id_hash,
7772         Const_section_id_hash): New type definitions.
7773         * output.cc (Output_section::add_relaxed_input_section): Change to
7774         use Const_section_id instead of Input_section_specifier as key type.
7775         (Output_section::add_merge_input_section): Ditto.
7776         (Output_section::build_relaxation_map): Change to use Section_id
7777         instead of Input_section_specifier as key type.
7778         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7779         Ditto.
7780         (Output_section::convert_input_sections_to_relaxed_sections): Change
7781         to use Const_section_id instead of Input_section_specifier as key type.
7782         (Output_section::find_merge_section): Ditto.
7783         (Output_section::find_relaxed_input_section): Ditto.
7784         * output.h (Input_section_specifier): Remove class.
7785         (Output_section::Output_section_data_by_input_section_map): Change
7786         key type to Const_section_id.
7787         (Output_section::Output_relaxed_input_section_by_input_section_map):
7788         Ditto.
7789         (Output_section::Relaxation_map): Change key type to Section_id.
7790
7791 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7792
7793         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7794         (class Arm_v4bx_stub): New class.
7795         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7796         (Stub_factory::make_arm_v4bx_stub): New method.
7797         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7798         (Stub_table::empty): Handle v4bx stubs.
7799         (Stub_table::add_arm_v4bx_stub): New method.
7800         (Stub_table::find_arm_v4bx_stub): New method.
7801         (Arm_relocate_functions::v4bx): New method.
7802         (Target_arm::fix_v4bx): New method.
7803         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7804         (Stub_table::relocate_stubs): Likewise.
7805         (Stub_table::do_write): Likewise.
7806         (Stub_table::update_data_size_and_addralign): Likewise.
7807         (Stub_table::finalize_stubs):  Likewise.
7808         (Target_arm::Scan::local): Likewise.
7809         (Target_arm::Scan::global): Likewise.
7810         (Target_arm::do_finalize_sections): Likewise.
7811         (Target_arm::Relocate::relocate): Likewise.
7812         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7813         Likewise.
7814         (Target_arm::scan_reloc_for_stub): Likewise.
7815         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7816
7817 2010-01-19  Ian Lance Taylor  <iant@google.com>
7818
7819         * output.cc (Output_section_headers::do_sized_write): Write large
7820         segment count to sh_info field.
7821         (Output_file_header::do_sized_write): For large segment count,
7822         write PN_XNUM to e_phnum field.
7823
7824 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7825
7826         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7827         (Arm_relocate_functions::thm_jump8): New function.
7828         (Arm_relocate_functions::thm_jump11): New function.
7829         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7830         R_ARM_THM_JUMP11.
7831         (Target_arm::Scan::global): Likewise.
7832         (Target_arm::Relocate::relocate): Likewise.
7833         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7834         Likewise.
7835
7836 2010-01-14  Doug Kwan  <dougkwan@google.com>
7837
7838         * arm.cc (map, utility): Include headers.
7839         (Target_arm::apply_cortex_a8_workaround): New method.
7840         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7841         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7842         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7843         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7844         the --[no-]fix-cortex-a8 command line options.
7845         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7846         (Target_arm::relocate_stub): Use addend in instruction template.
7847         * options.h (DEFINE_bool): Set the user-set flag.
7848         (General_options): Add --[no-]-fix-cortex options.
7849         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7850         : Update fast look-up map after conversion.
7851
7852 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7853
7854         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7855         in the first pass of do_layout.
7856
7857 2010-01-13  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7860         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7861         apparent compiler problem of not folding static constant integral
7862         data members of elfcpp::Elf_sizes<32>.
7863
7864 2010-01-13  Doug Kwan  <dougkwan@google.com>
7865
7866         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7867         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7868         Arm_relobj::scan_section_for_cortex_a8_erratum,
7869         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7870         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7871         sections to scan for relocation stubs into a new method
7872         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7873         relocation and Cortex-A8 stub scanning.
7874         (Target_arm::do_relax): Force stubs to be after stubbed sections
7875         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7876         the beginning of a new relaxation pass.  Update a comment.
7877         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7878
7879 2010-01-12  Ian Lance Taylor  <iant@google.com>
7880
7881         * target-reloc.h (visibility_error): New inline function.
7882         (relocate_section): Call visibility_error.
7883         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7884         (MOSTLYCLEANFILES): Likewise.
7885         (protected_4_pic.o, protected_3.err): New targets.
7886         * testsuite/protected_4.cc: New file.
7887
7888 2010-01-12  Doug Kwan  <dougkwan@google.com>
7889
7890         * arm.cc (Cortex_a8_reloc): New class.
7891         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7892         and cortex_a8_relocs_info_.
7893         (Target_arm::fix_cortex_a8): New method definition.
7894         (Target_arm::Cortex_a8_relocs_info): New type.
7895         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7896         New data member declarations.
7897         (Target_arm::scan_reloc_for_stub): Record information about
7898         relocations for THUMB branches that might be exempted from the
7899         Cortex-A8 workaround.
7900         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7901         at the beginning of a relaxation pass.
7902
7903 2010-01-12  Doug Kwan  <dougkwan@google.com>
7904
7905         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7906         (Arm_relobj::Mapping_symbol_position,
7907          Arm_reloj::Mapping_symbol_position_less,
7908          Arm_relobj::Mapping_symbols_info): New types.
7909         (Target_arm::is_mapping_symbol_name): New method definition.
7910         (Arm_relobj::do_count_local_symbols): Save information about mapping
7911         symbols.
7912
7913 2010-01-11  Doug Kwan  <dougkwan@google.com>
7914
7915         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
7916         Arm_relocate_functions::thumb32_branch_upper,
7917         Arm_relocate_functions::thumb32_branch_lower,
7918         Arm_relocate_functions::thumb32_cond_branch_offset,
7919         Arm_relocate_functions::thumb32_cond_branch_upper,
7920         Arm_relocate_functions::thumb32_cond_branch_lower,
7921         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
7922         branch offset encoding.
7923         (Arm_relocate_functions::thumb_branch_common): Use new branch
7924         offset encoding methods to avoid code duplication.
7925         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
7926         (Stub_addend_reader::operator()): Use new branch encoding method
7927         to avoid code duplication.
7928
7929 2010-01-11  Doug Kwan  <dougkwan@google.com>
7930
7931         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
7932         (Target_arm::do_finalize_sections): Define special EXIDX section
7933         symbols only if referenced.
7934         * gc.h (Garbage_collection::add_reference): New method.
7935         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
7936         code duplication.
7937
7938 2010-01-11  Ian Lance Taylor  <iant@google.com>
7939
7940         * script.cc (Version_script_info::build_expression_list_lookup):
7941         Change complaing about duplicate wildcard match from error to
7942         warning.
7943
7944         * script.cc (class Lazy_demangler): Recreate--revert part of patch
7945         of 2009-12-30.
7946         (Version_script_info::Version_script_info): Initialize globs_,
7947         default_version_, default_is_global_, and exact_.  Don't
7948         initialize globals_ or locals_.
7949         (Version_script_info::build_lookup_tables): Build local symbols
7950         first.
7951         (Version_script_info::unquote): New function.
7952         (Version_script_info::add_exact_match): New function.
7953         (Version_script_info::build_expression_list_lookup): Remove lookup
7954         parameter.  Add is_global parameter.  Change all callers.  Handle
7955         wildcard pattern specially.  Unquote pattern.  Call
7956         add_exact_match.
7957         (Version_script_info::get_name_to_match): New function.
7958         (Version_script_info::get_symbol_version): New function.
7959         (Version_script_info::get_symbol_version_helper): Remove.
7960         (Version_script_info::check_unmatched_names): Call unquote.
7961         * script.h (class Version_script_info): Change get_symbol_version
7962         to be non-inline and add is_global parameter; change all callers.
7963         Rewrite symbol_is_local.  Update declarations.  Define struct
7964         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
7965         Remove globals_ and locals_ members.  Add exact_, globs_,
7966         default_version_, is_global_.
7967         (Version_script_info::Glob): Remove pattern, add expression and
7968         is_global.  Update constructor.  Change all callers.
7969         * dynobj.cc (Versions::finalize): Mark the version symbol as the
7970         default version.
7971         (Versions::symbol_section_contents): If a symbol is undefined, or
7972         defined in a dynamic object, set the version index to
7973         VER_NDX_LOCAL.
7974         * symtab.cc (Symbol_table::add_from_relobj): Don't call
7975         symbol_is_local.
7976         (Symbol_table::add_from_pluginobj): Likewise.
7977         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
7978
7979 2010-01-11  Doug Kwan  <dougkwan@google.com>
7980
7981         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
7982         (incremental_dump_LDADD): Add linking option for libintl.
7983         * Makefile.in: Regenerate.
7984
7985 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
7986
7987         PR gold/11144
7988         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
7989         instead of -Ds.
7990         * testsuite/Makefile.in: Regenerated.
7991
7992 2010-01-10  Doug Kwan  <dougkwan@google.com>
7993
7994         * options.h (DEFINE_var): Use parentheses around argument varname__
7995         in macro body to avoid any unintended subsequent substitutions.
7996
7997 2010-01-10  Ian Lance Taylor  <iant@google.com>
7998
7999         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8000         candidates before doing symbol resolution.
8001
8002         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8003         ODR candidates if only one is weak.
8004
8005 2010-01-08  Ian Lance Taylor  <iant@google.com>
8006
8007         * script.cc (Version_script_info::build_expression_list_lookup):
8008         Don't warn about ambiguous version, just record the ambiguity.
8009         (Version_script_info::get_symbol_version_helper): Give error if
8010         version is ambiguous.
8011
8012 2010-01-08  Doug Kwan  <dougkwan@google.com>
8013
8014         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8015         prev_data_size_ and prev_addralign_.  Remove initializer for
8016         deleted data member has_been_changed_.
8017         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8018         to determine if the table is empty.
8019         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8020         Remove.
8021         (Stub_table::add_reloc_stub): Define method in class definition
8022         instead of just declaring it there.
8023         (Stub_table::add_cortex_a8_stub): New method definition.
8024         (Stub_table::update_data_size_and_addralign): Ditto.
8025         (Stub_table::finalize_stubs): Ditto.
8026         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8027         (Stub_table::do_addralign_): Return address alignment in the
8028         (Stub_table::do_reset_address_and_file_offset): Define method in
8029         class definition instead of declaring it there.  Set current data
8030         size to be the data size of the previous pass.
8031         (Stub_table::set_final_data_size): Use current data size as the
8032         final data size.
8033         (Stub_table::relocate_stub): Change parameter type of stub from
8034         Reloc_stub pointer to Stub pointer.
8035         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8036         (Stub_table::Cortex_a8_stub_list): New typedef.
8037         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8038          Stub_table::prev_addralign_): New data member.
8039         (Arm_relobj::Arm_relobj): Initialize data member
8040         section_has_cortex_a8_workaround_.
8041         (Arm_relobj::section_has_cortex_a8_workaround,
8042          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8043          definitions.
8044         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8045         declarations.
8046         (Target_arm::relocate_stub): Change parameter type of stub from
8047         Reloc_stub pointer to Stub pointer.
8048         (Insn_template::size, Insn_template::alignment): Handle
8049         THUMB16_SPECIAL_TYPE.
8050         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8051          Stub_table::update_data_size_and_addralign,
8052          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8053         definitions.
8054         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8055         (Stub_table::do_write): Ditto.
8056         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8057
8058 2010-01-08  Ian Lance Taylor  <iant@google.com>
8059
8060         PR 11108
8061         * symtab.h (class Symbol): Remove fields is_target_special_ and
8062         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8063         (Symbol::is_defined_in_discarded_section): New function.
8064         (Symbol::set_is_defined_in_discarded_section): New function.
8065         (Symbol::has_plt_offset): Rewrite.
8066         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8067         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8068         Don't initialize is_target_special_ or has_plt_offset_.
8069         Initialize is_defined_in_discarded_section_.
8070         (Symbol_table::add_from_relobj): If appropriate, set
8071         is_defined_in_discarded_section.
8072         * resolve.cc (Symbol::override_base_with_special): Don't test
8073         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8074         * target-reloc.h (relocate_section): Do special handling for
8075         symbols defined in discarded sections for global symbols as well
8076         as local symbols.
8077
8078 2010-01-08  Ian Lance Taylor  <iant@google.com>
8079
8080         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8081         the SHT_SYMTAB case.
8082
8083 2010-01-08  Ian Lance Taylor  <iant@google.com>
8084
8085         * object.cc (Sized_relobj::do_layout): Don't get confused if
8086         layout_eh_frame returns NULL.
8087
8088 2010-01-08  Ian Lance Taylor  <iant@google.com>
8089
8090         PR 11084
8091         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8092         dynamic symbol table, use the normal symbol table.
8093         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8094         symbol table.
8095
8096 2010-01-08  Ian Lance Taylor  <iant@google.com>
8097
8098         PR 11072
8099         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8100         sections.
8101
8102 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8103
8104         * version.cc (print_version): Change to "Copyright 2010".
8105
8106 2010-01-08  Ian Lance Taylor  <iant@google.com>
8107
8108         PR 10287
8109         PR 11063
8110         * i386.cc (class Target_i386): Change return type of plt_section
8111         to be non-const.
8112         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8113         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8114         tls_desc_rel_ field.
8115         (Output_data_plt_i386::rel_tls_desc): New function.
8116         (Target_i386::rel_tls_desc_section): New function.
8117         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8118         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8119         R_386_TLS_DESC reloc in rel_tls_desc_section.
8120         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8121         Define struct Tlsdesc_info.
8122         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8123         (Target_x86_64::do_reloc_symbol_index): New function.
8124         (Target_x86_64::add_tlsdesc_info): New function.
8125         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8126         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8127         tlsdesc_rel_ field.
8128         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8129         all callers.
8130         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8131         (Target_x86_64::rela_tlsdesc_section): New function.
8132         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8133         handling.
8134         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8135         (Target_x86_64::do_reloc_addend): New function.
8136         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8137         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8138         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8139         (Output_reloc::type): New function.
8140         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8141         (Output_reloc::is_target_specific): New function.
8142         (Output_reloc::target_arg): New function.
8143         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8144         absolute relocs and target specific relocs.
8145         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8146         add_target_specific.
8147         (class Output_data_reloc) [SHT_RELA]: Likewise.
8148         * output.cc (Output_reloc::Output_reloc): Add four new versions
8149         for absolute relocs and target specific relocs.
8150         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8151         (Output_reloc::get_symbol_index): Likewise.
8152         (Output_reloc::local_section_offset): Check that local_sym_index_
8153         is not TARGET_CODE or 0.
8154         (Output_reloc::symbol_value): Likewise.
8155         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8156         reloc.
8157         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8158         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8159         functions.
8160         * layout.cc (add_target_dynamic_tags): Use output section for
8161         DT_PLTRELSZ and DT_JMPREL.
8162
8163 2010-01-07  Ian Lance Taylor  <iant@google.com>
8164
8165         PR 11061
8166         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8167         function.
8168         (class Output_data_reloc_generic): Define.
8169         (class Output_data_reloc_base): Change base class to
8170         Output_data_reloc_generic.  Change add() method to call
8171         bump_relative_reloc_count for a relative reloc.  Remove
8172         sort_relocs_ field.
8173         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8174         to sort_relocs().
8175         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8176         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8177         appropriate.
8178         * layout.h (class Layout): Update declaration.
8179
8180 2010-01-07  Ian Lance Taylor  <iant@google.com>
8181
8182         * output.h (class Output_data): Add const version of
8183         output_section and do_output_section.
8184         (class Output_section_data): Add const version of
8185         do_output_section.
8186         (class Output_section): Likewise.
8187         * layout.cc (Layout::add_target_dynamic_tags): New function.
8188         * layout.h (class Layout): Update declarations.
8189         * arm.cc (Target_arm::do_finalize_sections): Use
8190         add_target_dynamic_tags.
8191         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8192         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8193         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8194         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8195
8196 2010-01-07  Ian Lance Taylor  <iant@google.com>
8197
8198         PR 11042
8199         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8200         object as needed.
8201
8202 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8203             Ian Lance Taylor  <iant@google.com>
8204
8205         PR 11019
8206         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8207         Xindex::read_symtab_xindex.
8208
8209 2010-01-07  Doug Kwan  <dougkwan@google.com>
8210
8211         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8212         (Insn_template::thumb16_bcond_insn): New method declaration.
8213         (Insn_template): Fix spelling.
8214         (Stub::thumb16_special): New method declaration.
8215         (Stub::do_write): Define virtual method which was previously pure
8216         virtual.
8217         (Stub::do_thumb16_special): New method declaration.
8218         (Stub::do_fixed_endian_write): New template member.
8219         (Reloc_stub::do_write): Remove.
8220         (Reloc_stub::do_fixed_endian_write): Remove.
8221         (Cortex_a8_stub): New class definition.
8222         (Stub_factory::make_cortex_a8_stub): New method definition.
8223         (Stub_factory::Stub_factory): Add missing static storage class
8224         qualifier for elf32_arm_stub_a8_veneer_blx.
8225
8226 2010-01-07  Ian Lance Taylor  <iant@google.com>
8227
8228         PR 10980
8229         * options.h (class General_options): Add --warn-unresolved-symbols
8230         and --error-unresolved-symbols.
8231         * errors.cc (Errors::undefined_symbol): Implement
8232         --warn-unresolved-symbols.
8233
8234         * options.h (class General_options): Add -z text and -z textoff.
8235         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8236
8237 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8238
8239         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8240         (Garbage_collection::cident_sections): New function.
8241         (Garbage_collection::add_cident_section): New function.
8242         (Garbage_collection::cident_sections_): New member.
8243         (gc_process_relocs): Add references to sections whose names are C
8244         identifiers.
8245         * gold.h (cident_section_start_prefix): New constant.
8246         (cident_section_stop_prefix): New constant.
8247         (is_cident): New function.
8248         * layout.cc (Layout::define_section_symbols): Replace string constants
8249         with the newly defined constants.
8250         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8251         C identifiers.
8252         * testsuite/Makefile.am: Add gc_orphan_section_test.
8253         * testsuite/Makefile.in: Regenerate.
8254         * testsuite/gc_orphan_section_test.cc: New file.
8255         * testsuite/gc_orphan_section_test.sh: New file.
8256
8257 2010-01-06  Ian Lance Taylor  <iant@google.com>
8258
8259         PR 10980
8260         * options.h (class General_options): Add --warn-shared-textrel.
8261         * layout.cc (Layout::finish_dynamic_section): Implement
8262         --warn-shared-textrel.
8263
8264         PR 10980
8265         * options.h (class General_options): Add --warn-multiple-gp.
8266
8267 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8268
8269         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8270         $(THREADSLIB) and $(LIBDL).
8271         * Makefile.in: Rebuild.
8272
8273 2010-01-06  Ian Lance Taylor  <iant@google.com>
8274
8275         PR 10980
8276         * options.cc (General_options::parse_section_start): New function.
8277         (General_options::section_start): New function.
8278         (General_options::General_options): Initialize all members.
8279         * options.h: Include <map>
8280         (class General_options): Add --section-start.  Add section_starts_
8281         member.
8282         * layout.cc (Layout::attach_allocated_section_to_segment): If
8283         --section-start was used, set the address of the segment.  Remove
8284         local sort_sections.
8285         (Layout::relaxation_loop_body): If the address of the load segment
8286         has been set by --section-start, don't use it.
8287         * output.h (Output_segment::update_flags_for_output_section): New
8288         function.
8289         * output.cc (Output_segment::add_output_section): Call
8290         update_flags_for_output_section.
8291
8292 2010-01-05  Ian Lance Taylor  <iant@google.com>
8293
8294         PR 10980
8295         * options.h (class General_options): Add --undefined-version.
8296         * script.cc (struct Version_expression): Add was_matched_by_symbol
8297         field.
8298         (Version_script_info::matched_symbol): New function.
8299         (Version_script_info::get_symbol_version_helper): Call
8300         matched_symbol.
8301         (Version_script_info::check_unmatched_names): New function.
8302         * script.h (class Version_script_info): Update declarations.
8303         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8304
8305         * options.h (class General_options): Use DEFINE_bool_alias for
8306         allow_multiple_definition.
8307         * resolve.cc (Symbol_table::should_override): Don't test
8308         allow_multiple_definition.
8309
8310         PR 10980
8311         * options.h (class General_options): Add --cref.
8312         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8313         until after printing cref table.
8314         * cref.cc: Include "symtab.h".
8315         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8316         (Cref_table_compare::operator()): New function.
8317         (Cref_inputs::gather_cref): New function.
8318         (filecol): New static const.
8319         (Cref_inputs::print_cref): New function.
8320         (Cref::print_cref): New function.
8321         * cref.h: Include <cstdio>.
8322         (class Cref): Update declarations.
8323         * mapfile.h (Mapfile::file): New function.
8324         * object.h (class Object): Define Symbols.  Declare virtual
8325         do_get_global_symbols.
8326         (Object::get_global_symbols): New function.
8327         * object.cc (Input_objects::add_object): Pass object to cref_ if
8328         --cref.
8329         (Input_objects::archive_start): Likewise.
8330         (Input_objects::archive_stop): Likewise.
8331         (Input_objects::print_cref): New function.
8332         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8333         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8334         --cref.
8335         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8336         function.
8337         * plugin.h (class Sized_pluginobj): Update declarations.
8338
8339 2010-01-05  Ian Lance Taylor  <iant@google.com>
8340
8341         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8342         to is_default_version.  Rename insdef to insdefault.
8343         (Symbol_table::add_from_relobj): Rename def to is_default_version
8344         and local to is_forced_local.
8345         (Symbol_table::add_from_pluginobj): Likewise.
8346         (Symbol_table::add_from_dynobj): Likewise.
8347         (Symbol_table::define_special_symbol): Rename insdef to
8348         insdefault.
8349
8350 2010-01-04  Ian Lance Taylor  <iant@google.com>
8351
8352         PR 10980
8353         * options.h (class General_options): Add
8354         --allow-multiple-definition and -z muldefs.
8355         * resolve.cc (Symbol_table::should_override): Don't warn about a
8356         multiple symbol definition if --allow-multiple-definition or -z
8357         muldefs.
8358
8359         PR 10980
8360         * options.h (class General_options): Add --add-needed and
8361         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8362         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8363         error if --copy-dt-needed-entries aka --add-needed is used and
8364         would cause a change in behaviour.
8365
8366         PR 10980
8367         * options.h (class General_options): Add -G as a short version of
8368         --shared.  Add no-op options -assert, -g, and -i.
8369
8370 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8371
8372         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8373         check for .text or .gnu.linkonce.t sections.
8374         * icf.cc (Icf::find_identical_sections): Ditto.
8375         Change the detection for mangled function name within the section
8376         name.
8377         * icf.h (is_section_foldable_candidate): New function.
8378
8379 2009-12-30  Ian Lance Taylor  <iant@google.com>
8380
8381         PR 10980
8382         * options.h (class General_options): Permit two dashes with
8383         --retain-symbols-file.
8384
8385 2009-12-30  Ian Lance Taylor  <iant@google.com>
8386
8387         PR 10979
8388         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8389         don't put the file header and segment headers in the text
8390         segment.
8391
8392         PR 10979
8393         * common.cc (Sort_commons::operator()): Stabilize sort when both
8394         entries are NULL.
8395         (Symbol_table::do_allocate_commons_list): When allocating common
8396         symbols, skip a symbol which is no longer common.
8397         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8398         an object before checking its type.
8399         * testsuite/common_test_2.c: New file.
8400         * testsuite/common_test_3.c: New file.
8401         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8402         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8403         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8404         (common_test_2_pic.o, common_test_2.so): New targets.
8405         (common_test_3_pic.o, common_test_3.so): New targets.
8406         * testsuite/Makefile.in: Rebuild.
8407
8408         PR 10979
8409         * script.cc (read_input_script): If we see a new SECTIONS clause,
8410         and we have added an input section, give an error.
8411         * layout.h (class Layout): Add have_added_input_section function.
8412         Add have_added_input_section_ field.
8413         * layout.cc (Layout::Layout): Initialize
8414         have_added_input_section_.
8415         (Layout::layout): Set have_added_input_section_.
8416         (Layout::layout_eh_frame): Likewise.
8417
8418 2009-12-30  Ian Lance Taylor  <iant@google.com>
8419
8420         PR 10931
8421         * options.h (class General_options): Add --sort-common option.
8422         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8423         * common.cc (Sort_common): Add sort_order parameter to
8424         constructor.  Add sort_order_ field.
8425         (Sort_commons::operator): Check sort_order_.
8426         (Symbol_table::allocate_commons): Determine the sort order.
8427         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8428         Change all callers.
8429         (Symbol_table::do_allocate_commons_list): Likewise.
8430
8431 2009-12-30  Ian Lance Taylor  <iant@google.com>
8432
8433         PR 10916
8434         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8435         symbols from this object, don't change the visibility of an
8436         undefined symbol.
8437         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8438
8439 2009-12-30  Ian Lance Taylor  <iant@google.com>
8440
8441         PR 10861
8442         * script.h (class Version_script_info): Define Language enum.
8443         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8444         new fields globals_, locals_, and is_finalized_.
8445         * script.cc: Various formatting fixes.
8446         (class Parser_closure): Change language_stack_ from a vector of
8447         std::string to one of Version_script_info::Language.  Adjust all
8448         uses accordingly.
8449         (class Lazy_demangler): Remove.
8450         (struct Version_expression): Change language from std::string to
8451         Version_script_info::Language.
8452         (Version_script_info::Version_script_info): New function.
8453         (Version_script_info::~Version_script_info): Don't call clear.
8454         (Version_script_info::finalize): New function.
8455         (Version_script_info::build_lookup_tables): New function.
8456         (Version_script_info::build_expression_list_lookup): New
8457         function.
8458         (Version_script_info::get_symbol_version_helper): Rewrite to use
8459         lookup tables.
8460         (Version_script_info::print_expression_list): Adjust to use
8461         Version_script_info::Language.
8462         (script_push_lex_into_version_mode): Check that the version script
8463         has not been finalized.
8464         (version_script_push_lang): Change language string to
8465         Version_script_info::Language.
8466         * options.cc (Command_line::version_script): New function.
8467         * options.h (class General_options): Add finalize_dynamic_list
8468         function.  Change version_script from declaration to definition.
8469         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8470         * testsuite/version_script.map: Remove duplicate def of foo.
8471         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8472         version_script.map.
8473         * testsuite/Makefile.in: Rebuild.
8474
8475 2009-12-30  Ian Lance Taylor  <iant@google.com>
8476
8477         PR 10843
8478         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8479         if the input symbol index is 0, make the output symbol index 0.
8480
8481 2009-12-30  Ian Lance Taylor  <iant@google.com>
8482
8483         PR 10670
8484         * options.h (class General_options): Add -x/--discard-all.
8485         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8486         --discard-all.  If the local symbol needs a dynamic entry, check
8487         that before handling --discard-locals.
8488
8489 2009-12-30  Ian Lance Taylor  <iant@google.com>
8490
8491         PR 10450
8492         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8493         flags to PF_R.
8494         (Output_segment::add_output_section): Don't change the flags if
8495         the type is PT_TLS.
8496
8497         PR 10450
8498         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8499         GNU hash table if they need a dynamic value.  Otherwise, don't add
8500         them if they are defined in a dynamic object or are forced local.
8501
8502 2009-12-29  Ian Lance Taylor  <iant@google.com>
8503
8504         PR 10450
8505         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8506         .gnu.hash table for a 32-bit target.
8507
8508         PR 10450
8509         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8510         regular and a dynamic object only needs a dynamic symbol table
8511         entry if it is externally visible.
8512
8513         PR 10450
8514         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8515         constructor.  Add global_offset_table_ field.
8516         (Target_i386::got_section): Set global_offset_table_.
8517         (Target_i386::do_finalize_sections): Set global_offset_table_
8518         size.
8519         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8520         in constructor.  Add global_offset_table_ field.
8521         (Target_x86_64::got_section): Set global_offset_table_.
8522         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8523         size.
8524
8525         * layout.cc (Layout::Layout): Initialize increase_relro_.
8526         (Layout::get_output_section): Add is_relro, is_last_relro, and
8527         is_first_non_relro parameters.  Change all callers.
8528         (Layout::choose_output_section): Likewise.
8529         (Layout::add_output_section_data): Likewise.
8530         (Layout::make_output_section): Likewise.
8531         (Layout::set_segment_offsets): Clear increase_relro when using a
8532         linker script.
8533         * layout.h (class Layout): Add increase_relro method.  Add
8534         increase_relro_ field.  Update declarations.
8535         * output.cc (Output_section::Output_section): Initialize
8536         is_last_relro_ and is_first_non_relro_.
8537         (Output_segment::add_output_section): Group relro sections is
8538         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8539         (Output_segment::maximum_alignment): Remove relro handling.
8540         (Output_segment::set_section_addresses): Add increase_relro
8541         parameter.  Change all callers.  Add initial alignment to align
8542         relro sections on separate page.  Remove old relro handling.
8543         (Output_segment::set_section_list_addresses): Remove in_relro
8544         parameter.  Change all callers.
8545         (Output_segment::set_offset): Add increase parameter.  Change all
8546         callers.  Remove old relro handling.
8547         * output.h (class Output_section): Add new methods: is_last_relro,
8548         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8549         Add is_last_relro_ and is_first_non_relro_ fields.
8550         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8551         Create separate .got.plt section.  Call increase_relro.
8552         * x86_64.cc (Target_x86_64::got_section): Likewise.
8553         * testsuite/relro_script_test.t: Add .got.plt.
8554
8555         PR 10450
8556         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8557         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8558         (Layout::finalize): Call set_dynamic_symbol_size.
8559         (Layout::set_dynamic_symbol_size): New function.
8560         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8561         set_dynamic_symbol_size.
8562
8563         PR 10450
8564         * output.h (class Output_section): Add is_entsize_zero_ field.
8565         * output.cc (Output_section::Output_section): Initialize
8566         is_entsize_zero_.
8567         (Output_section::set_entsize): If two different entsizes are
8568         requested, force it to zero.
8569         (Output_section::add_input_section): Set flags for .debug_str
8570         before updating section flags.  Set entsize.
8571         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8572         and SHF_STRING if all input sections have those flags.
8573
8574 2009-12-29   Rafael Espindola  <espindola@google.com>
8575
8576         * main.cc (main): Fix the sys time reporting.
8577         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8578         reporting.
8579
8580 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8581
8582         * options.cc (General_options::parse_version): Allow -v to exit
8583         without an error if there is nothing to link.
8584
8585 2009-12-29  Ian Lance Taylor  <iant@google.com>
8586
8587         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8588         using a version of gcc before 4.1.
8589         * configure: Rebuild.
8590
8591 2009-12-28  Chris Demetriou  <cgd@google.com>
8592
8593         * attributes.cc (Output_attributes_section_data::do_write): Use
8594         std::vector::front rather than std::vector::data.
8595
8596 2009-12-28  Ian Lance Taylor  <iant@google.com>
8597
8598         * symtab.h (class Symbol_table): Add enum Defined.
8599         * resolve.cc (Symbol_table::should_override): Add defined
8600         parameter.  Change all callers.  Test whether object is NULL
8601         before calling a method on it.
8602         (Symbol_table::report_resolve_problem): Add defined parameter.
8603         Change all callers.
8604         (Symbol_table::should_override_with_special): Likewise.
8605         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8606         parameter.  Change all callers.
8607         (Symbol_table::do_define_in_output_data): Likewise.
8608         (Symbol_table::define_in_output_segment): Likewise.
8609         (Symbol_table::do_define_in_output_segment): Likewise.
8610         (Symbol_table::define_as_constant): Likewise.
8611         (Symbol_table::do_define_as_constant): Likewise.
8612         * script.h (class Symbol_assignment): Add is_defsym parameter to
8613         constructor; change all callers.
8614         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8615         parameter.  Change all callers.  Add is_defsym_ field.
8616         (class Parser_closure): Add parsing_defsym parameter to
8617         constructor; change all callers.  Add parsing_defsym accessor
8618         function.  Add parsing_defsym_ field.
8619
8620 2009-12-28  Ian Lance Taylor  <iant@google.com>
8621
8622         * gold.cc (queue_middle_tasks): Fix formatting.
8623         * object.cc (Relobj::is_section_name_included): Likewise.
8624
8625 2009-12-23  Ian Lance Taylor  <iant@google.com>
8626
8627         * i386.cc (Target_i386::do_calls_non_split): Recognize
8628         -fsplit-stack prologue for a function with a static chain.
8629         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8630         -fsplit-stack prologue when using %r11.
8631
8632 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8633
8634         * options.cc (General_options::parse_version): Make -v continue and do
8635         the link like GNU ld does.
8636
8637 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8638
8639         * Makefile.am (CCFILES): Add timer.cc.
8640         (HFILES): Add timer.h.
8641         * configure.ac: Check for sysconf and times.
8642         * main.cc: include timer.h.
8643         (main): Use Timer instead of get_run_time.
8644         * timer.cc: New.
8645         * timer.h: New.
8646         * workqueue.cc: include timer.h.
8647         (Workqueue::find_and_run_task):
8648         Report user, sys and wall time.
8649         * Makefile.in: Regenerate.
8650         * config.in: Regenerate.
8651         * configure: Regenerate.
8652
8653 2009-12-16  Doug Kwan  <dougkwan@google.com>
8654
8655         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8656         sections.
8657         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8658         relaxed input sections.
8659         * output.cc (Output_section::find_relaxed_input_section): Change
8660         return type to Output_relaxed_input_section pointer.  Adjust code
8661         for new type of relaxed_input_section_map_.
8662         * output.h (Output_section::find_relaxed_input_section): Change
8663         return type to Output_relaxed_input_section pointer.
8664         (Output_section::Output_relaxed_input_section_by_input_section_map):
8665         New type.
8666         (Output_section::relaxed_input_section_map_): Change type to
8667         Output_section::Output_relaxed_input_section_by_input_section_map.
8668         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8669         input section.
8670
8671 2009-12-15  Ian Lance Taylor  <iant@google.com>
8672
8673         * layout.cc (Layout::create_shstrtab): Only write out after input
8674         sections if we are compressing debug sections.
8675
8676 2009-12-15  Ian Lance Taylor  <iant@google.com>
8677
8678         * archive.cc (Archive::add_symbols): Only look up a symbol without
8679         a version if there is, in fact, a version.
8680
8681 2009-12-14  Ian Lance Taylor  <iant@google.com>
8682
8683         Revert -Wshadow changes, all changes from:
8684         2009-12-11  Doug Kwan  <dougkwan@google.com>
8685         2009-12-11  Nick Clifton  <nickc@redhat.com>
8686         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8687
8688 2009-12-11  Doug Kwan  <dougkwan@google.com>
8689
8690         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8691         due to -Wshadow.
8692         * attributes.cc (Object_attribute::size): Ditto.
8693         (Attributes_section_data::size): Ditto.
8694         (Attributes_section_data::Attributes_section_data): Ditto.
8695         (Output_attributes_section_data::do_write): Ditto.
8696         * attributes.h (Object_attribute::set_type): Ditto.
8697         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8698
8699 2009-12-11  Nick Clifton  <nickc@redhat.com>
8700
8701         * archive.cc: Fix shadowed variable warnings.
8702         * arm.cc: Likewise.
8703         * compressed_output.cc: Likewise.
8704         * compressed_output.h: Likewise.
8705         * configure: Likewise.
8706         * dwarf_reader.cc: Likewise.
8707         * dynobj.cc: Likewise.
8708         * dynobj.h: Likewise.
8709         * ehframe.cc: Likewise.
8710         * ehframe.h: Likewise.
8711         * errors.cc: Likewise.
8712         * expression.cc: Likewise.
8713         * fileread.cc: Likewise.
8714         * fileread.h: Likewise.
8715         * freebsd.h: Likewise.
8716         * i386.cc: Likewise.
8717         * icf.cc: Likewise.
8718         * incremental.h: Likewise.
8719         * layout.cc: Likewise.
8720         * layout.h: Likewise.
8721         * mapfile.cc: Likewise.
8722         * merge.cc: Likewise.
8723         * merge.h: Likewise.
8724         * object.cc: Likewise.
8725         * object.h: Likewise.
8726         * options.h: Likewise.
8727         * output.cc: Likewise.
8728         * output.h: Likewise.
8729         * parameters.cc: Likewise.
8730         * plugin.cc: Likewise.
8731         * powerpc.cc: Likewise.
8732         * reduced_debug_output.cc: Likewise.
8733         * reduced_debug_output.h: Likewise.
8734         * reloc.cc: Likewise.
8735         * reloc.h: Likewise.
8736         * resolve.cc: Likewise.
8737         * script-sections.cc: Likewise.
8738         * script.cc: Likewise.
8739         * script.h: Likewise.
8740         * sparc.cc: Likewise.
8741         * symtab.cc: Likewise.
8742         * symtab.h: Likewise.
8743         * target-select.cc: Likewise.
8744         * target-select.h: Likewise.
8745         * token.h: Likewise.
8746         * workqueue.cc: Likewise.
8747         * workqueue.h: Likewise.
8748         * x86_64.cc: Likewise.
8749
8750 2009-12-10  Doug Kwan  <dougkwan@google.com>
8751
8752         * arm.cc (attributes.h): New include.
8753         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8754         (Arm_relobj::~Arm_relobj): Delete object pointed by
8755         attributes_section_data_.
8756         (Arm_relobj::attributes_section_data): New method definition.
8757         (Arm_relobj::attributes_section_data_): New data member declaration.
8758         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8759         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8760         attributes_section_data_.
8761         (Arm_dynobj::attributes_section_data): New method definition.
8762         (Arm_dynobj::attributes_section_data_): New data member declaration.
8763         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8764         initialization value of may_use_blx_ to false.
8765         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8766         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8767         object attributes to compute results instead of hard-coding.
8768         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8769         Target_arm::get_secondary_compatible_arch,
8770         Target_arm::set_secondary_compatible_arch
8771         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8772         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8773         New method declarations.
8774         (Target_arm::get_aeabi_object_attribute): New method definition.
8775         (Target_arm::attributes_section_data_): New data member declaration.
8776         (read_arm_attributes_section): New template definition.
8777         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8778         (Arm_dynobj::do_read_symbols): Ditto.
8779         (Target_arm::do_finalize_sections): Merge attributes sections from
8780         input.  Check for BLX use after attributes section merging.
8781         Fix __exidx_start and __exidx_end visibility.  Create an
8782         .ARM.attributes section if necessary.
8783         (Target_arm::get_secondary_compatible_arch,
8784         Target_arm::set_secondary_compatible_arch,
8785         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8786         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8787         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8788         New method definitions.
8789
8790 2009-12-09  Ian Lance Taylor  <iant@google.com>
8791
8792         * plugin.cc (Plugin::load): Don't cast from void* to a function
8793         pointer.
8794
8795 2009-12-09  Ian Lance Taylor  <iant@google.com>
8796
8797         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8798         information fields.
8799
8800 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8801
8802         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8803         Replace two_file_shared_1.so with two_file_shared_2.so.
8804         * testsuite/Makefile.in: Regenerated.
8805
8806 2009-12-08  Doug Kwan  <dougkwan@google.com>
8807
8808         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8809         (HFILES): Add attributes.h and int_encoding.h.
8810         * Makefile.in: Regenerate.
8811         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8812         function definitions to int_encoding.cc
8813         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8814         prototypes to int_encoding.h
8815         * reduced_debug_output.cc (int_encoding.h): New include.
8816         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8817         function definitions to int_encoding.cc
8818         (insert_into_vector, read_from_pointer): Move template definitions to
8819         int_encoding.h
8820         * attributes.cc: New file.
8821         * attributes.h: New file.
8822         * int_encoding.cc: New file.
8823         * int_encoding.h: New file.
8824
8825 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8826
8827         PR gold/11055
8828         * incremental-dump.cc (dump_incremental_inputs): New.
8829         (main): Use dump_incremental_inputs.
8830
8831 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8832
8833         PR gold/10893
8834         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8835         checking elfcpp::STT_FUNC.
8836         (Target_i386::Relocate::relocate): Likewise.
8837         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8838
8839         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8840         symbols from shared libraries into normal FUNC symbols.
8841
8842         * symtab.h (Symbol): Add is_func and use it.
8843
8844 2009-12-05  Doug Kwan  <dougkwan@google.com>
8845
8846         * arm.cc (Target_arm::arm_info): Initialize new fields
8847         attributes_section and attributes_vendor.
8848         * i386.cc (Target_i386::i386_info): Same.
8849         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8850         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8851         fields attributes_section and attributes_vendor.
8852         * sparc.cc (Target_sparc::sparc_info): Same.
8853         * target.h (Target::attributes_section, Target::attributes_vendor,
8854         Target::is_attributes_section, Target::attribute_arg_type,
8855         Target::attributes_order): New method definitions.
8856         (Target::Target_info::attributes_section,
8857         Target::Target_info::attributes_vendor): New fields.
8858         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8859         virtual method definitions.
8860         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8861         attributes_section and attributes_vendor.
8862         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8863
8864 2009-12-05  Doug Kwan  <dougkwan@google.com>
8865
8866         * arm.cc: Update comments about interworking and stub generation.
8867         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8868         considered as non-PIC.
8869         (Arm_relocate_functions::base_abs): Fix formatting.
8870         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8871         of function to use GOT entry address instead of offset.
8872         (Target_arm::Scan::global): Issue an error if a symbol would need a
8873         PLT does not get one because it is untyped.  Remove code to create
8874         dynamic symbols for relative branches.
8875         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8876         takes unsigned integer instead of boolean.
8877
8878 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8879
8880         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8881         (two_file_test_LDADD): Likewise.
8882         (common_test_1_LDADD): Likewise.
8883         (exception_test_LDADD) Likewise.
8884         (weak_test_LDADD): Likewise.
8885         (many_sections_test_LDADD): Likewise.
8886         (initpri1_LDADD): Likewise.
8887         (script_test_1_LDADD): Likewise.
8888         (script_test_2_LDADD): Likewise.
8889         (justsyms_LDADD): Likewise.
8890         (binary_test_LDADD): Likewise.
8891         (large_LDADD): Likewise.
8892         * testsuite/Makefile.in: Regenerated.
8893
8894 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8895
8896         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8897         (Symbol_table::override_with_special): Likewise.
8898         (Symbol_table::add_from_object): Likewise.
8899
8900 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8901
8902         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8903         Don't set the data_offset twice.
8904
8905 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8906
8907         * testsuite/Makefile.in: Regenerate.
8908
8909 2009-12-03  Doug Kwan  <dougkwan@google.com>
8910
8911         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8912         (Target_arm::do_finalize_sections): Add parameter for symbol table
8913         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8914         * i386.cc (Target_i386::do_finalize_sections): Add an additional
8915         parameter for symbol table pointer.
8916         * layout.cc (Layout::finalize): Call Target::finalize_sections with
8917         an additional parameter for a pointer to symbol table.
8918         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
8919         parameter for a symbol table pointer.
8920         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
8921         * target.h (Target::finalize_sections, Target::do_finalize_sections):
8922         Ditto.
8923         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
8924         parameter for a symbol table pointer.
8925
8926 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
8927
8928         * incremental.cc (Incremental_inputs_header)
8929         (Incremental_inputs_header_write, Incremental_inputs_entry)
8930         (Incremental_inputs_entry_write): Move ...
8931         * incremental.h (Incremental_inputs_header)
8932         (Incremental_inputs_header_write, Incremental_inputs_entry)
8933         (Incremental_inputs_entry_write): here.
8934
8935 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8936
8937         * incremental.cc (make_sized_incremental_binary): Set the target.
8938         Error if it is incompatible.
8939         * output.h (Output_file): Add filename method.
8940
8941 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8942
8943         * incremental.cc (Incremental_inputs_entry): Remove unused argument
8944         from the get_* methods.
8945
8946 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8947
8948         * incremental-dump.cc (main): Check that the offeset of a script is 0.
8949         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8950         Write 0 for the data_offset of scripts.
8951
8952 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
8953
8954         * testsuite/Makefile.am: Add the incremental_test.sh test.
8955         * testsuite/incremental_test.sh: New.
8956         * testsuite/incremental_test_1.c: New.
8957         * testsuite/incremental_test_2.c: New.
8958
8959 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
8960
8961         * incremental-dump.cc (main): Fix typos.
8962
8963 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
8964
8965         PR gold/11025
8966         * incremental-dump.cc (main): Use llu to print 64 bit values.
8967
8968 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
8969             H.J. Lu  <hongjiu.lu@intel.com>
8970
8971         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
8972         $(LIBDL).
8973         (incremental_dump_LDADD): Likewise.
8974         * Makefile.in: Regenerated.
8975
8976 2009-11-25  Doug Kwan  <dougkwan@google.com>
8977
8978         Revert:
8979
8980         2009-11-25  Doug Kwan  <dougkwan@google.com>
8981
8982                 * arm.cc (Target_arm::Target_arm): Move method definition
8983                 outside of class definition.  Add code to handle
8984                 --target1-rel, --target1-abs and --target2= options.
8985                 (Target_arm::get_reloc_reloc_type): Change method to be
8986                 non-static and const.
8987                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
8988                 New data member declaration.
8989                 (Target_arm::Scan::local, Target_arm::Scan::global,
8990                 Target_arm::Relocate::relocate,
8991                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8992                 Adjust call to Target_arm::get_real_reloc_type.
8993                 (Target_arm::get_real_reloc_type): Use command line options
8994                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
8995                 * options.h (--target1-rel, --target1-abs, --target2): New
8996                 ARM-only options.
8997
8998 2009-11-25  Doug Kwan  <dougkwan@google.com>
8999
9000         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9001         class definition.  Add code to handle --target1-rel, --target1-abs
9002         and --target2= options.
9003         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9004         and const.
9005         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9006         member declaration.
9007         (Target_arm::Scan::local, Target_arm::Scan::global,
9008         Target_arm::Relocate::relocate,
9009         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9010         call to Target_arm::get_real_reloc_type.
9011         (Target_arm::get_real_reloc_type): Use command line options to
9012         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9013         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9014         options.
9015
9016 2009-11-25  Doug Kwan  <dougkwan@google.com>
9017
9018         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9019         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9020         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9021         formatting.
9022         (Arm_relocate_functions::thm_call): Replace body with a call to
9023         Arm_relocate_functions::thumb_branch_common.
9024         (Arm_relocate_functions::thm_jump24,
9025         Arm_relocate_functions::thm_xpc22): New method definitions.
9026         (Arm_relocate_functions::thumb_branch_common): New method definition.
9027         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9028         operator.
9029         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9030         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9031
9032 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9033
9034         * Makefile.am: Build incremental-dump
9035         * Makefile.in: Regenerate.
9036         * incremental-dump.cc: New.
9037         * incremental.cc (Incremental_inputs_header_data,
9038         Incremental_inputs_entry_data): Move to incremental.h
9039         * incremental.h: (Incremental_inputs_header_data,
9040         Incremental_inputs_entry_data): Move from incremental.cc
9041
9042 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9043
9044         * incremental.cc (Incremental_inputs_header,
9045         Incremental_inputs_header_write, Incremental_inputs_entry,
9046         Incremental_inputs_entry_write): Add a typedef with the data type.
9047
9048 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9049
9050         * incremental.cc (Incremental_inputs_header,
9051         Incremental_inputs_header_write, Incremental_inputs_entry,
9052         Incremental_inputs_entry_write): Update comment about which
9053         type has the filed descriptions.
9054
9055 2009-11-15  Doug Kwan  <dougkwan@google.com>
9056
9057         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9058         (Arm_relocate_functions::arm_branch_common): Change method defintion
9059         in class definition to a method declaration and update list of formal
9060         parameters.
9061         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9062         Arm_relocation_functions::jump24): Adjust call to
9063         Arm_relocate_functions::arm_branch_common.  Update list of formal
9064         parameters.
9065         (Arm_relocate_functions::xpc25): New method definition.
9066         (Arm_relocate_functions::arm_branch_common): Move method defintion
9067         out from class definition.  Use stubs for mode-switching and extending
9068         branch ranges.
9069         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9070         specially.  Change code to enable use of stubs in ARM branches.
9071
9072 2009-11-10  Doug Kwan  <dougkwan@google.com>
9073
9074         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9075         in method declaration.
9076         (Target_arm::relocate_stub): New method declaration.
9077         (Target_arm::default_target): Change to return a pointer instead of
9078         a const reference.
9079         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9080         Target_arm::default_target.
9081         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9082         method definition.
9083         (Target_arm::relocate_section): Adjust view.
9084         (Target_arm::relocate_stub): New method definition.
9085
9086 2009-11-10  Doug Kwan  <dougkwan@google.com>
9087
9088         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9089         a format warning.
9090         * incremental.cc (open_incremental_binary): Initialized local
9091         variables to avoid warnings.
9092         * object.cc (make_elf_object): Ditto.
9093         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9094         a format warning.
9095
9096 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9097
9098         PR gold/10930
9099         * testsuite/plugin_test.c: Include "config.h".
9100
9101 2009-11-09  Doug Kwan  <dougkwan@google.com>
9102
9103         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9104         (arm_symbol_value): Remove.
9105         (Arm_relocate_functions::arm_branch_common,
9106         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9107         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9108         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9109         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9110         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9111         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9112         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9113         Arm_relocate_functions::thm_mobw_abs_nc,
9114         Arm_relocate_functions::thm_mov_abs,
9115         Arm_relocate_functions::movw_prel_nc,
9116         Arm_relocate_functions::thm_movt_abs,
9117         Arm_relocate_functions::movt_prel,
9118         Arm_relocate_functions::thm_movw_prel_nc,
9119         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9120         (Target_arm::Relocate::relocate): Only decompose address into two
9121         parts if relocation type uses the thumb-bit and pass the actual
9122         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9123         calls to methods in Arm_relocate_functions for this change.
9124
9125 2009-11-08  Ian Lance Taylor  <iant@google.com>
9126
9127         PR 10925
9128         * reloc.cc: Instantiate
9129         Sized_relobj::initialize_input_to_output_maps and
9130         Sized_relobj:free_input_to_output_maps.
9131
9132 2009-11-06  Ian Lance Taylor  <iant@google.com>
9133
9134         PR 10876
9135         * defstd.cc (in_segment): Set only_if_ref true for "end".
9136
9137 2009-11-06  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc (class Reloc_stub): Correct a comment.
9140         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9141         (Target_arm::scan_section_for_stubs): New method declaration.
9142         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9143         Change methods from private to protected.
9144         (Target_arm::do_may_relax): New method definition.
9145         (Target_arm::do_relax, Target_arm::group_sections,
9146         Target_arm::scan_reloc_for_stub,
9147         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9148         (Target_arm::arm_input_section_map_): New data member declaration.
9149         (Target_arm::scan_reloc_for_stub,
9150         Target_arm::scan_reloc_section_for_stubs,
9151         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9152         Target_arm::do_relax): New method definitions.
9153
9154 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9155
9156         * configure.ac: Check for (struct stat)::st_mtim
9157         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9158         * config.in: Regenerate.
9159         * configure: Regenerate.
9160
9161 2009-11-05  Ian Lance Taylor  <iant@google.com>
9162
9163         PR 10910
9164         * output.cc (Output_segment::add_output_section): Add missing
9165         return statement.
9166
9167 2009-11-04  Ian Lance Taylor  <iant@google.com>
9168
9169         PR 10880
9170         * object.h (class Object): Add is_needed and set_is_needed
9171         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9172         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9173         defined in a dynamic object and referenced by a regular object,
9174         set is_needed for the dynamic object.
9175         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9176         if the file is marked with as_needed and it is not needed.
9177
9178 2009-11-04  Ian Lance Taylor  <iant@google.com>
9179
9180         PR 10887
9181         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9182         tags if data is discarded by linker script.
9183         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9184         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9185         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9186         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9187
9188 2009-11-04  Ian Lance Taylor  <iant@google.com>
9189
9190         * layout.cc (Layout::get_output_section): Add is_interp and
9191         is_dynamic_linker_section parameters.  Change all callers.
9192         (Layout::choose_output_section): Likewise.
9193         (Layout::make_output_section): Likewise.
9194         (Layout::add_output_section_data): Add is_dynamic_linker_section
9195         parameter.  Change all callers.
9196         * layout.h (class Layout): Update declarations.
9197         * output.h (class Output_section): Add is_interp, set_is_interp,
9198         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9199         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9200         generate_code_fills_at_write_ to a bitfield.
9201         * output.cc (Output_section::Output_sections): Initialize new
9202         fields.
9203         (Output_segment::add_output_section): Add do_sort parameter.
9204         Change all callers.
9205
9206 2009-11-03  Ian Lance Taylor  <iant@google.com>
9207
9208         PR 10860
9209         * options.h (class General_options): Add --warn-common.
9210         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9211         merging two common symbols.
9212         (Symbol_table::should_override): Handle --warn-common when merging
9213         a common symbol with a defined symbol.  Use report_resolve_problem
9214         for multiple definitions.
9215         (Symbol_table::report_resolve_problem): New function.
9216         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9217
9218 2009-11-03  Doug Kwan  <dougkwan@google.com>
9219
9220         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9221         stub_factory_.
9222         (Target_arm::stub_factory): New method definition.
9223         (Target_arm::new_arm_input_section,
9224         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9225         Target_arm::reloc_uses_thumb_bit): New method declarations.
9226         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9227         New type definitions.
9228         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9229         member declarations.
9230         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9231         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9232         New method definitions.
9233
9234 2009-11-03  Ian Lance Taylor  <iant@google.com>
9235
9236         * options.h (class General_options): Add --warn_constructors.
9237
9238 2009-11-03  Ian Lance Taylor  <iant@google.com>
9239
9240         PR 10893
9241         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9242         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9243
9244 2009-11-03  Ian Lance Taylor  <iant@google.com>
9245
9246         PR 10895
9247         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9248         --msgid-bugs-address.
9249         (install-pdf): New target.
9250         (install-data_yes): Look up one directory to find mkinstalldirs.
9251
9252 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9253
9254         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9255         tree.
9256
9257 2009-10-30  Doug Kwan  <dougkwan@google.com>
9258
9259         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9260
9261 2009-10-30  Doug Kwan  <dougkwan@google.com>
9262
9263         * arm.cc (Stub_addend_reader): New struct template definition
9264         and partial specializations.
9265         (Stub_addend_reader::operator()): New method definition for a
9266         partially specialized template.
9267
9268 2009-10-30  Doug Kwan  <dougkwan@google.com>
9269
9270         * arm.cc (Arm_relobj::processor_specific_flags): New method
9271         definition.
9272         (Arm_relobj::do_read_symbols): New method declaration.
9273         (Arm_relobj::processor_specific_flags_): New data member declaration.
9274         (Arm_dynobj): New class definition.
9275         (Target_arm::do_finalize_sections): Add input_objects parameter.
9276         (Target_arm::do_adjust_elf_header): New method declaration.
9277         (Target_arm::are_eabi_versions_compatible,
9278         (Target_arm::merge_processor_specific_flags): New method declaration.
9279         (Target_arm::do_make_elf_object): New overloaded method definitions
9280         and declaration.
9281         (Arm_relobj::do_read_symbols): New method definition.
9282         (Arm_dynobj::do_read_symbols): Ditto.
9283         (Target_arm::do_finalize_sections): Add input_objects parameters.
9284         Merge processor-specific flags from all input objects.
9285         (Target_arm::are_eabi_versions_compatible,
9286         Target_arm::merge_processor_specific_flags,
9287         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9288         New method definitions.
9289         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9290         Input_objects pointer type parameter.
9291         * layout.cc (Layout::finalize): Pass input objects to target's.
9292         finalize_sections function.
9293         * output.cc (Output_file_header::do_sized_write): Set ELF file
9294         header's processor-specific flags.
9295         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9296         Input_objects pointer type parameter.
9297         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9298         * target.h (Input_objects): New forward class declaration.
9299         (Target::processor_specific_flags,
9300         Target::are_processor_specific_flags_sect): New method definitions.
9301         (Target::finalize_sections): Add input_objects parameter.
9302         (Target::Target): Initialize processor_specific_flags_ and
9303         are_processor_specific_flags_set_.
9304         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9305         parameter.
9306         (Target::set_processor_specific_flags): New method definition.
9307         (Target::processor_specific_flags_,
9308         Target::are_processor_specific_flags_set_): New data member
9309         declarations.
9310         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9311         Input_objects pointer type parameter.
9312
9313 2009-10-30  Doug Kwan  <dougkwan@google.com>
9314
9315         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9316
9317 2009-10-28  Ian Lance Taylor  <iant@google.com>
9318
9319         * object.h (class Relobj): Drop options parameter from
9320         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9321         do_scan_relocs, do_relocate.  Change all callers.
9322         (class Sized_relobj): Drop options parameters from
9323         do_gc_process_relocs, do_scan_relocs, do_relocate,
9324         do_relocate_sections, relocate_sections, emit_relocs_scan,
9325         emit_relocs_scan_reltype.  Change all callers.
9326         (struct Relocate_info): Remove options field and all references to
9327         it.
9328         * reloc.h (class Read_relocs): Remove options constructor
9329         parameter and options_ field.  Change all callers.
9330         (class Gc_process_relocs, class Scan_relocs): Likewise.
9331         (class Relocate_task): Likewise.
9332         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9333         all callers.
9334         (scan_relocatable_relocs): Likewise.
9335         * target.h (class Sized_target): Remove options parameter from
9336         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9337         all callers.
9338         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9339         callers.
9340         * arm.cc: Update functions to remove options parameters.
9341         * i386.cc: Likewise.
9342         * powerpc.cc: Likewise.
9343         * sparc.cc: Likewise.
9344         * x86_64.cc: Likewise.
9345         * testsuite/testfile.cc: Likewise.
9346
9347 2009-10-28  Doug Kwan  <dougkwan@google.com>
9348
9349         * arm.cc (Arm_relobj): New class definition.
9350         (Arm_relobj::scan_sections_for_stubs,
9351         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9352         New method definitions.
9353
9354 2009-10-28  Cary Coutant  <ccoutant@google.com>
9355
9356         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9357         (Plugin::cleanup_done_): New member.
9358         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9359         (Plugin_manager::cleanup_done_): Remove.
9360         (Plugin_manager::add_input_file): Edit error message.
9361         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9362         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9363
9364 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9365
9366         * fileread.cc: (File_read::View::~View): Use the new
9367         data_ownership_ filed.
9368         (File_read::~File_read): Dispose the new whole_file_view_.
9369         (File_read::open): Mmap the whole file if needed.
9370         (File_read::open): Use whole_file_view_ instead of contents_.
9371         (File_read::find_view): Use whole_file_view_ if applicable.
9372         (File_read::do_read): Use whole_file_view_ instead of contents_.
9373         (File_read::make_view): Use whole_file_view_ instead of contents_,
9374         update File_read::View::View call.
9375         (File_read::find_or_make_view): Update File_read::View::View
9376         call.
9377         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9378         remove contents_
9379         (File_read::View::Data_ownership): New enum.
9380         (File_read::View::View): Replace bool mapped_ with Data_ownership
9381         argument.
9382         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9383         (File_read::View::data_ownership_): New field.
9384         (File_read::contents_): Remove (replaced by whole_file_view_).
9385         (File_read::whole_file_view_): New field.
9386         * options.h (class General_options): Add --keep-files-mapped.
9387
9388 2009-10-27  Cary Coutant  <ccoutant@google.com>
9389
9390         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9391         * testsuite/Makefile.am (plugin_test_5): New test case.
9392         * testsuite/Makefile.in: Regenerate.
9393
9394 2009-10-25  Doug Kwan  <dougkwan@google.com>
9395
9396         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9397         from private to protected to allow access by child class.
9398         (Sized_relobj::do_relocate_sections): New method declaration.
9399         (Sized_relobj::relocate_sections): Virtualize.
9400         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9401         Sized_relobj::relocate_sections.  Instantiate template explicitly
9402         for different target sizes and endianity.
9403
9404 2009-10-24  Doug Kwan  <dougkwan@google.com>
9405
9406         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9407         (Arm_input_section::as_arm_input_section): New method.
9408         (Arm_output_section): New class definition.
9409         (Arm_output_section::create_stub_group,
9410         Arm_output_section::group_sections): New method definitions.
9411
9412 2009-10-22  Doug Kwan  <dougkwan@google.com>
9413
9414         * arm.cc (Arm_input_section): New class definition.
9415         (Arm_input_section::init, Arm_input_section:do_write,
9416         Arm_input_section::set_final_data_size,
9417         Arm_input_section::do_reset_address_and_file_offset): New method
9418         definitions.
9419
9420 2009-10-21  Doug Kwan  <dougkwan@google.com>
9421
9422         * arm.cc (Stub_table, Arm_input_section): New forward class
9423         declarations.
9424         (Stub_table): New class defintion.
9425         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9426         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9427         New method definition.
9428
9429 2009-10-21  Doug Kwan  <dougkwan@google.com>
9430
9431         * arm.cc: Update copyright comments.
9432         (Target_arm): New forward class template declaration.
9433         (Arm_address): New type.
9434         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9435         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9436         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9437         constants.
9438         (Insn_template): Same.
9439         (DEF_STUBS): New macro.
9440         (Stub_type): New enum type.
9441         (Stub_template): New class definition.
9442         (Stub): Same.
9443         (Reloc_stub): Same.
9444         (Stub_factory): Same.
9445         (Target_arm::Target_arm): Initialize may_use_blx_ and
9446         should_force_pic_veneer_.
9447         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9448         Target_arm::should_force_pic_veneer,
9449         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9450         Target_arm::using_thumb_only, Target_arm:;default_target): New
9451         method defintions.
9452         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9453         New data member declarations.
9454         (Insn_template::size, Insn_template::alignment): New method defintions.
9455         (Stub_template::Stub_template): New method definition.
9456         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9457         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9458         (Stub_factory::Stub_factory): New method definition.
9459         * gold.h (string_hash): New template.
9460         * output.h (Input_section_specifier::hash_value): Use
9461         gold::string_hash.
9462         (Input_section_specifier::string_hash): Remove.
9463         * stringpool.cc (Stringpool_template::string_hash): Use
9464         gold::string_hash.
9465
9466 2009-10-20  Doug Kwan  <dougkwan@google.com>
9467
9468         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9469         symbols of relaxed input sections.
9470         * output.h (Output_section::find_relaxed_input_section): Make
9471         method public.
9472
9473 2009-10-16  Doug Kwan  <dougkwan@google.com>
9474
9475         * dynobj.cc (Versions::Versions): Initialize version_script_.
9476         Only insert base version symbol definition for a shared object
9477         if version script defines any version versions.
9478         (Versions::define_base_version): New method definition.
9479         (Versions::add_def): Check that base version is not needed.
9480         (Versions::add_need): Define base version lazily.
9481         * dynobj.h (Versions::define_base_version): New method declaration.
9482         (Versions::needs_base_version_): New data member declaration.
9483         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9484         (check_DATA): Add no_version_test.stdout.
9485         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9486         New make rules.
9487         * testsuite/Makefile.in: Regenerate.
9488         * testsuite/no_version_test.c: New file.
9489         * testsuite/no_version_test.sh: Ditto.
9490
9491 2009-10-16  Doug Kwan  <dougkwan@google.com>
9492
9493         * expression.cc (class Segment_start_expression): New class definition.
9494         (Segment_start_expression::value): New method definition.
9495         (script_exp_function_segment_start): Return a new
9496         Segment_start_expression.
9497         * gold/script-c.h (script_saw_segment_start_expression): New function
9498         prototype.
9499         * script-sections.cc (Script_sections::Script_sections): Initialize
9500         SAW_SEGMENT_START_EXPRESSION_ to false.
9501         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9502         and -Tbbs options to specify section addresses if given in
9503         command line and no SEGMENT_START expression is seen in a script.
9504         * script-sections.h (Script_sections::saw_segment_start_expression,
9505         Script_sections::set_saw_segment_start_expression): New method
9506         definition.
9507         (Script_sections::saw_segment_start_expression_): New data member
9508         declaration.
9509         * script.cc (script_saw_segment_start_expression): New function.
9510         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9511         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9512         script_test_7.sh and script_test_8.sh.
9513         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9514         script_test_8.stdout.
9515         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9516         (script_test_6, script_test_6.stdout, script_test_7,
9517         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9518         * Makefile.in: Regenerate.
9519         * testsuite/script_test_6.sh: New file.
9520         * testsuite/script_test_6.t: Same.
9521         * testsuite/script_test_7.sh: Same.
9522         * testsuite/script_test_7.t: Same.
9523         * testsuite/script_test_8.sh: Same.
9524
9525 2009-10-16  Doug Kwan  <dougkwan@google.com>
9526
9527         * output.cc (Output_segment::set_section_list_address): Cast
9528         expressions to unsigned long long type to avoid format warnings.
9529
9530 2009-10-15  Ian Lance Taylor  <iant@google.com>
9531
9532         * script.cc (Script_options::add_symbol_assignment): Always add a
9533         dot assignment to script_sections_.
9534         * script-sections.cc (Script_sections::add_dot_assignment):
9535         Initialize if necessary.
9536
9537         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9538         program headers with no load segment if there is a linker script.
9539
9540         * layout.cc (Layout::set_segment_offsets): Align the file offset
9541         to the segment aligment for -N or -n with no load segment.
9542         * output.cc (Output_segment::add_output_section): Don't crash if
9543         the first section is a TLS section.
9544         (Output_segment::set_section_list_addresses): Print an error
9545         message if the address moves backward in a linker script.
9546         * script-sections.cc
9547         (Output_section_element_input::set_section_addresses): Don't
9548         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9549         (Orphan_output_section::set_section_addresses): Likewise.
9550
9551 2009-10-15  Doug Kwan  <dougkwan@google.com>
9552
9553         * layout.cc (Layout::finish_dynamic_section): Generate tags
9554         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9555         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9556         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9557
9558 2009-10-14  Ian Lance Taylor  <iant@google.com>
9559
9560         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9561         fields.
9562         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9563         data_shdr fields of relinfo.
9564         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9565         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9566         R_386_TLS_LDO_32, adjust based on section flags.
9567         (Target_i386::Relocate::fix_up_ldo): Remove.
9568
9569 2009-10-13  Ian Lance Taylor  <iant@google.com>
9570
9571         Add support for -pie.
9572         * options.h (class General_options): Add -pie and
9573         --pic-executable.
9574         (General_options::output_is_position_independent): Test -pie.
9575         (General_options::output_is_executable): Return true if not shared
9576         and not relocatable.
9577         (General_options::output_is_pie): Remove.
9578         * options.cc (General_options::finalize): Reject incompatible uses
9579         of -pie.
9580         * gold.cc (queue_middle_tasks): A -pie link is not static.
9581         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9582         * symtab.cc (Symbol::final_value_is_known): Return false if
9583         output_is_position_independent.
9584         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9585         output_is_position_independent.
9586         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9587         output_is_position_independent.
9588         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9589         output_is_position_independent.
9590         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9591         two_file_pie_test.
9592         (basic_pie_test.o, basic_pie_test): New targets.
9593         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9594         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9595         (two_file_pie_test): New target.
9596         * testsuite/Makefile.in: Rebuild.
9597         * README: Remove note saying that -pie is not supported.
9598
9599 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9600
9601         * options.h (class General_options): Add -init and -fini.
9602         * layout.cc (Layout::finish_dynamic_section): Emit
9603         given init and fini functions.
9604
9605 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9606
9607         * gc.h (gc_process_relocs): Check if icf is enabled using new
9608         function.
9609         * gold.cc (queue_initial_tasks): Likewise.
9610         (queue_middle_tasks): Likewise.
9611         * object.cc (do_layout): Likewise.
9612         * symtab.cc (is_section_folded): Likewise.
9613         * main.cc (main): Likewise.
9614         * reloc.cc (Read_relocs::run): Likewise.
9615         (Sized_relobj::do_scan_relocs): Likewise.
9616         * icf.cc (is_function_ctor_or_dtor): New function.
9617         (Icf::find_identical_sections): Check if function is ctor or dtor when
9618         safe icf is chosen.
9619         * options.h (General_options::icf): Change option to be an enum.
9620         (Icf_status): New enum.
9621         (icf_enabled): New method.
9622         (icf_safe_folding): New method.
9623         (set_icf_status): New method.
9624         (icf_status_): New variable.
9625         * (options.cc) (General_options::finalize): Set icf_status_.
9626         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9627         icf_test and icf_keep_unique_test to use the --icf enum flag.
9628         * testsuite/icf_safe_test.sh: New file.
9629         * testsuite/icf_safe_test.cc: New file.
9630
9631 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9632
9633         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9634         includes to gc.h and icf.h.
9635         * arm.cc: Include gc.h.
9636         * gold.cc: Likewise.
9637         * i386.cc: Likewise.
9638         * powerpc.cc: Likewise.
9639         * sparc.cc: Likewise.
9640         * x86_64.cc: Likewise.
9641         * gc.h: Include icf.h.
9642
9643 2009-10-11  Ian Lance Taylor  <iant@google.com>
9644
9645         * plugin.cc: Include "gold.h" before other header files.
9646
9647 2009-10-10  Chris Demetriou  <cgd@google.com>
9648
9649         * options.h (Input_file_argument::Input_file_type): New enum.
9650         (Input_file_argument::is_lib_): Replace with...
9651         (Input_file_argument::type_): New member.
9652         (Input_file_argument::Input_file_argument): Take Input_file_type
9653         'type' rather than boolean 'is_lib' as second argument.
9654         (Input_file_argument::is_lib): Use type_.
9655         (Input_file_argument::is_searched_file): New function.
9656         (Input_file_argument::may_need_search): Handle is_searched_file.
9657         * options.cc (General_options::parse_library): Support -l:filename.
9658         (General_options::parse_just_symbols): Update for Input_file_argument
9659         changes.
9660         (Command_line::process): Likewise.
9661         * archive.cc (Archive::get_file_and_offset): Likewise.
9662         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9663         * script.cc (read_script_file, script_add_file): Likewise.
9664         * fileread.cc (Input_file::Input_file): Likewise.
9665         (Input_file::will_search_for): Handle is_searched_file.
9666         (Input_file::open): Likewise.
9667         * readsyms.cc (Read_symbols::get_name): Likewise.
9668         * testsuite/Makefile.am (searched_file_test): New test.
9669         * testsuite/Makefile.in: Regenerate.
9670         * testsuite/searched_file_test.cc: New file.
9671         * testsuite/searched_file_test_lib.cc: New file.
9672
9673 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9674             Ian Lance Taylor  <iant@google.com>
9675
9676         * descriptor.cc: Include <cstdio> and "binary-io.h".
9677         (Descriptors::open): Open the files in binary mode always.
9678         * script.cc (Lex::get_token): Treat \r as whitespace.
9679
9680 2009-10-09  Ian Lance Taylor  <iant@google.com>
9681
9682         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9683
9684 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9685             Ian Lance Taylor  <iant@google.com>
9686
9687         * configure.ac: Check for readv function also.
9688         * fileread.cc (readv): Define if not HAVE_READV.
9689         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9690         does not exist.
9691         * config.in: Regenerate.
9692         * configure: Regenerate.
9693
9694 2009-10-09  Doug Kwan  <dougkwan@google.com>
9695
9696         * layout.cc (Layout::make_output_section): Call target hook to make
9697         ordinary output section.
9698         (Layout::finalize): Adjust parameter list of call the
9699         Target::may_relax().
9700         * layout.h (class Layout::section_list): New method.
9701         * merge.h (Output_merge_base::entsize): Change visibility to public.
9702         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9703         New methods.
9704         (Output_merge_string::do_is_string): New method.
9705         * object.cc (Sized_relobj::do_setup): renamed from
9706         Sized_relobj::set_up.
9707         * object.h (Sized_relobj::adjust_shndx,
9708         Sized_relobj::initializ_input_to_output_maps,
9709         Sized_relobj::free_input_to_output_maps): Change visibilities to
9710         protected.
9711         (Sized_relobj::setup): Virtualize.
9712         (Sized_relobj::do_setup): New method declaration.
9713         (Sized_relobj::invalidate_section_offset,
9714         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9715         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9716         * options.cc (parse_int): New function.
9717         * options.h (parse_int): New declaration.
9718         (DEFINE_int): New macro.
9719         (stub_group_size): New option.
9720         * output.cc (Output_section::Output_section): Initialize memebers
9721         merge_section_map_, merge_section_by_properties_map_,
9722         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9723         (Output_section::add_input_section): Handled deferred code-fill
9724         generation and remove an old comment.
9725         (Output_section::add_relaxed_input_section): New method definition.
9726         (Output_section::add_merge_input_section): Use merge section by
9727         properties map to speed to search.  Update merge section maps
9728         as appropriate.
9729         (Output_section::build_relaxation_map): New method definition.
9730         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9731         Same.
9732         (Output_section::relax_input_section): Renamed to
9733         Output_section::convert_input_sections_to_relaxed_sections and change
9734         interface to take a vector of pointers to relaxed sections.
9735         (Output_section::find_merge_section,
9736         Output_section::find_relaxed_input_section): New method definitions.
9737         (Output_section::is_input_address_mapped,
9738         Output_section::output_offset, Output_section::output_address):
9739         Use output section data maps to speed up searching.
9740         (Output_section::find_starting_output_address): Add comments.
9741         (Output_section::do_write,
9742         Output_section::write_to_postprocessing_buffer): Do code-fill
9743         generation as appropriate.
9744         (Output_section::get_input_sections): Invalidate relaxed input section
9745         map.
9746         (Output_section::restore_states): Adjust type of checkpoint .
9747         Invalidate relaxed input section map.
9748         * output.h (Output_merge_base): New class declaration.
9749         (Input_section_specifier): New class defintion.
9750         (class Output_relaxed_input_section) Change base class to
9751         Output_section_data_build.
9752         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9753         base class initializer.
9754         (Output_section::add_relaxed_input_section): New method declaration.
9755         (Output_section::Input_section): Change visibility to protected.
9756         (Output_section::Input_section::relobj,
9757         Output_section::Input_section::shndx): Handle relaxed input sections.
9758         Output_section::input_sections) Change visibility to protected.  Also
9759         define overload to return a non-const pointer.
9760         (Output_section::Merge_section_properties): New class defintion.
9761         (Output_section::Merge_section_by_properties_map,
9762         Output_section::Output_section_data_by_input_section_map,
9763         Output_section::Relaxation_map): New types.
9764         (Output_section::relax_input_section): Rename method to
9765         Output_section::convert_input_sections_to_relaxed_sections and change
9766         interface to take a vector of relaxed section pointers.
9767         (Output_section::find_merge_section,
9768         Output_section::find_relaxed_input_section,
9769         Output_section::build_relaxation_map,
9770         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9771         New method declarations.
9772         (Output_section::merge_section_map_
9773         Output_section::merge_section_by_properties_map_,
9774         Output_section::relaxed_input_section_map_,
9775         Output_section::is_relaxed_input_section_map_valid_,
9776         Output_section::generate_code_fills_at_write_): New data members.
9777         * script-sections.cc
9778         (Output_section_element_input::set_section_addresses): Call
9779         current_data_size and addralign methods of relaxed input sections.
9780         (Orphan_output_section::set_section_addresses): Call current_data_size
9781         and addralign methods of relaxed input sections.
9782         * symtab.cc (Symbol_table::compute_final_value): Extract template
9783         from the body of Symbol_table::sized_finalize_symbol.
9784         (Symbol_table::sized_finalized_symbol): Call
9785         Symbol_table::compute_final_value.
9786         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9787         (Symbol_table::compute_final_value): New templated method declaration.
9788         * target.cc (Target::do_make_output_section): New method defintion.
9789         * target.h (Target::make_output_section): New method declaration.
9790         (Target::relax): Add more parameters for input objects, symbol table
9791         and layout.  Adjust call to do_relax.
9792         (Target::do_make_output_section): New method declaration.
9793         (Target::do_relax): Add parameters for input objects, symbol table
9794         and layout.
9795
9796 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9797
9798         * pread.c: Include stdio.h.
9799
9800 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9801
9802         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9803         defined.
9804
9805 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9806
9807         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9808         Change read_shndx type to unsigned int.
9809         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9810         int.
9811         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9812         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9813         Change read_shndx type to unsigned int.
9814         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9815         int.
9816         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9817         * layout.cc (Layout::create_symtab_sections): Cast the result of
9818         local_symcount * symsize to off_t in the gold_assert.
9819
9820 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9821
9822         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9823         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9824         R_ARM_BASE_ABS.
9825         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9826         (Arm_relocate_functions::thm_abs5): New function.
9827         (Arm_relocate_functions::abs12): New function.
9828         (Arm_relocate_functions::abs16): New function.
9829         (Arm_relocate_functions::base_abs): New function.
9830         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9831         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9832         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9833         R_ARM_BASE_ABS.
9834         (Scan::global): Likewise.
9835         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9836         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9837         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9838         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9839         R_ARM_BASE_ABS.
9840
9841 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9842
9843         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9844         (Arm_relocate_functions::movt_prel): New function.
9845         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9846         (Arm_relocate_functions::thm_movt_prel): New function.
9847         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9848         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9849         (Scan::global, Relocate::relocate): Likewise.
9850         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9851
9852 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9853
9854         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9855         Incremental_checker.
9856         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9857         unsigned int.
9858         (class Incremental_inputs_header): New class.
9859         (Incremental_inputs_header_writer): Edit comment.
9860         (Incremental_inputs_entry): New class.
9861         (Incremental_inputs_entry_writer): Edit comment.
9862         (Sized_incremental_binary::do_find_incremental_inputs_section):
9863         Add *strtab_shndx parameter, fill it.
9864         (Sized_incremental_binary::do_check_inputs): New method.
9865         (Incremental_checker::can_incrementally_link_output_file): Use
9866         Sized_incremental_binary::check_inputs.
9867         (Incremental_inputs::report_command_line): Save command line in
9868         command_line_.
9869         * incremental.h:
9870         (Incremental_binary::find_incremental_inputs_section): New
9871         method.
9872         (Incremental_binary::do_find_incremental_inputs_section): Add
9873         strtab_shndx parameter.
9874         (Incremental_binary::do_check_inputs): New pure virtual method.
9875         (Sized_incremental_binary::do_check_inputs): Declare.
9876         (Incremental_checker::Incremental_checker): Add incremental_inputs
9877         parameter, use it to initialize incremental_inputs_.
9878         (Incremental_checker::incremental_inputs_): New field.
9879         (Incremental_checker::command_line): New method.
9880         (Incremental_checker::inputs): New method.
9881         (Incremental_checker::command_line_): New field.
9882
9883 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9884
9885         * incremental.cc: Include <cstdarg> and "target-select.h".
9886         (vexplain_no_incremental): New function.
9887         (explain_no_incremental): New function.
9888         (Incremental_binary::error): New method.
9889         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9890         method.
9891         (make_sized_incremental_binary): New function.
9892         (open_incremental_binary): New function.
9893         (can_incrementally_link_file): Add checks if output is ELF and has
9894         inputs section.
9895         * incremental.h: Include "elfcpp_file.h" and "output.h".
9896         (Incremental_binary): New class.
9897         (Sized_incremental_binary): New class.
9898         (open_incremental_binary): Declare.
9899         * object.cc (is_elf_object): Use
9900         elfcpp::Elf_recognizer::is_elf_file.
9901         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9902         * output.h (Output_file::filesize): New method.
9903
9904 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9905
9906         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9907         New function.
9908         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9909         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9910         function.
9911         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9912         function.
9913         (Arm_relocate_functions::movw_abs_nc): New function.
9914         (Arm_relocate_functions::movt_abs): New function.
9915         (Arm_relocate_functions::thm_movw_abs_nc): New function.
9916         (Arm_relocate_functions::thm_movt_abs): New function.
9917         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
9918         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
9919         (Scan::global): Likewise.
9920         (Relocate::relocate): Likewise.
9921         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9922
9923 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9924
9925         * arm.cc (Arm_relocate_functions::got_prel) New function.
9926         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
9927         (Relocate::relocate): Likewise.
9928         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9929
9930 2009-10-06  Ian Lance Taylor  <iant@google.com>
9931
9932         * options.h (class General_options): Define
9933         split_stack_adjust_size parameter.
9934         * object.h (class Object): Add uses_split_stack_ and
9935         has_no_split_stack_ fields.  Add uses_split_stack and
9936         has_no_split_stack accessor functions.  Declare
9937         handle_split_stack_section.
9938         (class Reloc_symbol_changes): Define.
9939         (class Sized_relobj): Define Function_offsets.  Declare
9940         split_stack_adjust, split_stack_adjust_reltype, and
9941         find_functions.
9942         * object.cc (Object::handle_split_stack_section): New function.
9943         (Sized_relobj::do_layout): Call handle_split_stack_section.
9944         * dynobj.cc (Sized_dynobj::do_layout): Call
9945         handle_split_stack_section.
9946         * reloc.cc (Sized_relobj::relocate_sections): Call
9947         split_stack_adjust for executable sections in split_stack
9948         objects.  Pass reloc_map to relocate_section.
9949         (Sized_relobj::split_stack_adjust): New function.
9950         (Sized_relobj::split_stack_adjust_reltype): New function.
9951         (Sized_relobj::find_functions): New function.
9952         * target-reloc.h: Include "object.h".
9953         (relocate_section): Add reloc_symbol_changes parameter.  Change
9954         all callers.
9955         * target.h (class Target): Add calls_non_split method.  Declare
9956         do_calls_non_split virtual method.  Declare match_view and
9957         set_view_to_nop.
9958         * target.cc: Include "elfcpp.h".
9959         (Target::do_calls_non_split): New function.
9960         (Target::match_view): New function.
9961         (Target::set_view_to_nop): New function.
9962         * gold.cc (queue_middle_tasks): Give an error if mixing
9963         split-stack and non-split-stack objects with -r.
9964         * i386.cc (Target_i386::relocate_section): Add
9965         reloc_symbol_changes parameter.
9966         (Target_i386::do_calls_non_split): New function.
9967         * x86_64.cc (Target_x86_64::relocate_section): Add
9968         reloc_symbol_changes parameter.
9969         (Target_x86_64::do_calls_non_split): New function.
9970         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
9971         parameter.
9972         * powerpc.cc (Target_powerpc::relocate_section): Add
9973         reloc_symbol_changes parameter.
9974         * sparc.cc (Target_sparc::relocate_section): Add
9975         reloc_symbol_changes parameter.
9976         * configure.ac: Call AM_CONDITIONAL for the default target.
9977         * configure: Rebuild.
9978         * testsuite/Makefile.am (TEST_AS): New variable.
9979         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
9980         (check_DATA): Add split_i386 and split_x86_64 files.
9981         (SPLIT_DEFSYMS): Define.
9982         (split_i386_[1234n].o): New targets.
9983         (split_i386_[124]): New targets.
9984         (split_i386_[1234r].stdout): New targets.
9985         (split_x86_64_[1234n].o): New targets.
9986         (split_x86_64_[124]): New targets.
9987         (split_x86_64_[1234r].stdout): New targets.
9988         (MOSTLYCLEANFILES): Add new executables.
9989         * testsuite/split_i386.sh: New file.
9990         * testsuite/split_x86_64.sh: New file.
9991         * testsuite/split_i386_1.s: New file.
9992         * testsuite/split_i386_2.s: New file.
9993         * testsuite/split_i386_3.s: New file.
9994         * testsuite/split_i386_4.s: New file.
9995         * testsuite/split_i386_n.s: New file.
9996         * testsuite/split_x86_64_1.s: New file.
9997         * testsuite/split_x86_64_2.s: New file.
9998         * testsuite/split_x86_64_3.s: New file.
9999         * testsuite/split_x86_64_4.s: New file.
10000         * testsuite/split_x86_64_n.s: New file.
10001         * testsuite/testfile.cc (Target_test): Update relocation_section
10002         function.
10003         * testsuite/Makefile.in: Rebuild.
10004
10005 2009-10-06  Ian Lance Taylor  <iant@google.com>
10006
10007         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10008         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10009         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10010         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10011         the address on ldo_addrs_.
10012         (Target_i386::Relocate::fix_up_ldo): New function.
10013
10014 2009-10-06   Rafael Espindola  <espindola@google.com>
10015
10016         * plugin.cc (add_input_library): New.
10017         (Plugin::load): Add add_input_library to tv.
10018         (Plugin_manager::add_input_file): Add the is_lib argument.
10019         (add_input_file): Update call to Plugin_manager::add_input_file.
10020         (add_input_library): New.
10021         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10022
10023 2009-09-30  Doug Kwan  <dougkwan@google.com>
10024
10025         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10026         symbol and call Symbol::may_need_copy_reloc to determine if
10027         a copy reloc is needed.
10028         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10029         nocopyreloc is given in command line.
10030         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10031         given in command line.
10032         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10033         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10034         of the removed Target_i386::may_need_copy_reloc.
10035         * options.h (copyreloc): New option with default value false.
10036         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10037         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10038         instead of the removed Target_powerpc::may_need_copy_reloc.
10039         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10040         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10041         instead of the removed Target_sparc::may_need_copy_reloc.
10042         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10043         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10044         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10045         instead of the removed Target_x86_64::may_need_copy_reloc.
10046
10047 2009-09-30  Ian Lance Taylor  <iant@google.com>
10048
10049         * object.h (class Object): Remove target_ field, and target,
10050         sized_target, and set_target methods.
10051         (Object::sized_target): Remove.
10052         (class Sized_relobj): Update declarations.  Remove sized_target.
10053         * object.cc (Sized_relobj::setup): Remove target parameter.
10054         Change all callers.
10055         (Input_objects::add_object): Don't do anything with the target.
10056         (make_elf_sized_object): Add punconfigured parameter.  Change all
10057         callers.  Set or test parameter target.
10058         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10059         Change all callers.
10060         * parameters.cc (Parameters::set_target): Change parameter type to
10061         be non-const.
10062         (Parameters::default_target): Remove.
10063         (set_parameters_target): Change parameter type to be non-const.
10064         (parameters_force_valid_target): New function.
10065         (parameters_clear_target): New function.
10066         * parameters.h (class Parameters): Update declarations.  Remove
10067         default_target method.  Add sized_target and clear_target
10068         methods.  Change target_ to be non-const.
10069         (set_parameters_target): Update declaration.
10070         (parameters_force_valid_target): Declare.
10071         (parameters_clear_target): Declare.
10072         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10073         as NULL if we aren't searching.
10074         (Add_symbols::run): Don't check for compatible target.
10075         * fileread.cc (Input_file::open_binary): Call
10076         parameters_force_valid_target.
10077         * gold.cc (queue_middle_tasks): Likewise.
10078         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10079         set_target on object.
10080         * dynobj.h (class Sized_dynobj): Update declarations.
10081         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10082         make_elf_object returns NULL.
10083         (Archive::include_member): Don't check whether object target is
10084         compatible.
10085         * output.cc (Output_section::add_input_section): Get target from
10086         parameters.
10087         (Output_section::relax_input_section): Likewise.
10088         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10089         parameters.
10090         (Sized_relobj::do_scan_relocs): Likewise.
10091         (Sized_relobj::relocate_sections): Likewise.
10092         * resolve.cc (Symbol_table::resolve): Likewise.
10093         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10094         parameter.  Change all callers.
10095         (Symbol_table::add_from_object): Get target from parameters.
10096         (Symbol_table::add_from_relobj): Don't check object target.
10097         (Symbol_table::add_from_dynobj): Likewise.
10098         (Symbol_table::define_special_symbol): Get target from
10099         parameters.
10100         * symtab.h (class Symbol_table): Update declaration.
10101         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10102         parameter.  Change all callers.  Clear parameter target.
10103         (Binary_test): Test target here.
10104         * testsuite/object_unittest.cc (gold_testsuite): Remove
10105         target_test_pointer parameter.  Change all callers.
10106         (Object_test): Test target here.
10107
10108 2009-09-26  Ian Lance Taylor  <iant@google.com>
10109
10110         * testsuite/initpri1.c: Don't try to use constructor priorities if
10111         compiling with gcc before 4.3.
10112
10113 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10114
10115         * testsuite/retain_symbols_file_test.sh (check_present): Change
10116         output file name to retain_symbols_file_test.stdout.
10117         (check_absent): Likewise.
10118
10119 2009-09-18  Craig Silverstein  <csilvers@google.com>
10120
10121         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10122         * options.cc: Include <cerrno> and <fstream>.
10123         (General_options::finalize): Parse -retain-symbols-file tag.
10124         * options.h: New flag.
10125         (General_options): New method should_retain_symbol, new
10126         variable symbols_to_retain.
10127         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10128         should_retain_symbol map.
10129         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10130         * testsuite/Makefile.in: Regenerate.
10131         * testsuite/retain_symbols_file_test.sh: New file.
10132
10133 2009-09-18  Nick Clifton  <nickc@redhat.com>
10134
10135         * po/es.po: Updated Spanish translation.
10136
10137 2009-09-17  Doug Kwan  <dougkwan@google.com>
10138
10139         * debug.h (DEBUG_RELAXATION): New constant.
10140         (DEBUG_ALL): Add DEBUG_RELAXATION.
10141         (debug_string_to_enum): Add relaxation debug option.
10142         * layout.cc
10143         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10144         Layout::Relaxation_debug_check::read_sections,
10145         Layout::Relaxation_debug_check::read_sections): New method definitions.
10146         (Layout::Layout): Initialize data members
10147         record_output_section_data_from_scrips_,
10148         script_output_section_data_list_ and relaxation_debug_check_.
10149         (Layout::save_segments, Layout::restore_segments,
10150         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10151         Layout::relaxation_loop_body): New method definitions.
10152         (Layout::finalize): Support relaxation.  Move section layout code to
10153         Layout::relaxation_loop_body.
10154         (Layout::set_asection_address_from_script): Move code for orphan
10155         section placement out.
10156         (Layout::place_orphan_sections_in_script): New method definition.
10157         * layout.h (Output_segment_headers, Output_file_header):
10158         New forward class declarations.
10159         (Layout::~Layout): Define.
10160         (Layout::new_output_section_data_from_script): New method definition.
10161         (Layout::place_orphan_sections_in_script): New method declaration.
10162         (Layout::Segment_states): New type declaration.
10163         (Layout::save_segments, Layout::restore_segments,
10164         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10165         Layout::relaxation_loop_body): New method declarations.
10166         (Layout::Output_section_data_list): New type declaration.
10167         (Layout::Relaxation_debug_check): New class definition.
10168         (Layout::record_output_section_data_from_script_,
10169         Layout::script_output_section_data_list_, Layout::segment_states_,
10170         Layout::relaxation_debug_check_): New data members.
10171         * output.cc: (Output_section_headers::do_size): New method definition.
10172         (Output_section_headers::Output_section_headers): Move size
10173         computation to Output_section_headers::do_size.
10174         (Output_segment_headers::do_size): New method definition.
10175         (Output_file_header::Output_file_header): Move size computation to
10176         Output_file_header::do_size and call it.
10177         (Output_file_header::do_size): New method definition.
10178         (Output_data_group::Output_data_group): Adjust call to
10179         Output_section_data.
10180         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10181         (Output_symtab_xindex::do_write): Add array bound check.
10182         (Output_section::Input_section::print_to_mapfile): Handle
10183         RELAXED_INPUT_SECTION_CODE.
10184         (Output_section::Output_section): Initialize data member checkpoint_.
10185         (Output_section::~Output_section): Delete checkpoint object pointed
10186         by checkpoint_.
10187         (Output_section::add_input_section): Always add an Input_section if
10188         relaxing.
10189         (Output_section::add_merge_input_section): Add assert.
10190         (Output_section::relax_input_section): New method definition.
10191         (Output_section::set_final_data_size): Set load address to zero for
10192         an unallocated section.
10193         (Output_section::do_address_and_file_offset_have_reset_values):
10194         New method definition.
10195         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10196         Handle relaxed input section.
10197         (Output_section::sort_attached_input_sections): Checkpoint input
10198         section list lazily.
10199         (Output_section::get_input_sections): Change type of input_sections to
10200         list of Simple_input_section pointers.  Checkpoint input section list
10201         lazily.  Also handle relaxed input sections.
10202         (Output_section::add_input_section_for_script): Take a reference to
10203         a Simple_input_section object instead of Relobj pointer and section
10204         index as parameter.  Handle relaxed input sections.
10205         (Output_section::save_states, Output_section::restore_states): New
10206         method definitions.
10207         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10208         (Output_data::is_data_size_fixed): New method definition.
10209         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10210         if it is fixed.
10211         (Output_data::address_and_file_offset_have_reset_values): New method
10212         definition.
10213         (Output_data::do_address_and_file_offset_have_reset_values): New method
10214         definition.
10215         (Output_data::set_data_size): Check that data size is not fixed.
10216         (Output_data::fix_data_size): New method definition.
10217         (Output_data::is_data_size_fixed_): New data member.
10218         (Output_section_headers::set_final_data_size): New method definition.
10219         (Output_section_headers::do_size): New method declaration.
10220         (Output_segment_headers::set_final_data_size): New method definition.
10221         (Output_segment_headers::do_size): New method declaration.
10222         (Output_file_header::set_final_data_size)::New method definition.
10223         (Output_file_header::do_size)::New method declaration.
10224         (Output_section_data::Output_section_data): Add new parameter
10225         is_data_size_fixed and use it to fix data size.
10226         (Output_data_const::Output_data_const): Adjust call to base class
10227         constructor and fix data size.
10228         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10229         base class constructor and fix data size.
10230         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10231         base class constructor and fix data size.
10232         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10233         class constructor and fix data size.
10234         (Output_data_group::set_final_data_size): New method definition.
10235         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10236         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10237         class constructor and fix data size.
10238         (Output_relaxed_input_section): New class definition.
10239         (Output_section::Simple_input_section): New class definition.
10240         (Output_section::get_input_sections): Adjust parameter list.
10241         (Output_section::add_input_section_for_script): Same.
10242         (Output_section::save_states, Output_section::restore_states,
10243         Output_section::do_address_and_file_offset_have_reset_values,
10244         (Output_section::Input_section::Input_section): Handle
10245         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10246         Output_relaxed_input_section.
10247         (Output_section::Input_section::is_input_section,
10248         Output_section::Input_section::set_output_section): Handle relaxed
10249         input section.
10250         (Output_section::Input_section::is_relaxed_input_section,
10251         Output_section::Input_section::output_section_data,
10252         Output_section::Input_section::relaxed_input_section): New method
10253         definitions.
10254         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10255         value.
10256         (Output_section::Input_section::u1_): Update comments.
10257         (Output_section::Input_section::u2_): Add new union member poris.
10258         (Output_section::Checkpoint_output_section): New classs definition.
10259         (Output_section::relax_input_section): New method declaration.
10260         (Output_section::checkpoint_): New data member.
10261         (Output_segment): Update comments.
10262         (Output_segment::Output_segment): Un-privatize copy constructor.
10263         (Output_segment::operator=): Un-privatize.
10264         * script-sections.cc (Output_section_element::Input_section_list):
10265         Change element type to Output_section::Simple_input_section.
10266         (Output_section_element_dot_assignment::set_section_addresses):
10267         Register output section data for relaxation clean up.
10268         (Output_data_exression::Output_data_expression): Adjust call to base
10269         constructor to fix data size.
10270         (Output_section_element_data::set_section_addresses): Register
10271         Output_data_expression object for relaxation clean up.
10272         (struct Input_section_info): Replace Relobj pointer and section index
10273         pair with Output_section::Simple_input_section and Convert struct to a
10274         class.
10275         (Input_section_sorter::operator()): Adjust access to
10276         Input_section_info data member to use accessors.
10277         (Output_section_element_input::set_section_addresses): Use layout
10278         parameter.  Adjust code to use Output_section::Simple_input_section
10279         and Input_secction_info classes.  Register filler for relaxation
10280         clean up.
10281         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10282         and section index pair with Output_section::Simple_input_section
10283         class.  Adjust code accordingly.
10284         (Phdrs_element::release_segment): New method definition.
10285         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10286         segment list.
10287         (Script_sections::release_segments): New method definition.
10288         * gold/script-sections.h (Script_sections::release_segments): New
10289         method declaration.
10290         * gold/target.h (Target::may_relax, Target::relax,
10291         Target::do_may_relax, Target::do_relax): New method definitions.
10292
10293 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10294
10295         * arm.cc (has_signed_unsigned_overflow): New function.
10296         (Arm_relocate_functions::abs8): New function.
10297         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10298         (Target_arm::Scan::global): Likewise.
10299         (Target_arm::relocate::relocate): Likewise.
10300         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10301         Likewise.
10302
10303 2009-09-16  Cary Coutant  <ccoutant@google.com>
10304
10305         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10306         * testsuite/Makefile.in: Regenerate.
10307
10308 2009-09-11  Nick Clifton  <nickc@redhat.com>
10309
10310         * po/gold.pot: Updated by the Translation project.
10311
10312 2009-09-08  Cary Coutant  <ccoutant@google.com>
10313
10314         * output.cc (Output_file::open): Add execute permission to empty file.
10315         * testsuite/Makefile.am (permission_test): New test.
10316         * testsuite/Makefile.in: Regenerate.
10317
10318 2009-09-02  Ian Lance Taylor  <iant@google.com>
10319
10320         * output.cc (Output_file::resize): Call map_no_anonymous rather
10321         than map.
10322
10323 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10324
10325         * gold.cc: Include "incremental.h".
10326         (queue_initial_tasks): Call Incremental_checker methods.
10327         * incremental.cc: Include "output.h".
10328         (Incremental_checker::can_incrementally_link_output_file): New
10329         method.
10330         * incremental.h (Incremental_checker): New class.
10331
10332         * output.cc (Output_file::open_for_modification): New method.
10333         (Output_file::map_anonymous): Changed return type to bool.  Record
10334         map in base_ field.
10335         (Output_file::map_no_anonymous): New method, broken out of map.
10336         (Output_file::map): Use map_no_anonymous and map_anonymous.
10337         * output.h (class Output_file): Update declarations.
10338
10339 2009-08-24  Cary Coutant  <ccoutant@google.com>
10340
10341         * options.h (Command_line::Pre_options): New class.
10342         (Command_line::pre_options): New member.
10343         * options.cc (gold::options::ready_to_register): New variable.
10344         (One_option::register_option): Do nothing if not registering options.
10345         Assert if same short option registered twice.
10346         (General_options::General_options): Turn off option registration when
10347         done constructing.
10348         (Command_line::Pre_options::Pre_options): New constructor.
10349
10350 2009-08-24  Cary Coutant  <ccoutant@google.com>
10351
10352         * options.h (General_options::no_keep_memory): Remove incorrect
10353         short option.
10354
10355 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10356
10357         * Makefile.am (am__skiplex, am__skipyacc): New.
10358         * Makefile.in: Regenerate.
10359
10360 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10361
10362         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10363         (INCLUDES): ... this.
10364         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10365         (AM_CPPFLAGS): Renamed from ...
10366         (INCLUDE): ... this.
10367         * Makefile.in, testsuite/Makefile.in: Regenerate.
10368
10369         * Makefile.in: Regenerate.
10370         * aclocal.m4: Likewise.
10371         * config.in: Likewise.
10372         * configure: Likewise.
10373         * testsuite/Makefile.in: Likewise.
10374
10375         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10376         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10377         * Makefile.in: Regenerate.
10378         * testsuite/Makefile.in: Regenerate.
10379
10380 2009-08-19  Cary Coutant  <ccoutant@google.com>
10381
10382         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10383         symbols in shared libraries overridden by hidden or internal symbols
10384         in the main program.
10385
10386 2009-08-19  Chris Demetriou  <cgd@google.com>
10387
10388         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10389         checking source file names in error messages.
10390
10391 2009-08-18  Doug Kwan  <dougkwan@google.com>
10392
10393         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10394         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10395         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10396         an elfcpp::Ehdr as parameter.
10397         * object.cc (Object::set_target): Remove the version that looks up
10398         a target and sets it.
10399         (Sized_relobj::setup): Take a Target object instead of
10400         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10401         (make_elf_sized_object): Find target and ask target to
10402         make an ELF object.
10403         * object.h: (Object::set_target): Remove the version that looks up
10404         a target and sets it.
10405         (Sized_relobj::setup): Take a Target object instead of
10406         an elfcpp:Ehdr as parameter.
10407         * target.cc: Include dynobj.h.
10408         (Target::do_make_elf_object_implementation): New.
10409         (Target::do_make_elf_object): New.
10410         * target.h (Target::make_elf_object): New template declaration.
10411         (Target::do_make_elf_object): New method declarations.
10412         (Target::do_make_elf_object_implementation): New template declaration.
10413
10414 2009-08-14  Ian Lance Taylor  <iant@google.com>
10415
10416         * gold.h (FUNCTION_NAME): Define.
10417         (gold_unreachable): Use FUNCTION_NAME.
10418
10419 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10420
10421         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10422         symbol in the --keep-unique list is not found.
10423
10424 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10425
10426         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10427         been maked as --keep-unique.
10428         (Icf::unfold_section): New function.
10429         * icf.h (Icf::unfold_section): New function.
10430         * options.h (General_options::keep_unique): New option.
10431         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10432         * testsuite/Makefile.in: Regenerate.
10433         * testsuite/icf_keep_unique_test.sh: New file.
10434         * testsuite/icf_keep_unique_test.cc: New file.
10435
10436 2009-08-12  Cary Coutant  <ccoutant@google.com>
10437
10438         PR 10471
10439         * resolve.cc (Symbol_table::resolve): Check for references from
10440         dynamic objects to hidden and internal symbols.
10441         * testsuite/Makefile.am (hidden_test.sh): New test.
10442         * testsuite/Makefile.in: Regenerate.
10443         * testsuite/hidden_test.sh: New script.
10444         * testsuite/hidden_test_1.c: New test source.
10445         * testsuite/hidden_test_main.c: New test source.
10446
10447 2009-08-11  Doug Kwan  <dougkwan@google.com>
10448
10449         * arm.cc: Update comments.
10450         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10451         segment to locate the .ARM.exidx section if present.
10452
10453 2009-08-09  Doug Kwan  <dougkwan@google.com>
10454
10455         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10456         patch.
10457
10458 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10459         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10460         compiler warnings.
10461
10462 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10463
10464         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10465         valid tls_segment only for non-debug-section relocations.
10466         * testsuite/Makefile.am: Add gc_tls_test.
10467         * testsuite/Makefile.in: Regenerate.
10468         * testsuite/gc_tls_test.cc: New file.
10469         * testsuite/gc_tls_test.sh: New file.
10470
10471 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10472
10473         * icf.cc: New file.
10474         * icf.h: New file.
10475         * Makefile.am (CCFILES): Add icf.cc.
10476         (HFILES): Add icf.h
10477         * Makefile.in: Regenerate.
10478         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10479         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10480         section, symbol and addend information for the relocs.
10481         * gold.cc (queue_middle_tasks): Call identical code folding.
10482         * gold.h: Add defines for multimap.
10483         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10484         to the call of finalize_local_symbols.
10485         * main.cc (main): Create object of class Icf.
10486         * object.cc (Sized_relobj::do_layout): Allow this function to be
10487         called twice during icf.
10488         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10489         to sections marked as identical by icf.
10490         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10491         when available.
10492         (Sized_relobj::do_section_entsize): New function.
10493         * object.h (Object::section_entsize): New function.
10494         (Object::do_section_entsize): New pure virtual function.
10495         (Relobj::finalize_local_symbols): Add new parameter.
10496         (Relobj::do_section_entsize): New function.
10497         * options.h (General_options::icf): New option.
10498         (General_options::icf_iterations): New option.
10499         (General_options::print_icf_sections): New option.
10500         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10501         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10502         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10503         icf.
10504         * symtab.cc (Symbol_table::is_section_folded): New function.
10505         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10506         to sections marked as identical by icf.
10507         * symtab.h (Symbol_table::set_icf): New function.
10508         (Symbol_table::icf): New function.
10509         (Symbol_table::is_section_folded): New function.
10510         (Symbol_table::icf_): New data member.
10511         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10512         * testsuite/Makefile.am: Add commands to build icf_test.
10513         * testsuite/Makefile.in: Regenerate.
10514         * testsuite/icf_test.sh: New file.
10515         * testsuite/icf_test.cc: New file.
10516
10517 2009-07-24  Chris Demetriou  <cgd@google.com>
10518
10519         * layout.cc (is_compressible_debug_section): Fix incorrect
10520         comment about compressed section names.
10521
10522 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10523
10524         PR 10419
10525         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10526
10527 2009-07-16  Ian Lance Taylor  <iant@google.com>
10528
10529         PR 10400
10530         * layout.h: #include <map>.
10531         (class Kept_section): Change from struct to class.  Add accessors
10532         and setters.  Add section size to Comdat_group mapping.  Change
10533         Comdat_group to std::map.  Add is_comdat_ field.  Add
10534         linkonce_size field in union.
10535         (class Layout): Update declaration of find_or_add_kept_section.
10536         Don't declare find_kept_object.
10537         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10538         parameter.  Add object, shndx, is_comdat, and is_group_name
10539         parameters.  Change all callers.  Adjust for new Kept_section.
10540         (Layout::find_kept_object): Remove.
10541         * object.cc (Sized_relobj::include_section_group): Update use of
10542         Kept_section.  Rename secnum to shndx.  Only record
10543         Kept_comdat_section if sections are the same size.
10544         (Sized_relobj::include_linkonce_section): Update use of
10545         Kept_section.  Only record Kept_comdat_section if sections are the
10546         same size.  Set size of linkonce section.
10547         (Sized_relobj::map_to_kept_section): Update call to
10548         get_kept_comdat_section.
10549         * object.h (class Sized_relobj): Rename fields in
10550         Kept_comdat_section to drop trailing underscores; change object
10551         field to Relobj*.  Change Kept_comdat_section_table to store
10552         struct rather than pointer.
10553         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10554         Add kept_object and kept_shndx parameters.  Change all callers.
10555         (Sized_relobj::get_kept_comdat_section): Change return type to
10556         bool.  Add kept_object and kept_shndx parameters.  Change all
10557         callers.
10558         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10559         Layout::find_or_add_kept_section.
10560
10561 2009-07-09  Ian Lance Taylor  <iant@google.com>
10562
10563         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10564         Reserve space in the hash table.
10565
10566 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10567
10568         * fileread.cc (File_read::get_mtime): New method.
10569         * fileread.h (Timespec): New structure.
10570         (File_read::get_mtime): New method.
10571         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10572         Renamed from timestamp_nsec.
10573         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10574         Elf_Xword.
10575         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10576         timestamp_nsec.
10577         (Incremental_inputs::report_archive): Save mtime; style fix.
10578         (Incremental_inputs::report_obejct): Save mtime; style fix.
10579         (Incremental_inputs::report_script): Save mtime; style fix.
10580         (Incremental_inputs::finalize_inputs): Style fix.
10581         (Incremental_inputs::finalize): Style fix.
10582         (Incremental_inputs::create_input_section_data): Store inputs
10583         mtime.
10584         * incremental.h (Incremental_inputs::report_script): Add mtime
10585         argument.
10586         (Incremental_inputs::Input_info::Input_info): Intialize only one
10587         union member.
10588         (Incremental_inputs::Input_info::archive): Move to nameless
10589         union.
10590         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10591         (Incremental_inputs::Input_info::script): Move to nameless union.
10592         (Incremental_inputs::mtime): New field.
10593         * script.cc (read_input_script): Pass file mtime to
10594         Incremental_input.
10595         * script.h (Script_info::inputs): Style fix.
10596
10597 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10598
10599         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10600         instead of 32.
10601
10602 2009-06-24  Ian Lance Taylor  <iant@google.com>
10603
10604         PR 10156
10605         * layout.cc (Layout::choose_output_section): If we find an
10606         existing section, update the flags.
10607         (Layout::create_notes): New function, broken out of
10608         Layout::finalize.
10609         (Layout::finalize): Don't create note sections.
10610         (Layout::create_note): Don't crash if linker script discards
10611         section.
10612         (Layout::create_gold_note): Likewise.
10613         (Layout::create_build_id): Likewise.  Don't set
10614         after_input_sections on the section.
10615         (Layout::create_executable_stack_info): Remove target parameter.
10616         Change caller.
10617         * layout.h (class Layout): Declare create_notes.  Update
10618         declaration of create_executable_stack_info.
10619         * gold.cc (queue_middle_tasks): Call create_notes.
10620         * output.cc (Output_section::update_flags_for_input_section): Move
10621         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10622         invalid.
10623         * output.h (Output_data::mark_address_invalid): New function.
10624         (class Output_section): Only declare, not define,
10625         update_flags_for_input_section.  Remove set_flags.
10626
10627 2009-06-24  Ian Lance Taylor  <iant@google.com>
10628
10629         * script-sections.cc (Output_section_definition::
10630         set_section_addresses): Rename shadowing local load_address to
10631         laddr.
10632
10633 2009-06-24  Ian Lance Taylor  <iant@google.com>
10634
10635         PR 10244
10636         * reloc.cc (relocate_sections): Skip empty relocation sections.
10637
10638 2009-06-23  Ian Lance Taylor  <iant@google.com>
10639
10640         PR 10156
10641         * layout.cc (Layout::create_note): Use choose_output_section
10642         rather than make_output_section.
10643
10644 2009-06-23  Ian Lance Taylor  <iant@google.com>
10645
10646         PR 10237
10647         * options.cc (General_options::parse_V): Set printed_version_.
10648         (General_options::General_options): Initialize printed_version_.
10649         * options.h (class General_options): Add printed_version_ field.
10650         * gold.cc (queue_initial_tasks): If there are no input files,
10651         don't give a fatal error if we printed the version information.
10652         (queue_middle_tasks): If using -r with a shared object, give a
10653         fatal error rather than an ordinary error.
10654
10655 2009-06-23  Ian Lance Taylor  <iant@google.com>
10656
10657         PR 10219
10658         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10659         (Layout::make_output_section): Set have_stabstr_section_ if we see
10660         a .stab*str section.
10661         (Layout::finalize): Call link_stabs_sections.
10662         (Layout::link_stabs_sections): New file.
10663         * layout.h (class Layout): Add have_stabstr_section_ field.
10664         Declare link_stabs_sections.
10665
10666 2009-06-23  Doug Kwan  <dougkwan@google.com>
10667
10668         * Makefile.am (libgold_a_LIBADD): New.
10669         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10670         * Makefile.in: Regenerate.
10671         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10672         * configure: Regenerate.
10673         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10674         * fileread.cc: Include sys/state.h
10675         * gold.h: Declare memmem and strndup if found missing.
10676         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10677
10678 2009-06-23  Ian Lance Taylor  <iant@google.com>
10679
10680         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10681         * configure: Rebuild.
10682
10683 2009-06-23  Ian Lance Taylor  <iant@google.com>
10684
10685         PR 10147
10686         * object.cc (Object::section_contents): Don't try to get a view if
10687         the section has length zero.
10688         (Object::handle_gnu_warning_section): If the section is empty, use
10689         the name of the section as the warning.
10690
10691 2009-06-23  Ian Lance Taylor  <iant@google.com>
10692
10693         PR 10133
10694         * stringpool.h (class Stringpool_template): Add optimize_ field.
10695         (Stringpool_template::set_optimize): New function.
10696         * stringpool.cc (Stringpool_template::Stringpool_template):
10697         Initialize optimize_ field.
10698         (Stringpool_template::set_string_offsets): Test local optimize
10699         fild rather than parameter.
10700         * layout.cc (Layout::Layout): Call set_optimize on the section
10701         name stringpool.
10702
10703 2009-06-22  Ian Lance Taylor  <iant@google.com>
10704
10705         PR 10030
10706         * yyscript.y: Parse TARGET.
10707         * script.cc (script_set_target): New function.
10708         * script-c.h (script_set_target): Declare.
10709         * options.cc (General_options::string_to_object_format): Rename
10710         from string_to_object_format in anonymous namespace.  Change
10711         callers.
10712         * options.h (class General_options): Declare
10713         string_to_object_format.
10714
10715 2009-06-22  Ian Lance Taylor  <iant@google.com>
10716
10717         * script-sections.cc (Script_sections::create_segments): Don't put
10718         program headers in a PT_LOAD segment if -n or -N.
10719
10720 2009-06-22  Ian Lance Taylor  <iant@google.com>
10721
10722         PR 10141
10723         * options.h (class General_options): Add -z lazy and -z now.  Sort
10724         -z options into alphabetical order.
10725         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10726
10727 2009-06-21  Ian Lance Taylor  <iant@google.com>
10728
10729         * layout.cc (Layout::make_output_section): Call
10730         Target::new_output_section.
10731         (Layout::attach_allocated_section_to_segment): Put large section
10732         sections in a separate load segment with the large segment flag
10733         set.
10734         (Layout::segment_precedes): Sort large data segments after other
10735         load segments.
10736         (align_file_offset): New static function.
10737         (Layout::set_segment_offsets): Use align_file_offset.
10738         * output.h (class Output_section): Add is_small_section_ and
10739         is_large_section_ fields.
10740         (Output_section::is_small_section): New function.
10741         (Output_section::set_is_small_section):  New function.
10742         (Output_section::is_large_section): New function.
10743         (Output_section::set_is_large_section): New function.
10744         (Output_section::is_large_data_section): New function.
10745         (class Output_segment): Add is_large_data_segment_ field.
10746         (Output_segment::is_large_data_segment): New function.
10747         (Output_segment::set_is_large_data_segment): New function.
10748         * output.cc (Output_section::Output_section): Initialize new
10749         fields.
10750         (Output_segment::Output_segment): Likewise.
10751         (Output_segment::add_output_section): Add assertion that large
10752         data sections always go in large data segments.  Force small data
10753         sections to the end of the list of data sections.  Force small BSS
10754         sections to the start of the list of BSS sections.  For large BSS
10755         sections to the end of the list of BSS sections.
10756         * symtab.h (class Symbol): Declare is_common_shndx.
10757         (Symbol::is_defined): Check Symbol::is_common_shndx.
10758         (Symbol::is_common): Likewise.
10759         (class Symbol_table): Define enum Commons_section_type.  Update
10760         declarations.  Add small_commons_ and large_commons_ fields.
10761         * symtab.cc (Symbol::is_common_shndx): New function.
10762         (Symbol_table::Symbol_table): Initialize new fields.
10763         (Symbol_table::add_from_object): Put small and large common
10764         symbols in the right list.
10765         (Symbol_table::sized_finalized_symbol): Check
10766         Symbol::is_common_shndx.
10767         (Symbol_table::sized_write_globals): Likewise.
10768         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10769         common symbol lists.  Don't call do_allocate_commons_list if the
10770         list is empty.
10771         (Symbol_table::do_allocate_commons_list): Remove is_tls
10772         parameter.  Add comons_section_type parameter.  Change all
10773         callers.  Handle small and large common symbols.
10774         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10775         Symbol::is_common_shndx.
10776         * resolve.cc (symbol_to_bits): Likewise.
10777         * target.h (Target::small_common_shndx): New function.
10778         (Target::small_common_section_flags): New function.
10779         (Target::large_common_shndx): New function.
10780         (Target::large_common_section_flags): New function.
10781         (Target::new_output_section): New function.
10782         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10783         small_common_section_flags, and large_common_section_flags
10784         fields.
10785         (Target::do_new_output_section): New virtual function.
10786         * arm.cc (Target_arm::arm_info): Initialize new fields.
10787         * i386.cc (Target_i386::i386_info): Likewise.
10788         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10789         Likewise.
10790         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10791         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10792         (Target_x86_64::do_new_output_section): New function.
10793         * configure.ac: Define conditional MCMODEL_MEDIUM.
10794         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10795         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10796         (large_LDFLAGS): Define.
10797         * testsuite/large.c: New file.
10798         * testsuite/testfile.cc (Target_test::test_target_info):
10799         Initialize new fields.
10800         * configure, testsuite/Makefile.in: Rebuild.
10801
10802 2009-06-05  Doug Kwan  <dougkwan@google.com>
10803
10804         * Makefile.am (CCFILES): Add target.cc.
10805         * Makefile.in: Regenerate.
10806         * i386.cc (class Target_i386): Define new virtual method to
10807         override do_is_local_label_name in parent.
10808         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10809         local symbols if --discard-locals or -X is given.
10810         * options.h (class General_options): Declare new options
10811         '--discard-locals' and '-X' for discarding locals.
10812         * target.h (class Target): Define new methods is_local_label_name.
10813         Declare new virtual method do_is_local_label_name.
10814         * target.cc: New file.
10815         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10816         (check_SCRIPTS): Add discard_locals_test.sh.
10817         (check_DATA): Add discard_local_tests.syms.
10818         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10819         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10820         * testsuite/Makefile.in: Regenerate.
10821         * testsuite/discard_locals_test.c: New file.
10822         * testsuite/discard_locals_test.sh: Same.
10823
10824 2009-06-05  Doug Kwan  <dougkwan@google.com>
10825
10826         * object.cc (Sized_relobj::Sized_relobj): Initialize
10827         discarded_eh_frame_shndx_ to -1U.
10828         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10829         section.
10830         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10831         a discarded .eh_frame section.
10832         (Sized_relobj::do_finalize_local_symbols): Ditto.
10833         * object.h (class Sized_relobj): Declare new member
10834         discarded_eh_frame_shndx_.
10835         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10836         (local_labels_test.o, local_labels_test): New rules.
10837         * testsuite/Makefile.in: Regenerate.
10838
10839 2009-06-04  Doug Kwan  <dougkwan@google.com>
10840
10841         * layout.cc (Layout::section_name_mapping): Add mapping for
10842         special ARM sections.
10843
10844 2009-06-03  Doug Kwan  <dougkwan@google.com>
10845
10846         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10847         (utils::has_overflow): Same.
10848
10849 2009-06-03  Ian Lance Taylor  <iant@google.com>
10850
10851         * layout.cc (Layout::section_name_mapping): New array, replacing
10852         Layout::linkonce_mapping.
10853         (Layout::section_name_mapping_count): New variable, replacing
10854         Layout::linkonce_mapping_count.
10855         (Layout::linkonce_output_name): Remove.
10856         (Layout::output_section_name): Rewrite.
10857         * layout.h (class Layout): Rename Linkonce_mapping to
10858         Section_name_mapping, linkonce_mapping to section_name_mapping,
10859         linkonce_mapping_count to section_name_mapping_count.  Don't
10860         declare linkonce_output_name.
10861
10862 2009-06-03  Doug Kwan  <dougkwan@google.com>
10863
10864         * gold/arm.cc (namespace utils): New.
10865         (Target_arm::reloc_is_non_pic): Define new method.
10866         (class Arm_relocate_functions): New.
10867         (Target_arm::Relocate::relocate): Handle relocation types used by
10868         Android.
10869
10870 2009-06-03  Ian Lance Taylor  <iant@google.com>
10871
10872         * arm.cc (Target_arm::scan::global): Use || instead of |.
10873
10874 2009-06-02  Doug Kwan  <dougkwan@google.com>
10875
10876         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10877         issued_non_pic_error_.
10878         (class Target_arm::Scan): Declare new method check_non_pic.
10879         Define new method symbol_needs_plt_entry.
10880         Declare new data member issued_non_pic_error_.
10881         (class Target_arm::Relocate): Declare new method
10882         should_apply_static_reloc.
10883         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10884         (Target_arm::Scan::check_non_pic): Define new method.
10885         (Target_arm::Scan::local): Handle a small subset of reloc types used
10886         by Android.
10887         (Target_arm::Scan::local): Same.
10888         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10889
10890 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10891
10892         * incremental.cc (Incremental_inputs::report_command_line): Filter
10893         out --incremental-* options.
10894
10895 2009-05-29  Doug Kwan  <dougkwan@google.com>
10896
10897         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10898         template class.
10899         (class Target_arm): Update comment.
10900         (Target_arm::Target_arm): Initialize new data members GOT_,
10901         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10902         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10903         and Target_arm::rel_dyn_section.
10904         Declare new_enum Target_arm::Got_type.
10905         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10906         and DYNBSS_.
10907         Update commments for member do_dynsym_value.
10908         (Target_arm::got_size, Target_arm::plt_section,
10909         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10910         new methods inside class defintion.
10911         (Target_arm::got_section): Define new method.
10912         (Target_arm::rel_dyn_section): Same.
10913         (Output_data_plt_arm): New template class.
10914         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
10915         (Output_data_plt_arm:do_adjust_output_section): Define new method.
10916         (Output_data_plt_arm::add_entry): Same.
10917         (Output_data_plt_arm::first_plt_entry): Define new
10918         static data member for PLT instruction template.
10919         (Output_data_plt_arm::plt_entry): Same.
10920         (Output_data_plt_arm::do_write): Define new method.
10921         (Target_arm::make_plt_entry): Same.
10922         (Target_arm::do_finalize_sections): Same.
10923         (Target_arm::do_dynsym_value): Same.
10924
10925 2009-05-28  Doug Kwan  <dougkwan@google.com>
10926
10927         * Makefile.am (TARGETSOURCES): Add arm.cc.
10928         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
10929         * Makefile.in: Regenerate.
10930         * arm.cc: New file.
10931         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
10932
10933 2009-05-26  Doug Kwan  <dougkwan@google.com>
10934
10935         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
10936         (General_options::check_excluded_libs): Strip off directories in
10937         archive name before matching like GNU ld does.
10938         * testsuite/Makefile.am (MOSTLYCLEANFILES,
10939         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
10940         (exclude_libs_test_LDFLAGS): Add linker option
10941         -Wl,--exclude-libs,libexclude_libs_test_3
10942         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
10943         an explicit archive without using -l.
10944         (alt/libexclude_libs_test_3.a): New make rule.
10945         * testsuite/Makefile.in: Regenerate.
10946         * testsuite/exclude_libs_test.c : Declare lib3_default().
10947         (main): Call it.
10948         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
10949         * exclude_libs_test_3.c: New file.
10950
10951 2009-05-26  Nick Clifton  <nickc@redhat.com>
10952
10953         * po/id.po: New Indonesian translation.
10954         * po/gold.pot: Updated template file.
10955
10956 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
10957
10958         * testsuite/Makefile.am: Add -ffunction-sections to compile
10959         gc_comdat_test files.  Add -Wl,--gc-sections to build
10960         gc_comdat_test.
10961         * testsuite/Makefile.in: Regenerate.
10962         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
10963
10964 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
10965
10966         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
10967         kept comdat section was garbage collected.
10968         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
10969         * testsuite/Makefile.in: Regenerate.
10970         * testsuite/gc_comdat_test.sh: New file.
10971         * testsuite/gc_comdat_test_1.cc: New file.
10972         * testsuite/gc_comdat_test_2.cc: New file.
10973
10974 2009-05-19  Doug Kwan  <dougkwan@google.com>
10975
10976         * archive.cc (Archive::Archive): Move constructor from archive.h
10977         to here.  Initialize no_export_.
10978         (Archive::get_elf_object_for_member): Set no_export flag of object.
10979         * archive.h (Archive::Archive): Move constructor body to
10980         archive.cc.
10981         (Archive::no_export): New method.
10982         (Archive::no_export_): New field.
10983         * object.h (Object::Object): Initialize no_export_ to false.
10984         (Object::no_export, Object::set_no_export): New methods.
10985         (Object::no_export_): New field.
10986         * options.cc (General_options::parse_exclude_libs): New method.
10987         (General_options::check_excluded_libs) Same.
10988         * options.h (exclude_libs): New option.
10989         (General_options::check_excluded_libs): New method declaration.
10990         (General_options::excluded_libs_): New field.
10991         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
10992         default or protected visibility if an object has no-export flag set.
10993         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
10994         (check_SCRIPTS): Add exclude_libs_test.sh.
10995         (check_DATA): Add exclude_libs_test.syms.
10996         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
10997         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
10998         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
10999         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11000         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11001         libexclude_libs_test_2.a): New rules.
11002         * testsuite/Makefile.in: Regenerate.
11003         * testsuite/exclude_libs_test.c: New file.
11004         * testsuite/exclude_libs_test.sh: Ditto.
11005         * testsuite/exclude_libs_test_1.c: Ditto.
11006         * testsuite/exclude_libs_test_2.c: Ditto.
11007
11008 2009-05-15  Ian Lance Taylor  <iant@google.com>
11009
11010         * configure.ac: Check for declarations for cases where libiberty.h
11011         checks HAVE_DECL_xxx.
11012         * configure, config.in: Rebuild.
11013
11014 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11015
11016         * gold.h (Incremental_argument_list): Remove (invalid) forward
11017         declaration.
11018         * incremental.cc (Incremental_inputs::report_achive): New method.
11019         (Incremental_inputs::report_object): New method.
11020         (Incremental_inputs::report_script): New method.
11021         (Incremental_inputs::finalize_inputs): New method.
11022         (Incremental_inputs::finalize): Call finalize_inputs().
11023         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11024         Create inputs entries.
11025         * incremental.h (Incremental_input_type): New enum.
11026         (Incremental_inputs::Incremental_input): Initialize new fields.
11027         (Incremental_inputs::report_inputs): New method.
11028         (Incremental_inputs::report_achive): New method.
11029         (Incremental_inputs::report_object): New method.
11030         (Incremental_inputs::report_script): New method.
11031         (Incremental_inputs::finalize_inputs): New method.
11032         (Incremental_inputs::Input_info): New struct.
11033         (Incremental_inputs::Input_info_map): New typedef.
11034         (Incremental_inputs::lock_): New field.
11035         (Incremental_inputs::Inputs_): New field.
11036         (Incremental_inputs::Inputs_map): New field.
11037         * main.cc (main): Call Incremental_input::report_inputs.
11038         * options.h (Input_argument_list): Typedef moved from
11039         Input_arguments.
11040         (Input_file_group::Files): Remove, use ::Input_argument_list.
11041         (Input_file_group::Input_argument_list): Remove, use
11042         ::Input_argument_list.
11043         * plugin.cc (Plugin_manager::add_input_file): Add error in
11044         incremental build.
11045         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11046         functions.
11047         * script.cc (read_input_script): Call
11048         Incremental_input::report_script.
11049         * script.h (Script_info): New class.
11050
11051 2009-04-27  Ian Lance Taylor  <iant@google.com>
11052
11053         * x86_64.cc (do_adjust_output_section): Set entsize to
11054         plt_entry_size.
11055
11056 2009-04-23  Elliott Hughes  <enh@google.com>
11057
11058         * output.cc (Output_file::close): After short writes, continue
11059         writing from the correct offset in the buffer being written.
11060
11061 2009-04-23  Chris Demetriou  <cgd@google.com>
11062
11063         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11064         * configure: Regenerate.
11065         * config.in: Regenerate.
11066         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11067         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11068
11069 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11070
11071         * incremental.cc (Incremental_inputs_header_data): Renamed from
11072         Incremental_input_header_data.
11073         (Incremental_inputs_header_data::data_size): New field.
11074         (Incremental_inputs_header_data::put_input_file_count): Renamed
11075         from input_file_count.
11076         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11077         from command_line_offset.
11078         (Incremental_inputs_header_data::put_reserved): Renamed from
11079         put_reserved.
11080         (Incremental_inputs_entry_data): Renamed from
11081         Incremental_input_entry_data.
11082         (Incremental_inputs_entry_data::data_size): New field.
11083         (Incremental_inputs::report_command_line): New method.
11084         (Incremental_inputs::finalize): New method.
11085         (Incremental_inputs::create_incremental_inputs_data): New method.
11086         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11087         * incremental.h: New file.
11088         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11089         (Layout::finalize): Create incremental inputs section in
11090         incremental builds.
11091         (Layout::create_incremental_info_sections): New method.
11092         * layout.h (Layout::incremental_inputs): New method.
11093         (Layout::create_incremental_info_sections): New method.
11094         (Layout::incremental_inputs_): New field.
11095         * main.cc (main): Notify Incremental_input of the command line.
11096
11097 2009-04-01  Ian Lance Taylor  <iant@google.com>
11098             Mikolaj Zalewski  <mikolajz@google.com>
11099
11100         * gold.h (reserve_unordered_map): Define, three versions, one for
11101         each version of Unordered_map.
11102         * layout.cc (Layout::Layout): Remove options parameter.  Add
11103         number_of_input_files parameter.  Don't initialize options_.
11104         Initialize number_of_input_files_ and resized_signatures_.  Move
11105         sections_are_attached_.
11106         (Layout::layout_group): Reserve space for group_signatures_.
11107         (Layout::find_or_add_kept_section): Change name parameter to be a
11108         reference.  Resize signatures_ map when it gets large enough.
11109         (Layout::layout_eh_frame): Use parameters->options() instead of
11110         this->options_.
11111         (Layout::make_output_section): Likewise.
11112         (Layout::attach_allocated_section_to_segment): Likewise.
11113         (Layout::finalize, Layout::create_executable_stack): Likewise.
11114         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11115         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11116         * layout.h (class Layout): Update declarations.  Remove options_
11117         field.  Add number_of_input_files_ and resized_signatures_
11118         fields.  Move sections_are_attached_ field.
11119         * main.cc (main): Pass number of input files to Layout
11120         constructor.  Don't pass options.
11121
11122 2009-03-30  Ian Lance Taylor  <iant@google.com>
11123
11124         * ffsll.c (ffsll): Correct implementation.
11125
11126 2009-03-27  Ian Lance Taylor  <iant@google.com>
11127
11128         * ffsll.c: New file.
11129         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11130         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11131         * ftruncate.c (ftruncate): Declare before definition.
11132         * mremap.c (mremap): Likewise.
11133         * pread.c (pread): Likewise.
11134         * configure, Makefile.in, config.in: Rebuild.
11135
11136         * mremap.c: New file.
11137         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11138         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11139         (mremap): Declare if HAVE_MREMAP is not defined.
11140         * configure, Makefile.in, config.in: Rebuild.
11141
11142 2009-03-27  Cary Coutant  <ccoutant@google.com>
11143
11144         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11145         position independent.
11146         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11147         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11148
11149 2009-03-24  Cary Coutant  <ccoutant@google.com>
11150
11151         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11152         an executable.
11153         (needs_dynamic_reloc): Likewise.
11154
11155 2009-03-24  Ian Lance Taylor  <iant@google.com>
11156
11157         * yyscript.y (file_cmd): Recognize EXTERN.
11158         (extern_name_list, extern_name_list_body): New nonterminals.
11159         * script.cc (script_add_extern): Define.
11160         * script-c.h (script_add_extern): Declare.
11161
11162 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11163
11164         * object.cc (is_elf_object): Define.
11165         * object.h (is_elf_object): Declare.
11166         * archive.cc (Archive::get_elf_object_for_member): Call
11167         is_elf_object.
11168         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11169
11170 2009-03-24  Elliott Hughes  <enh@google.com>
11171
11172         * output.cc (Output_file::map_anonymous): Define.
11173         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11174         try an anonymous one.  Report the size if the mmap fails.
11175         * output.h (class Output_file): Declare map_anonymous.
11176
11177 2009-03-24  Ian Lance Taylor  <iant@google.com>
11178
11179         * target-select.cc (instantiate_target): Don't acquire the lock if
11180         the instantiated_target_ field has already been set.
11181
11182 2009-03-23  Ian Lance Taylor  <iant@google.com>
11183
11184         * gold-threads.h (class Initialize_lock): Define.
11185         * gold-threads.cc (class Initialize_lock_once): Define.
11186         (initialize_lock_control): New static variable.
11187         (initialize_lock_pointer): New static variable.
11188         (initialize_lock_once): New static function.
11189         (Initialize_lock::Initialize_lock): Define.
11190         (Initialize_lock::initialize): Define.
11191         * target-select.h: Include "gold-threads.h".
11192         (class Target_selector): Add lock_ and initialize_lock_ fields.
11193         Don't define instantiate_target, just declare it.
11194         * target-select.cc (Target_selector::Target_selector): Initialize
11195         new fields.
11196         (Target_selector::instantiate_target): Define.
11197         * descriptors.h: Include "gold-threads.h".
11198         (class Descriptors): Add initialize_lock_ field.
11199         * descriptors.cc (Descriptors::Descriptors): Initialize new
11200         field.
11201         (Descriptors::open): Use initialize_lock_ field
11202         * errors.h (class Errors): Add initialize_lock_ field.
11203         * errors.cc (Errors::Errors): Initialize new field.
11204         (Errors::initialize_lock): Use initialize_lock_ field.
11205         * powerpc.cc (class Target_selector_powerpc): Remove
11206         instantiated_target_ field.  In do_recognize call
11207         instantiate_target rather than do_instantiate_target.  In
11208         do_instantiate_target just allocate a new target.
11209         * sparc.cc (class Target_selector_sparc): Likewise.
11210
11211         * freebsd.h: New file.
11212         * i386.cc: Include "freebsd.h".
11213         (Target_i386): Derive from Target_freebsd rather than
11214         Sized_target.
11215         (Target_selector_i386): Derive from Target_selector_freebsd rather
11216         than Target_selector.
11217         * x86_64.cc: Include "freebsd.h".
11218         (Target_x86_64): Derive from Target_freebsd rather than
11219         Sized_target.
11220         (Target_selector_x86_64): Derive from Target_selector_freebsd
11221         rather than Target_selector.
11222         * target.h (class Target): Add adjust_elf_header and
11223         do_adjust_elf_header.
11224         * output.cc (Output_file_header:: do_sized_write): Call target
11225         adjust_elf_header routine.
11226         * configure.tgt: Set targ_osabi.
11227         * configure.ac: Define GOLD_DEFAULT_OSABI.
11228         * parameters.cc (Parameters::default_target): Pass
11229         GOLD_DEFAULT_OSABI to select_target.
11230         * target-select.h (class Target_selector): Make instantiate_target
11231         protected rather than private.
11232         * Makefile.am (HFILES): Add freebsd.h.
11233         * configure, Makefile.in, config.in: Rebuild.
11234
11235         * merge.cc (do_add_input_section): Correct pend value.  Change
11236         message about last entry not being null terminated from error to
11237         warning.
11238
11239 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11240
11241         * incremental.cc: New file.
11242         * Makefile.am (CCFILES): Add incremental.cc.
11243         * Makefile.in: Rebuild.
11244
11245 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11246
11247         * layout.cc (Layout::output_section_name): Preserve names
11248         of '.note.' sections.
11249
11250 2009-03-19  Ian Lance Taylor  <iant@google.com>
11251
11252         * descriptors.cc (Descriptors::open): Check that the options are
11253         valid before using them.
11254
11255 2009-03-18  Ian Lance Taylor  <iant@google.com>
11256
11257         * script-sections.h: Include <list>.
11258         (class Script_sections): Change Sections_elements from std::vector
11259         to std::list.  Typedef public Elements_iterator.  Add
11260         orphan_section_placement_, data_segment_align_start_, and
11261         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11262         field.
11263         * script-sections.cc (class Orphan_section_placement): New class.
11264         (class Sections_element): Add virtual functions is_relro and
11265         orphan_section_init.  Remove virtual function place_orphan_here.
11266         (class Output_section_definition): Add is_relro and
11267         orphan_section_init.  Remove place_orphan_here.
11268         (class Orphan_output_section): Likewise.
11269         (Script_sections::Script_sections): Update for field changes.
11270         (Script_sections::data_segment_align): Set saw_data_segment_align_
11271         and data_segment_align_start_, not data_segment_align_index.
11272         (Script_sections::data_segment_relro_end): Check
11273         saw_data_segment_align_.  Use data_segment_align_start_ rather
11274         than data_segment_align_index_.
11275         (Script_sections::place_orphan): Rewrite to use
11276         Orphan_section_placement.
11277
11278 2009-03-17  Ian Lance Taylor  <iant@google.com>
11279
11280         * archive.cc (Archive::add_symbols): Check for a version attached
11281         to the symbol name in the archive map.
11282         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11283         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11284         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11285         (ver_test_11.a): New target.
11286         * testsuite/Makefile.in: Rebuild.
11287
11288         * configure.ac: Check for chsize and posix_fallocate.  Replace
11289         ftruncate.
11290         * ftruncate.c: New file, from gnulib.
11291         * output.cc (posix_fallocate): Define dummy version if not
11292         HAVE_POSIX_FALLOCATE.
11293         (Output_file::map): Call posix_fallocate rather than lseek and
11294         write.
11295         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11296         * configure, Makefile.in, config.in: Rebuild.
11297
11298 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11299
11300         * layout.h (Layout::create_note): Add section_name parameter.
11301         * layout.cc (Layout::create_note): Likewise.
11302         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11303
11304 2009-03-17  Ian Lance Taylor  <iant@google.com>
11305
11306         * descriptors.cc: Include "options.h".
11307         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11308         (Descriptors::open): Always use O_CLOEXEC when opening a new
11309         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11310         then set FD_CLOEXEC.
11311
11312         * sparc.cc (class Target_sparc): Add has_got_section.
11313         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11314         make sure we have a GOT section.
11315
11316         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11317         (Target_sparc::Scan::local): Likewise.
11318         (Target_sparc::Scan::global): Likewise.
11319         (Target_sparc::Relocate::relocate): Likewise.
11320         (Target_sparc::Relocate::relocate_tls): Likewise.
11321
11322         * symtab.cc (Symbol_table::define_default_version): New function,
11323         broken out of add_from_object.
11324         (Symbol_table::add_from_object): Call define_default_version.
11325         (Symbol_table::define_special_symbol): Add resolve_oldsym
11326         parameter.  Change all callers.  If the version for a symbol comes
11327         from a version script, resolve it with the symbol with the same
11328         name with no version.  Also add the symbol without a version if
11329         appropriate.
11330         (do_define_in_output_data): If resolving with oldsym, don't delete
11331         sym.
11332         (do_define_in_output_segment): Likewise.
11333         (do_define_as_constant): Likewise.
11334         * symtab.h (class Symbol_table): Update declarations.
11335
11336 2009-03-13  Ian Lance Taylor  <iant@google.com>
11337
11338         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11339         (Read_symbols::requeue): New function.
11340         (Read_symbols::do_read_symbols): If make_elf_object fails because
11341         the target type is not configured, and the file was searched for,
11342         issue a warning and retry with the next directory.
11343         (Add_symbols::run): If the file has an incompatible format, and
11344         it was searched for, requeue the Read_symbols task.  On error,
11345         release the object.
11346         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11347         dirindex parameter to constructor.  Change all callers.  Declare
11348         incompatible_warning and requeue.
11349         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11350         input_argument_ and input_group_ fields.  Add them to
11351         constructor.  Change all callers.
11352         (class Read_script): Add dirindex_ field.  Add it to constructor.
11353         Change all callers.
11354         * archive.cc (Archive::setup): Remove input_objects parameter.
11355         Change all callers.
11356         (Archive::get_file_and_offset): Likewise.
11357         (Archive::read_all_symbols): Likewise.
11358         (Archive::read_symbols): Likewise.
11359         (Archive::get_elf_object_for_member): Remove input_objects
11360         parameter.  Add punconfigured parameter.  Change all callers.
11361         (Archive::add_symbols): Change return type to bool.  Check return
11362         value of include_member.
11363         (Archive::include_all_members): Likewise.
11364         (Archive::include_member): Change return type to bool.  Return
11365         false if first included object has incompatible target.  Set
11366         included_member_ field.
11367         (Add_archive_symbols::run): If add_symbols returns false, requeue
11368         Read_symbols task.
11369         * archive.h (class Archive): Add included_member_ field.
11370         Initialize it in constructor.  Add input_file and searched_for
11371         methods.  Update declarations.
11372         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11373         input_argument_ fields.  Add them to constructor.  Change all
11374         callers.
11375         * script.cc: Include "target-select.h".
11376         (class Parser_closure): Add skip_on_incompatible_target_ and
11377         found_incompatible_target_ fields.  Add
11378         skip_on_incompatible_target parameter to constructor.  Change all
11379         callers.  Add methods skip_on_incompatible_target,
11380         clear_skip_on_incompatible_target, found_incompatible_target, and
11381         set_found_incompatible_target.
11382         (read_input_script): Add dirindex parameter.  Change all callers.
11383         If parser finds an incompatible target, requeue Read_symbols
11384         task.
11385         (script_set_symbol): Clear skip_on_incompatible_target in
11386         closure.
11387         (script_add_assertion, script_parse_option): Likewise.
11388         (script_start_sections, script_add_phdr): Likewise.
11389         (script_check_output_format): New function.
11390         * script.h (read_input_script): Update declaration.
11391         * script-c.h (script_check_output_format): Declare.
11392         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11393         (ignore_cmd): Remove OUTPUT_FORMAT.
11394         * fileread.cc (Input_file::Input_file): Add explicit this.
11395         (Input_file::will_search_for): New function.
11396         (Input_file::open): Add pindex parameter.  Change all callers.
11397         * fileread.h (class Input_file): Add input_file_argument method.
11398         Declare will_search_for.  Update declarations.
11399         * object.cc (make_elf_object): Add punconfigured parameter.
11400         Change all callers.
11401         * object.h (class Object): Make input_file public.  Add
11402         searched_for method.
11403         (make_elf_object): Update declaration.
11404         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11405         restart search.
11406         * dirsearch.h (class Dirsearch): Update declaration.
11407         * options.h (class General_options): Add --warn-search-mismatch.
11408         * parameters.cc (Parameters::is_compatible_target): New function.
11409         * parameters.h (class Parameters): Declare is_compatible_target.
11410         * workqueue.cc (Workqueue::add_blocker): New function.
11411         * workqueue.h (class Workqueue): Declare add_blocker.
11412
11413         * fileread.cc (Input_file::open): Remove options parameter.
11414         Change all callers.
11415         (Input_file::open_binary): Likewise.
11416         * script.cc (read_input_script): Likewise.
11417         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11418         options parameter from constructor.  Change all callers.
11419         (class Read_script): Likewise.
11420         * fileread.h (class Input_file): Update declarations.
11421         * script.h (read_input_script): Update declaration.
11422
11423 2009-03-10  Nick Clifton  <nickc@redhat.com>
11424
11425         * po/es.po: New Spanish translation.
11426
11427 2009-03-06  Cary Coutant  <ccoutant@google.com>
11428
11429         * options.cc (parse_short_option): Keep dash_z from registering itself.
11430
11431 2009-03-03  Ian Lance Taylor  <iant@google.com>
11432
11433         PR 9918
11434         * target-reloc.h (relocate_section): Pass output_section to
11435         relocate.
11436         * i386.cc (Target_i386::should_apply_static_reloc): Add
11437         output_section parameter.  Change all callers.
11438         (Target_i386::Relocate::relocate): Add output_section parameter.
11439         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11440         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11441         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11442         * testsuite/two_file_shared.sh: New script.
11443         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11444         (check_DATA): Add two_file_shared.dbg.
11445         (two_file_shared.dbg): New target.
11446         * testsuite/Makefile.in: Rebuild.
11447
11448 2009-03-01  Ian Lance Taylor  <iant@google.com>
11449
11450         * configure.ac: Check for byteswap.h.
11451         * configure: Rebuild.
11452         * config.in: Rebuild.
11453
11454 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11455
11456         * layout.cc (Layout::find_or_add_kept_section): New function.
11457         (Layout::add_comdat): Removed.
11458         * layout.h (struct Kept_section): Move out of class Layout.
11459         Remove trailing underscores from field names.  Add group_sections
11460         field.  Rename group_ field to is_group.  Change all uses.
11461         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11462         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11463         comdat_groups_ field.
11464         (Sized_relobj::include_section_group): Use
11465         find_or_add_kept_section and Kept_section::group_sections.
11466         (Sized_relobj::include_linkonce_section): Likewise.
11467         * object.cc (class Sized_relobj): Don't define Comdat_group or
11468         Comdat_group_table.  Remove find_comdat_group and
11469         add_comdat_group.  Remove comdat_groups_ field.
11470         * plugin.cc (include_comdat_group): Use
11471         Layout::find_or_add_kept_section.
11472
11473 2009-02-28  Ian Lance Taylor  <iant@google.com>
11474
11475         * README: --gc-sections and map files are now supported.  Document
11476         some build requirements.
11477
11478         PR 6992
11479         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11480         relocatable link set the value of the section symbol to zero.
11481         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11482         relocatable link don't include the section address in the local
11483         symbol value.
11484
11485 2009-02-27  Ian Lance Taylor  <iant@google.com>
11486
11487         PR 6811
11488         * options.h (class Search_directory): Add is_system_directory.
11489         (class General_options): Declare is_in_system_directory.
11490         * options.cc (get_relative_sysroot): Make static.
11491         (get_default_sysroot): Make static.
11492         (General_optoins::is_in_system_directory): New function.
11493         * fileread.cc (Input_file::is_in_system_directory): New function.
11494         * fileread.h (class Input_file): Declare is_in_system_directory.
11495         * object.h (class Object): Add is_in_system_directory.
11496         (class Input_objects): Remove system_library_directory_ field.
11497         * object.cc (Input_objects::add_object): Don't set
11498         system_library_directory_.
11499         (input_objects::found_in_system_library_directory): Remove.
11500         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11501         parameter.  Change all callers.
11502         (Symbol_table::sized_write_globals): Likewise.
11503         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11504         Call Object::is_in_system_directory.
11505         * symtab.h (class Symbol_table): Update declarations.
11506
11507         PR 5990
11508         * descriptors.h (Open_descriptor): Add is_on_stack field.
11509         * descriptors.cc (Descriptors::open): If the descriptor is on the
11510         top of the stack, remove it.  Initialize is_on_stack field.
11511         (Descriptors::release): Only add pod to stack if it is not on the
11512         stack already.
11513         (Descriptors::close_some_descriptor): Clear stack_next and
11514         is_on_stack fields.
11515
11516         PR 7091
11517         * output.cc (Output_section::find_starting_output_address): Rename
11518         from starting_output_address; add PADDR parameter; change return
11519         type.
11520         * output.h (class Output_section): Declare
11521         find_starting_output_address instead of starting_output_address.
11522         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11523         section symbol for which we can't find a merge section.
11524
11525         PR 9836
11526         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11527         hidden or internal, force the symbol to be local.
11528         * resolve.cc (Symbol::override_visibility): Define.
11529         (Symbol::override_base): Use override_visibility.
11530         (Symbol_table::resolve): Likewise.
11531         (Symbol::override_base_with_special): Likewise.
11532         (Symbol_table::override_with_special): If the visibility is hidden
11533         or internal, force the symbol to be local.
11534         * symtab.h (class Symbol): Add set_visibility and
11535         override_visibility.
11536         * testsuite/ver_test_1.sh: New file.
11537         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11538         (check_DATA): Add ver_test_1.syms.
11539         (ver_test_1.syms): New target.
11540         * testsuite/Makefile.in: Rebuild.
11541
11542 2009-02-25  Cary Coutant  <ccoutant@google.com>
11543
11544         * layout.cc (Layout::choose_output_section): Don't rename sections
11545         when using a linker script that has a SECTIONS clause.
11546         * Makefile.in: Regenerate.
11547
11548         * testsuite/Makefile.am (script_test_5.sh): New test case.
11549         * testsuite/Makefile.in: Regenerate.
11550         * testsuite/script_test_5.cc: New file.
11551         * testsuite/script_test_5.sh: New file.
11552         * testsuite/script_test_5.t: New file.
11553
11554 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11555
11556         * archive.cc (Archive::include_member): Update calls to add_symbols.
11557         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11558         the Layout argument.
11559         * dynobj.h (do_add_symbols): Add the Layout argument.
11560         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11561         Layout argument.
11562         * object.h (Object::add_symbols): Add the Layout argument.
11563         (Object::do_add_symbols): Add the Layout argument.
11564         (Sized_relobj::do_add_symbols): Add the Layout argument.
11565         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11566         Unify the two versions.
11567         (Add_plugin_symbols): Remove.
11568         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11569         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11570         (Add_plugin_symbols): Remove.
11571         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11572         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11573         (Add_symbols::run): Make it work with Pulginobj.
11574
11575 2009-02-06  Ian Lance Taylor  <iant@google.com>
11576
11577         * object.cc (Sized_relobj::do_layout): Make info message start
11578         with lower case letter.
11579
11580 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11581
11582         * binary.cc: Fix file comment.
11583
11584         * options.h (enum Incremental_disposition): Define.
11585         (class General_options): Add new options: --incremental,
11586         --incremental_changed, --incremental_unchanged,
11587         --incremental_unknown.  Add incremental_disposition_ and
11588         implicit_incremental_ fields.
11589         (General_options::incremental_disposition): New function.
11590         (class Position_dependent_options): Add incremental_disposition
11591         option.
11592         (Position_dependent_options::copy_from_options): Set incremental
11593         dispositions.
11594         * options.cc (General_options::parse_incremental_changed): New
11595         function.
11596         (General_options::parse_incremental_unchanged): New function.
11597         (General_options::parse_incremental_unknown): New function.
11598         (General_options::General_options): Initialize new fields
11599         incremental_disposition_ and implicit_incremental_.
11600         (General_options::finalize): Check for uasge of --incremental-*
11601         without --incremental.
11602
11603 2009-02-06  Chris Demetriou  <cgd@google.com>
11604
11605         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11606         pointer and to report location as the file name associated with
11607         the symbol.
11608         (gold_undefined_symbol_at_location): New function to replace the
11609         old gold_undefined_symbol functionality.
11610         * target-reloc.h (relocate_section): Update to use
11611         gold_undefined_symbol_at_location.
11612         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11613         Call gold_undefined_symbol function rather than gold_error.
11614         * errors.h (Errors::undefined_symbol): Take location as a
11615         string, rather than calculating it from a relocation.
11616         * errors.cc (Errors::fatal): Print "fatal error:" before the
11617         formatted message.
11618         (Errors::error, Errors::error_at_location): Print "error: "
11619         before the formatted message.
11620         (Errors::undefined_symbol): Take location as a string, rather
11621         than calculating it from a relocation.
11622         (gold_undefined_symbol_at_location): New function akin to
11623         old gold_undefined_symbol, calculates location from relocation.
11624         (gold_undefined_symbol): Change to take only a Symbol pointer
11625         and to report location as the file name associated with the symbol.
11626         * testsuite/debug_msg.sh: Update for changed error messages.
11627         * testsuite/undef_symbol.sh: Likewise.
11628
11629 2009-02-04  Duncan Sands  <baldrick@free.fr>
11630
11631         PR 9812
11632         * reduced_debug_output.h
11633         (Output_reduced_debug_abbrev_section::failed): Use format for
11634         gold_warning.
11635         (Output_reduced_debug_info_section::faild): Likewise.
11636
11637 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11638
11639         * script.cc (Lazy_demangler): New class.
11640         (Version_script_info::get_symbol_version_helper): Demangle a
11641         symbol only once.
11642
11643 2009-01-29  Cary Coutant  <ccoutant@google.com>
11644
11645         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11646         to __tls_get_addr.
11647         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11648
11649 2009-01-28  Ian Lance Taylor  <iant@google.com>
11650
11651         * version.cc (version_string): Bump to 1.9.
11652
11653         * gold.h: Include <cstring> and <stdint.h>.
11654         * version.cc: Include <cstdio>.
11655         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11656         warning.
11657         * reduced_debug_output.cc (insert_into_vector): Rename from
11658         Insert_into_vector; change all callers.  Use Swap_unaligned to
11659         avoid aliasing issue; remove union since it is unnecessary.
11660
11661 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11662
11663         * Makefile.am (CCFILES): Add gc.cc.
11664         (HFILES): Add gc.h.
11665         * Makefile.in: Regenerate.
11666         * gold.cc (Gc_runner): New class.
11667         (queue_initial_tasks): Call garbage collection related tasks
11668         when corresponding options are invoked.
11669         (queue_middle_gc_tasks): New function.
11670         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11671         processed early before laying out sections during garbage collection.
11672         * gold.h (queue_middle_gc_tasks): New function.
11673         (is_prefix_of): Move from "layout.cc".
11674         * i386.cc (Target_i386::gc_process_relocs): New function.
11675         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11676         * main.cc (main): Create object of class "Garbage_collection".
11677         * object.cc (Relobj::copy_symbols_data): New function.
11678         (Relobj::is_section_name_included): New function.
11679         (Sized_relobj::do_layout): Allow this function to be called twice
11680         during garbage collection and defer layout of section during the
11681         first call.
11682         * object.h (Relobj::get_symbols_data): New function.
11683         (Relobj::is_section_name_included): New function.
11684         (Relobj::copy_symbols_data): New function.
11685         (Relobj::set_symbols_data): New function.
11686         (Relobj::get_relocs_data): New function.
11687         (Relobj::set_relocs_data): New function.
11688         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11689         (Relobj::gc_process_relocs): New function.
11690         (Relobj::do_gc_process_relocs): New pure virtual function.
11691         (Relobj::sd_): New data member.
11692         (Sized_relobj::is_output_section_offset_invalid): New function.
11693         (Sized_relobj::do_gc_process_relocs): New function.
11694         * options.h (General_options::gc_sections): Modify to not be a no-op.
11695         (General_options::print_gc_sections): New option.
11696         * plugin.cc (Plugin_finish::run): Remove function call to
11697         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11698         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11699         * reloc.cc (Read_relocs::run): Add task to process relocs and
11700         determine unreferenced sections when doing garbage collection.
11701         (Gc_process_relocs): New class.
11702         (Sized_relobj::do_gc_process_relocs): New function.
11703         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11704         sections that are garbage collected.
11705         * reloc.h (Gc_process_relocs): New class.
11706         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11707         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11708         symbols whose corresponding sections are garbage collected.
11709         (Symbol_table::Symbol_table): Add new parameter for the garbage
11710         collection object.
11711         (Symbol_table::gc_mark_undef_symbols): New function.
11712         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11713         (Symbol_table::gc_mark_dyn_syms): New function.
11714         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11715         as garbage.
11716         (Symbol_table::add_from_object): Likewise.
11717         (Symbol_table::add_from_relobj): When building shared objects, do not
11718         treat externally visible symbols as garbage.
11719         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11720         table information for static and relocatable links.
11721         * symtab.h (Symbol_table::set_gc): New function.
11722         (Symbol_table::gc): New function.
11723         (Symbol_table::gc_mark_undef_symbols): New function.
11724         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11725         (Symbol_table::gc_mark_dyn_syms): New function.
11726         (Symbol_table::gc_): New data member.
11727         * target.h (Sized_target::gc_process_relocs): New pure virtual
11728         function.
11729         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11730         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11731
11732 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11733
11734         * options.h (General_options::gc_sections): Define as a no-op for now.
11735         (General_options::no_keep_memory): Ditto.
11736         (General_options::Bshareable): Define.
11737         * options.cc (General_options::finalize): Honor -Bshareable.
11738
11739 2009-01-20  Andreas Schwab  <schwab@suse.de>
11740
11741         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11742         read the value in the contents, since we don't use it.  Use the
11743         template endianness when writing.
11744         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11745
11746 2009-01-19  Andreas Schwab  <schwab@suse.de>
11747
11748         * configure.tgt (powerpc64-*): Fix targ_obj.
11749
11750 2009-01-15  Ian Lance Taylor  <iant@google.com>
11751
11752         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11753         local symbols when stripping all symbols.
11754
11755 2009-01-14  Cary Coutant  <ccoutant@google.com>
11756
11757         * output.cc (Output_reloc): Add explicit instantiations.
11758
11759 2009-01-14  Cary Coutant  <ccoutant@google.com>
11760
11761         * archive.cc (Archive::get_elf_object_for_member): Remove call
11762         to File_read::claim_for_plugin.
11763         * descriptors.cc (Descriptors::open): Remove reference to
11764         is_claimed.
11765         (Descriptors::claim_for_plugin): Remove.
11766         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11767         (Descriptors::is_claimed): Remove.
11768         (claim_descriptor_for_plugin): Remove.
11769         * fileread.cc (File_read::claim_for_plugin): Remove.
11770         * fileread.h (File_read::claim_for_plugin): Remove.
11771         (File_read::descriptor): Reopen descriptor if necessary.
11772         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11773         (Plugin_manager::all_symbols_read): Add task parameter. Change
11774         all callers.
11775         (Plugin_manager::get_input_file): New function.
11776         (Plugin_manager::release_input_file): New function.
11777         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11778         corresponding data member.
11779         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11780         and pass to base constructor. Change all callers.
11781         (get_input_file, release_input_file): New functions.
11782         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11783         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11784         (Plugin_manager::all_symbols_read): Add task parameter.
11785         (Plugin_manager::get_input_file): New function.
11786         (Plugin_manager::release_input_file): New function.
11787         (Plugin_manager::task_): New data member.
11788         (Pluginobj::Pluginobj): Add filesize parameter.
11789         (Pluginobj::filename): New function.
11790         (Pluginobj::descriptor): New function.
11791         (Pluginobj::filesize): New function.
11792         (Pluginobj::filesize_): New data member.
11793         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11794         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11795         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11796
11797         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11798         with archive libraries.
11799         * testsuite/Makefile.in: Regenerate.
11800         * testsuite/plugin_test.c (struct sym_info): New type.
11801         (get_input_file, release_input_file): New static variables.
11802         (onload): Capture new transfer vector entries.
11803         (claim_file_hook): Stop reading at end of file according to filesize.
11804         Factor out parsing of readelf output into separate function.
11805         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11806         APIs and get the source file name from the symbol table.  Convert
11807         source file name to corresponding object file name.  Print info
11808         message when adding new input files.
11809         (parse_readelf_line): New function.
11810         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11811         * testsuite/plugin_test_2.sh: Likewise.
11812         * testsuite/plugin_test_3.sh: Likewise.
11813         * testsuite/plugin_test_4.sh: New test case.
11814
11815 2009-01-07  Ian Lance Taylor  <iant@google.com>
11816
11817         * version.cc (version_string): Bump to 1.8.
11818
11819 2008-12-23  Cary Coutant  <ccoutant@google.com>
11820
11821         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11822         * plugin.cc (Plugin_manager::finish): Rename as
11823         layout_deferred_objects.  Move cleanup to separate function.
11824         (Plugin_manager::cleanup): New function.
11825         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11826         separately.
11827         * plugin.h (Plugin_manager::finish): Rename as
11828         layout_deferred_objects.
11829         (Plugin_manager::cleanup): New function.
11830         (Plugin_manager::cleanup_done): New field.
11831
11832 2008-12-23  Cary Coutant  <ccoutant@google.com>
11833
11834         * plugin.cc (is_visible_from_outside): New function.
11835         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11836         so we don't return "IR only" status for exported symbols or -r links.
11837
11838         * testsuite/Makefile.am (plugin_test_3): New test case.
11839         * testsuite/Makefile.in: Regenerate.
11840         * testsuite/plugin_test_3.sh: New file.
11841
11842 2008-12-22  Cary Coutant  <ccoutant@google.com>
11843
11844         * object.cc (Sized_relobj::layout_section): New function.
11845         (Sized_relobj::do_layout): Defer layout of input sections until after
11846         plugin has provided replacement files.
11847         (Sized_relobj::do_layout_deferred_sections): New function.
11848         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11849         (Relobj::layout_deferred_sections): New function.
11850         (Relobj::do_layout_deferred_sections): New function.
11851         (Sized_relobj::do_layout_deferred_sections): New function.
11852         (Sized_relobj::layout_section): New function.
11853         (Sized_relobj::Deferred_layout): New structure.
11854         (Sized_relobj::deferred_layout_): New field.
11855         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11856         Change all callers.  Layout deferred sections.
11857         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11858         references.
11859         (Plugin_hook::run): Move code from do_plugin_hook inline.
11860         (Plugin_hook::do_plugin_hook): Remove.
11861         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11862         (Plugin_manager::finish): Renamed, was cleanup.
11863         (Plugin_manager::should_defer_layout): New function.
11864         (Plugin_manager::add_deferred_layout_object): New function.
11865         (Plugin_manager::Deferred_layout_list): New type.
11866         (Plugin_manager::deferred_layout_objects_): New field.
11867         (Plugin_hook::do_plugin_hook): Remove.
11868
11869 2008-12-17  Ian Lance Taylor  <iant@google.com>
11870
11871         * options.h (class General_options): Add --no case for
11872         --export-dynamic.
11873
11874 2008-12-16  Cary Coutant  <ccoutant@google.com>
11875
11876         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11877         vector.
11878         (Plugin_manager::claim_file): Create plugin object even if
11879         plugin did not call the add_symbols callback.
11880         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11881         asking for more symbols than were added.
11882         * testsuite/Makefile.am (plugin_test_1): Add test case with
11883         no global symbols.
11884         (empty.syms): New target.
11885         * testsuite/Makefile.in: Regenerate.
11886         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11887         message. Don't call add_symbols if no globals.
11888         (all_symbols_read_hook): Don't provide replacement for empty
11889         claimed file.
11890
11891 2008-12-12  Ian Lance Taylor  <iant@google.com>
11892
11893         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11894         r_type == 0 for a local symbol with r_sym == 0.
11895         (scan_relocatable_relocs): Pass r_sym to
11896         local_non_section_strategy.
11897         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11898         r_sym parameter.
11899
11900         * configure.ac: Update test for TLS descriptors: they are
11901         supported as of glibc 2.9.
11902         * configure: Rebuild.
11903
11904 2008-12-11  Ian Lance Taylor  <iant@google.com>
11905
11906         PR 7091
11907         * target-reloc.h (Default_scan_relocatable_relocs): For each
11908         function, map r_type == 0 to RELOC_DISCARD.
11909
11910 2008-12-10  Cary Coutant  <ccoutant@google.com>
11911
11912         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11913         object to override a kept COMDAT group from a plugin object.
11914
11915 2008-12-09  Ian Lance Taylor  <iant@google.com>
11916
11917         PR 7088
11918         * yyscript.y (file_cmd): Handle INPUT.
11919
11920         * testsuite/initpri1.c: Change all declarations to be full
11921         prototypes by adding void, to avoid compiler warnings.
11922
11923 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
11924
11925         * options.cc (General_options::parse_plugin_opt): New.
11926         (General_options::add_plugin): The argument now is just the filename.
11927         (General_options::add_plugin_option): New.
11928         * options.h (plugin_opt): New.
11929         (add_plugin): Change argument name.
11930         (add_plugin_option): New.
11931         * plugin.cc (Plugin::load): Don't parse the plugin option.
11932         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
11933         (Plugin::add_option): New.
11934         (Plugin::args_): Change type.
11935         (Plugin::filename_): New.
11936         (Plugin_manager::add_plugin_option): New.
11937         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
11938         * testsuite/Makefile.in: Regenerate.
11939
11940 2008-12-05  Cary Coutant  <ccoutant@google.com>
11941
11942         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
11943         Handle --strip-lto-sections option.
11944         * options.h (strip_lto_sections): New option.
11945
11946 2008-12-01  Cary Coutant  <ccoutant@google.com>
11947
11948         * plugin.cc (ld_plugin_message): Change format parameter to const.
11949         Fix mismatch between new[] and delete.
11950
11951 2008-11-14  Cary Coutant  <ccoutant@google.com>
11952
11953         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
11954         instead of -1U.
11955
11956 2008-11-05  Craig Silverstein  <csilvers@google.com>
11957
11958         * options.cc (General_options::parse_dynamic_list): New function.
11959         * options.h (General_options): New flags dynamic_list,
11960         dynamic_list_data, dynamic_list_cpp_new, and
11961         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
11962         (General_options::in_dynamic_list): New function.
11963         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
11964         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
11965         (Lex::can_continue_name): Likewise.
11966         (yylex): Likewise.
11967         (read_script_file): New parameter script_options.
11968         (read_dynamic_list): New function.
11969         (Script_options::define_dynamic_list): New function.
11970         (dynamic_list_keyword_parsecodes): New variable.
11971         (dynamic_list_keywords): New variable.
11972         * script.h (Script_options::define_dynamic_list): New function
11973         prototype.
11974         (read_dynamic_list): New function prototype.
11975         * symtab.cc (strprefix): New macro.
11976         (Symbol::should_add_dynsym_entry): Support dynamic_list,
11977         dynamic_list_data, dynamic_list_cpp_new, and
11978         dynamic_list_cpp_typeinfo.
11979         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
11980         (dynamic_list_expr): New rule.
11981         (dynamic_list_nodes): Likewise.
11982         (dynamic_list_node): Likewise.
11983         * testsuite/Makefile.am (dynamic_list): New test.
11984         * testsuite/Makefile.in: Regenerated.
11985         * testsuite/dynamic_list.t: New file.
11986         * testsuite/dynamic_list.sh: New file.
11987
11988 2008-11-05  Craig Silverstein  <csilvers@google.com>
11989
11990         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
11991         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
11992         (t11_last): Likewise.
11993         * testsuite/ver_test_6.c (main): Likewise.
11994
11995 2008-10-07  Cary Coutant  <ccoutant@google.com>
11996
11997         * options.c (General_options::finalize): Add check for -static and
11998         -shared.
11999         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12000         is not empty.
12001
12002 2008-10-02  Cary Coutant  <ccoutant@google.com>
12003
12004         * plugin.cc (make_sized_plugin_object): Fix conditional
12005         compilation to work when not all targets are enabled.
12006
12007 2008-09-29  Cary Coutant  <ccoutant@google.com>
12008
12009         * archive.cc (Archive::get_file_and_offset): Use filename instead
12010         of name to get library path.
12011         (Archive::include_member): Unlock external member of a thin archive.
12012
12013         * testsuite/Makefile.am (TEST_AR): New variable.
12014         (thin_archive_test_1): New test.
12015         (thin_archive_test_2): New test.
12016         * testsuite/Makefile.in: Regenerate.
12017         * testsuite/thin_archive_main.cc: New file.
12018         * testsuite/thin_archive_test_1.cc: New file.
12019         * testsuite/thin_archive_test_2.cc: New file.
12020         * testsuite/thin_archive_test_3.cc: New file.
12021         * testsuite/thin_archive_test_4.cc: New file.
12022
12023 2008-09-29  Cary Coutant  <ccoutant@google.com>
12024
12025         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12026         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12027         instead of -1U.
12028         (Sized_relobj::do_finalize_local_symbols): Likewise.
12029         (Sized_relobj::map_to_kept_section): Likewise.
12030         * object.h (Sized_relobj::invalid_address): New constant.
12031         (Sized_relobj::do_output_section_offset): Check for invalid_address
12032         and return -1ULL.
12033         * output.cc (Output_reloc::local_section_offset): Use constant
12034         invalid_address instead of -1U.
12035         (Output_reloc::get_address): Likewise.
12036         (Output_section::output_address): Change -1U to -1ULL.
12037         * output.h (Output_reloc::invalid_address): New constant.
12038         * reloc.cc (Sized_relobj::write_sections): Use constant
12039         invalid_address instead of -1U.
12040         (Sized_relobj::relocate_sections): Likewise.
12041         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12042         values for merge sections.
12043         * target-reloc.h (relocate_for_relocatable): Use constant
12044         invalid_address instead of -1U.
12045
12046 2008-09-19  Cary Coutant  <ccoutant@google.com>
12047
12048         Add plugin functionality for link-time optimization (LTO).
12049         * configure.ac (plugins): Add --enable-plugins option.
12050         * configure: Regenerate.
12051         * config.in: Regenerate.
12052         * Makefile.am (LIBDL): New variable.
12053         (CCFILES): Add plugin.cc.
12054         (HFILES): Add plugin.h.
12055         (ldadd_var): Add LIBDL.
12056         * Makefile.in: Regenerate.
12057
12058         * archive.cc: Include "plugin.h".
12059         (Archive::setup): Don't preread archive symbols when using a plugin.
12060         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12061         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12062         files.
12063         (Archive::include_member): Add symbols from plugin objects.
12064         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12065         * descriptors.cc (Descriptors::open): Check for file descriptors
12066         abandoned by plugins.
12067         (Descriptors::claim_for_plugin): New function.
12068         * descriptors.h (Descriptors::claim_for_plugin): New function.
12069         (Open_descriptor::is_claimed): New field.
12070         (claim_descriptor_for_plugin): New function.
12071         * fileread.cc (File_read::claim_for_plugin): New function.
12072         * fileread.h (File_read::claim_for_plugin): New function.
12073         (File_read::descriptor): New function.
12074         * gold.cc: Include "plugin.h".
12075         (queue_initial_tasks): Add task to call plugin hooks for generating
12076         new object files.
12077         * main.cc: Include "plugin.h".
12078         (main): Load plugin libraries.
12079         * object.h (Pluginobj): Declare.
12080         (Object::pluginobj): New function.
12081         (Object::do_pluginobj): New function.
12082         (Object::set_target): New function.
12083         * options.cc: Include "plugin.h".
12084         (General_options::parse_plugin): New function.
12085         (General_options::General_options): Initialize plugins_ field.
12086         (General_options::add_plugin): New function.
12087         * options.h (Plugin_manager): Declare.
12088         (General_options): Add --plugin option.
12089         (General_options::has_plugins): New function.
12090         (General_options::plugins): New function.
12091         (General_options::add_plugin): New function.
12092         (General_options::plugins_): New field.
12093         * plugin.cc: New file.
12094         * plugin.h: New file.
12095         * readsyms.cc: Include "plugin.h".
12096         (Read_symbols::do_read_symbols): Check for archive before checking
12097         for ELF file.  Call plugin hooks to claim files.
12098         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12099         from a real object file; force override when processing replacement
12100         files.
12101         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12102         (Symbol::init_base_object): Likewise.
12103         (Symbol::init_base_output_data): Likewise.
12104         (Symbol::init_base_output_segment): Likewise.
12105         (Symbol::init_base_constant): Likewise.
12106         (Symbol::init_base_undefined): Likewise.
12107         (Symbol::output_section): Assert that object is not a plugin.
12108         (Symbol_table::add_from_pluginobj): New function.
12109         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12110         undefined.
12111         (Symbol_table::sized_write_globals): Likewise.
12112         (Symbol_table::add_from_pluginobj): Instantiate template.
12113         * symtab.h (Sized_pluginobj): Declare.
12114         (Symbol::in_real_elf): New function.
12115         (Symbol::set_in_real_elf): New function.
12116         (Symbol::in_real_elf_): New field.
12117         (Symbol_table::add_from_pluginobj): New function.
12118
12119         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12120         (LIBDL): New variable.
12121         (LDADD): Add LIBDL.
12122         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12123         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12124         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12125         (MOSTLYCLEANFILES): Likewise.
12126         * testsuite/Makefile.in: Regenerate.
12127         * testsuite/plugin_test.c: New file.
12128         * testsuite/plugin_test_1.sh: New file.
12129         * testsuite/plugin_test_2.sh: New file.
12130
12131 2008-09-16  Ian Lance Taylor  <iant@google.com>
12132
12133         * target-reloc.h (relocate_section): Check whether a symbol is
12134         defined by the ABI before reporting an undefined symbol error.
12135         * target.h (Target::is_defined_by_abi): Make parameter const.
12136         (Target::do_is_defined_by_abi): Likewise.
12137         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12138         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12139         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12140         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12141         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12142         * testsuite/Makefile.in: Rebuild.
12143
12144         * fileread.cc (make_view): Add casts to avoid warning.
12145
12146 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12147
12148         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12149         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12150
12151 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12152
12153         * options.h (General_options::output_is_executable): New.
12154         (General_options::output_is_pie): New.
12155         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12156         for shared libraries.
12157         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12158
12159 2008-09-11  Chris Demetriou  <cgd@google.com>
12160
12161         * options.h (origin): New -z option.
12162         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12163         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12164         in DT_FLAGS_1.
12165
12166 2008-09-05  Cary Coutant  <ccoutant@google.com>
12167
12168         * fileread.cc (File_read::make_view): Add check for attempt to map
12169         beyond end of file.
12170
12171 2008-09-05  Cary Coutant  <ccoutant@google.com>
12172
12173         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12174         explicit instantiations.
12175
12176 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12177
12178         PR gold/6858
12179         * options.cc (General_options::finalize): Allow undefined symbols
12180         in shlibs if linking -shared.
12181
12182         PR gold/6859
12183         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12184         symbols as not needing a dynsym entry.
12185
12186 2008-08-20  Craig Silverstein  <csilvers@google.com>
12187
12188         * fileread.cc (File_read::open): Do not lock the file unless it
12189         was successfully opened.
12190
12191 2008-08-14  Cary Coutant  <ccoutant@google.com>
12192
12193         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12194         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12195         * testsuite/tls_test.cc (struct int128): 128-bit struct
12196         for testing TLS relocs with non-zero addend.
12197         (v12): New TLS variable.
12198         (t12): New test.
12199         (t_last): Add check for v12.
12200         * testsuite/tls_test.h (t12): New function.
12201         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12202
12203 2008-08-13  Ian Lance Taylor  <iant@google.com>
12204
12205         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12206         set tls_segment_ or relro_segment_.
12207         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12208         when appropriate.
12209         * output.h (Output_section::clear_is_relro): New function.
12210         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12211         sections specially even when output_data_ is empty.
12212         (Output_segment::maximum_alignment): When first section is relro,
12213         only force alignment for PT_LOAD segments.
12214         * script.cc (script_data_segment_align): New function.
12215         (script_data_segment_relro_end): New function.
12216         * script-c.h (script_data_segment_align): Declare.
12217         (script_data_segment_relro_end): Declare.
12218         * script-sections.h (class Script_sections): Declare
12219         data_segment_align and data_segment_relro_end.  Add fields
12220         segment_align_index_ and saw_relro_end_.
12221         * script-sections.cc (class Sections_element): Add set_is_relro
12222         virtual function.  Add new bool* parameter to place_orphan_here.
12223         Add get_output_section virtual function.
12224         (class Output_section_definition): Add set_is_relro.  Add new
12225         bool* parameter to place_orphan_here.  Add get_output_section.
12226         Add is_relro_ field.
12227         (Output_section_definition::Output_section_definition): Initialize
12228         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12229         and is_relro_ fields.
12230         (Output_section_definition::place_orphan_here): Add is_relro
12231         parameter.
12232         (Output_section_definition::set_section_addresses): Set relro for
12233         output section.
12234         (Output_section_definition::alternate_constraint): Likewise.
12235         (class Orphan_output_section): Add new bool* parameter to
12236         place_orphan_here.  Add get_output_section.
12237         (Orphan_output_section::place_orphan_here): Add is_relro
12238         parameter.
12239         (Script_sections::Script_sections): Initialize
12240         data_segment_align_index_ and saw_relro_end_.
12241         (Script_sections::data_segment_align): New function.
12242         (Script_sections::data_segment_relro_end): New function.
12243         (Script_sections::place_orphan): Set or clear is_relro.
12244         (Script_sections::set_section_addresses): Force alignment of first
12245         TLS section.
12246         * yyscript.y (exp): Call script_data_segment_align and
12247         script_data_segment_relro_end.
12248         * testsuite/relro_script_test.t: New file.
12249         * testsuite/relro_test.cc (using_script): Declare.
12250         (t1, t2): Test using_script.
12251         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12252         (relro_script_test_SOURCES): Define.
12253         (relro_script_test_DEPENDENCIES): Define.
12254         (relro_script_test_LDFLAGS): Define.
12255         (relro_script_test_LDADD): Define.
12256         (relro_script_test.so): New target.
12257         * testsuite/Makefile.in: Rebuild.
12258
12259 2008-08-06  Cary Coutant <ccoutant@google.com>
12260
12261         * archive.cc (Archive::total_archives, Archive::total_members)
12262         (Archive::total_members_loaded): New variables.
12263         (Archive::setup): Add parameter.  Add option to preread
12264         archive symbols.
12265         (Archive::read_armap): Add counter.
12266         (Archive::get_file_and_offset): New function.
12267         (Archive::get_elf_object_for_member): New function.
12268         (Archive::read_all_symbols): New function.
12269         (Archive::read_symbols): New function.
12270         (Archive::add_symbols): Add counters.
12271         (Archive::include_all_members): Use armap to find members if it's
12272         already built.
12273         (Archive::include_member): Skip reading symbols if already read.
12274         Factored code into Archive::get_file_and_offset and
12275         Archive::get_elf_object_for_member.  Changed call to
12276         Mapfile::report_include_archive_member.
12277         (Archive::print_stats): New function.
12278         * archive.h: Declare Object and Read_symbols_data classes.
12279         (Archive::Archive): Add initializers for new members.
12280         (Archive::setup): Add parameter.
12281         (Archive::print_stats): New function.
12282         (Archive::total_archives, Archive::total_members)
12283         (Archive::total_members_loaded): New variables.
12284         (Archive::get_file_and_offset): New function.
12285         (Archive::get_elf_object_for_member): New function.
12286         (Archive::read_all_symbols): New function.
12287         (Archive::read_symbols): New function.
12288         (Archive::Archive_member): New class.
12289         (Archive::members_): New member.
12290         (Archive::num_members_): New member.
12291         * main.cc: Include archive.h.
12292         (main): Call Archive::print_stats.
12293         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12294         archive parameter; member_name is now the fully-decorated name.
12295         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12296         * options.h: (General_options): Add --preread-archive-symbols option.
12297         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12298         Archive::setup.
12299
12300 2008-08-04  Ian Lance Taylor  <iant@google.com>
12301
12302         * symtab.h (Symbol::use_plt_offset): New function.
12303         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12304         * powerpc.cc (Relocate::relocate): Likewise.
12305         * sparc.cc (Relocate::relocate): Likewise.
12306         * x86_64.cc (Relocate::relocate): Likewise.
12307         * testsuite/weak_plt.sh: New test.
12308         * testsuite/weak_plt_main.cc: New test.
12309         * testsuite/weak_plt_shared.cc: New test.
12310         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12311         (check_PROGRAMS): Add weak_plt.
12312         (check_DATA): Add weak_plt_shared.so.
12313         (weak_plt_main_pic.o, weak_plt): New targets.
12314         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12315         * testsuite/Makefile.in: Rebuild.
12316
12317         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12318         gcctestdir/ld.
12319         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12320         * testsuite/Makefile.in: Rebuild.
12321
12322 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12323
12324         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12325         * Makefile.in: Regenerate.
12326         * po/POTFILES.in: Regenerate.
12327
12328 2008-07-29  Ian Lance Taylor  <iant@google.com>
12329
12330         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12331         symbols before other symbols.
12332         * testsuite/script_test_2.cc (test_addr): Declare.
12333         (test_addr_alias): Declare.
12334         (main): Check that test_addr and test_addr_alias have the right
12335         values.
12336         * testsuite/script_test_2.t: Define test_addr_alias and
12337         test_addr.
12338
12339 2008-07-24  Ian Lance Taylor  <iant@google.com>
12340
12341         PR 5990
12342         * descriptors.cc: New file.
12343         * descriptors.h: New file.
12344         * gold-threads.h (class Hold_optional_lock): New class.
12345         * fileread.cc: Include "descriptors.h".
12346         (File_read::~File_read): Release descriptor rather than closing
12347         it.
12348         (File_read::open) [file]: Call open_descriptor rather than open.
12349         Set is_descriptor_opened_.
12350         (File_read::open) [memory]: Assert that descriptor is not open.
12351         (File_read::reopen_descriptor): New function.
12352         (File_read::release): Release descriptor.
12353         (File_read::do_read): Make non-const.  Reopen descriptor.
12354         (File_read::read): Make non-const.
12355         (File_read::make_view): Reopen descriptor.
12356         (File_read::do_readv): Likewise.
12357         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12358         Update declarations.
12359         * layout.cc: Include "descriptors.h".
12360         (Layout::create_build_id): Use open_descriptor rather than open.
12361         * output.cc: Include "descriptors.h".
12362         (Output_file::open): Use open_descriptor rather than open.
12363         * archive.cc (Archive::const_iterator): Change Archive to be
12364         non-const.
12365         (Archive::begin, Archive::end): Make non-const.
12366         (Archive::count_members): Likewise.
12367         * archive.h (class Archive): Update declarations.
12368         * object.h (Object::read): Make non-const.
12369         * Makefile.am (CCFILES): Add descriptors.cc.
12370         (HFILES): Add descriptors.h.
12371         * Makefile.in: Rebuild.
12372
12373         PR 6716
12374         * gold.h: Always include <clocale>.  Add Solaris workarounds
12375         following code in binutils/sysdep.h.
12376
12377         PR 6048
12378         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12379         this->eh_frame_hdr_ is NULL before using it.
12380
12381         * dynobj.cc (Versions::Versions): Update comment.
12382
12383         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12384         the base version name.
12385
12386         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12387         array size plus one.
12388         (Stringpool_template::set_string_offsets): Subtract one from key
12389         before using it as an array index.
12390         (Stringpool_template::get_offset_with_length): Likewise.
12391         (Stringpool_template::write_to_buffer): Likewise.
12392         * stringpool.h (Stringpool_template::get_offset_from_key):
12393         Likewise.
12394
12395 2008-07-23  Ian Lance Taylor  <iant@google.com>
12396
12397         PR 6658
12398         * object.h (Merged_symbol_value::value): Do our best to handle a
12399         negative addend.
12400
12401         PR 6647
12402         * script.cc (Version_script_info::get_versions): Don't add empty
12403         version tag to return value.
12404         (Version_script_info::get_symbol_version_helper): Change return
12405         type to bool.  Add pversion parameter.  Change all callers.
12406         (script_register_vers_node): Don't require a non-NULL tag.
12407         * script.h (class Version_script_info): Update declarations.
12408         (Version_script_info::get_symbol_version): Change return type to
12409         bool.  Add version parameter.  Change all callers.
12410         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12411         handling.  Handle an empty version from a version script.
12412         (Symbol_table::define_special_symbol): Likewise.
12413         * testsuite/ver_test_10.script: New file.
12414         * testsuite/ver_test_10.sh: New file.
12415         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12416         (check_DATA): Add ver_test_10.syms.
12417         (ver_test_10.syms, ver_test_10.so): New target.
12418         * testsuite/Makefile.in: Rebuild.
12419
12420 2008-07-23  Simon Baldwin  <simonb@google.com>
12421
12422         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12423         to zero for undefined symbols from dynamic libraries.
12424
12425 2008-07-23  Ian Lance Taylor  <iant@google.com>
12426
12427         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12428         Change all callers.
12429         * symtab.h (class Symbol_table): Update declaration.
12430         * testsuite/ver_test_9.cc: New file.
12431         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12432         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12433         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12434         (ver_test_9.so, ver_test_9.o): New targets.
12435         * testsuite/Makefile.in: Rebuild.
12436
12437 2008-07-22  Ian Lance Taylor  <iant@google.com>
12438
12439         * options.h (class General_options): Define --check-sections.
12440         * layout.cc (Layout::set_segment_offsets): Handle
12441         --check-sections.
12442
12443         * options.h (class General_options): Define -n/--nmagic and
12444         -N/--omagic.
12445         * options.cc (General_options::finalize): For -n/--nmagic or
12446         -N/--omagic, set -static.
12447         * layout.cc (Layout::attach_allocated_section_to_segment): If
12448         -N/--omagic, don't put read-only and read-write sections in
12449         different segments.
12450         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12451         finding a read-only segment.
12452         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12453         don't set the minimum segment alignment to the common page size,
12454         and don't set the file offset to the address modulo the page size.
12455         * script-sections.cc (Script_sections::create_segments): If
12456         -n/--omagic, don't put read-only and read-write sections in
12457         different segments.
12458
12459         * cref.cc: New file.
12460         * cref.h: New file.
12461         * options.h (class General_options): Add --print-symbol-counts.
12462         * main.cc (main): Issue defined symbol report if requested.
12463         * archive.cc (Archive::interpret_header): Make into a const member
12464         function.
12465         (Archive::add_symbols): Call Input_objects::archive_start and
12466         archive_stop.
12467         (Archive::const_iterator): Define new class.
12468         (Archive::begin, Archive::end): New functions.
12469         (Archive::include_all_members): Rewrite to use iterator.
12470         (Archive::count_members): New function.
12471         * archive.h (class Archive): Update declarations.
12472         (Archive::filename): New function.
12473         * object.cc: Include "cref.h".
12474         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12475         (Sized_relobj::do_get_global_symbol_counts): New function.
12476         (Input_objects::add_object): Add object to cross-referencer.
12477         (Input_objects::archive_start): New function.
12478         (Input_objects::archive_stop): New function.
12479         (Input_objects::print_symbol_counts): New function.
12480         * object.h: Declare Cref and Archive.
12481         (Object::get_global_symbol_counts): New function.
12482         (Object::do_get_global_symbol_counts): New pure virtual function.
12483         (class Sized_relobj): Add defined_count_ field.  Update
12484         declarations.
12485         (class Input_objects): Add cref_ field.  Update constructor.
12486         Update declarations.
12487         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12488         defined_count_.
12489         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12490         symbol counts.
12491         (Sized_dynobj::do_get_global_symbol_counts): New function.
12492         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12493         defined_count_.  Update declarations.  Define Symbols typedef.
12494         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12495         parameter.  Change all callers.
12496         (Symbol_table::add_from_dynobj): Add sympointers and defined
12497         parameters.  Change all callers.
12498         * symtab.h (class Symbol_table): Update declarations.
12499         * Makefile.am (CCFILES): Add cref.cc.
12500         (HFILES): Add cref.h.
12501         * Makefile.in: Rebuild.
12502
12503 2008-07-22  Simon Baldwin  <simonb@google.com>
12504
12505         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12506         to zero when writing undefined symbols.
12507
12508 2008-07-22  Ian Lance Taylor  <iant@google.com>
12509
12510         * output.cc (Output_section::add_input_section): Don't try to
12511         merge empty merge sections.
12512
12513 2008-07-21  Craig Silverstein  <csilvers@google.com>
12514
12515         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12516         Include symbol version in error message.
12517
12518 2008-07-20  Chris Demetriou  <cgd@google.com>
12519
12520         * configure.ac (gold_cv_c_random_seed): New configured variable.
12521         (RANDOM_SEED_CFLAGS): New substituted variable.
12522         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12523         * configure: Rebuild.
12524         * Makefile.in: Likewise.
12525         * testsuite/Makefile.in: Likewise.
12526
12527 2008-07-18  Ian Lance Taylor  <iant@google.com>
12528
12529         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12530         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12531         * testsuite/ver_test_main.cc (main): Call t4.
12532         (t4, t4_2a): Define.
12533         * testsuite/ver_test_2.cc (t4_2): Define.
12534         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12535         * testsuite/ver_test_4.cc (t4_2a): Define.
12536         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12537         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12538
12539 2008-07-17  Ian Lance Taylor  <iant@google.com>
12540
12541         * dynobj.cc (Versions::add_def): If we give an error about a
12542         missing version, go ahead and create the version anyhow.
12543
12544 2008-07-10  Ian Lance Taylor  <iant@google.com>
12545
12546         Handle output sections with more than 0x7fffffff bytes.
12547         * object.h (class Relobj): Change map_to_output_ to
12548         output_sections_, and just keep a section pointer.  Change all
12549         uses.  Move comdat group support to Sized_relobj.
12550         (Relobj::is_section_specially_mapped): Remove.
12551         (Relobj::output_section): Remove poff parameter.  Change all
12552         callers.
12553         (Relobj::output_section_offset): New function.
12554         (Relobj::set_section_offset): Rewrite.
12555         (Relobj::map_to_output): Remove.
12556         (Relobj::output_sections): New function.
12557         (Relobj::do_output_section_offset): New pure virtual function.
12558         (Relobj::do_set_section_offset): Likewise.
12559         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12560         group support from Relobj.  Update declarations.
12561         (Sized_relobj::get_output_section_offset): New function.
12562         (Sized_relobj::do_output_section_offset): New function.
12563         (Sized_relobj::do_set_section_offset): New function.
12564         * object.cc (Relobj::output_section_address): Remove.
12565         (Sized_relobj::Sized_relobj): Initialize new fields.
12566         (Sized_relobj::include_section_group): Cast find_kept_object to
12567         Sized_relobj.
12568         (Sized_relobj::include_linkonce_section): Likewise.
12569         (Sized_relobj::do_layout): Use separate arrays for output section
12570         and output offset.
12571         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12572         output_sections.
12573         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12574         output_sections and section_offsets.
12575         (Sized_relobj::write_local_symbols): Likewise.
12576         (map_to_kept_section): Compute output address directly.
12577         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12578         output_sections and section_offsets.
12579         (Sized_relobj::write_sections): Likewise.
12580         (Sized_relobj::relocate_sections): Likewise.
12581         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12582         * output.h (class Output_reloc): Update declarations.  Change
12583         u2_.relobj to Sized_relobj*.
12584         (class Output_data_reloc): Change add functions to use
12585         Sized_relobj*.
12586         * output.cc (Output_reloc::Output_reloc): Change relobj to
12587         Sized_relobj*.
12588         (Output_reloc::local_section_offset): Change return type to
12589         Elf_Addr.  Use get_output_section_offset.
12590         (Output_reloc::get_address): Likewise.
12591         (Output_section::is_input_address_mapped): Don't call
12592         is_section_specially_mapped.
12593         (Output_section::output_offset): Likewise.
12594         (Output_section::output_address): Likewise.
12595         (Output_section::starting_output_address): Likewise.
12596         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12597         parameter to Sized_relobj*.
12598         (Copy_relocs::need_copy_reloc): Likewise.
12599         (Copy_relocs::save): Likewise.
12600         * copy-relocs.h (class Copy_relocs): Update declarations.
12601         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12602         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12603         * target-reloc.h (relocate_for_relocatable): Change
12604         offset_in_output_section type to Elf_Addr.  Change code that uses
12605         it as well.
12606         * layout.cc (Layout::layout): Always set *off.
12607         * mapfile.cc (Mapfile::print_input_section): Use
12608         output_section_offset.
12609         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12610         Sized_relobj*.
12611         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12612         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12613         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12614
12615 2008-07-03  Ian Lance Taylor  <iant@google.com>
12616
12617         * layout.cc (Layout::include_section): Do not discard unrecognized
12618         SHT_STRTAB sections.
12619
12620 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12621
12622         * script.cc (Lex::can_continue_name): Make '?' allowable in
12623         version-script names.
12624         * testsuite/version_script.map: Change glob pattern to use '?'
12625
12626 2008-06-30  Manish Singh  <yosh@gimp.org>
12627
12628         PR 6585
12629         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12630         Correct typo.
12631
12632 2008-06-30  Ian Lance Taylor  <iant@google.com>
12633
12634         PR 6660
12635         PR 6682
12636         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12637         versions]: Don't try to read the value in the contents, since we
12638         don't use it.  Use the template endianness when writing.
12639
12640 2008-06-25  Cary Coutant  <ccoutant@google.com>
12641
12642         * fileread.cc (File_read::make_view): Assert on zero-length view.
12643         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12644         symbol table when there are no symbols to read.
12645
12646 2008-06-23  Craig Silverstein  <csilvers@google.com>
12647
12648         * version.cc (version_string): Bump to 1.7
12649
12650 2008-06-18  Craig Silverstein  <csilvers@google.com>
12651
12652         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12653         constant 0xFFFF to type Valtype.
12654         (Powerpc_relocate_functions::rel16_ha): Likewise.
12655
12656 2008-06-17  Ian Lance Taylor  <iant@google.com>
12657
12658         * output.h (Output_section::Input_section): Initialize p2align_ to
12659         zero for Output_section_data constructors.
12660         (Output_section::Input_section::addralign): If not an input
12661         section, return the alignment of the Output_section_data.
12662         * testsuite/copy_test.cc: New file.
12663         * testsuite/copy_test_1.cc: New file.
12664         * testsuite/copy_test_2.cc: New file.
12665         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12666         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12667         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12668         (copy_test_1_pic.o, copy_test_1.so): New targets.
12669         (copy_test_2_pic.o, copy_test_2.so): New targets.
12670         * testsuite/Makefile.in: Rebuild.
12671
12672         * script-sections.cc (Script_sections::place_orphan): Initialize
12673         local variable exact.
12674
12675 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12676
12677         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12678
12679 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12680             David S. Miller  <davem@davemloft.net>
12681
12682         * powerpc.cc: New file.
12683         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12684         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12685         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12686         * Makefile.in: Rebuild.
12687
12688 2008-06-09  Ian Lance Taylor  <iant@google.com>
12689
12690         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12691         <exception>.
12692         (throwing, orig_terminate): New static variables.
12693         (terminate_handler): New static function.
12694         (t2): Set terminate handler.
12695
12696 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12697
12698         PR 6584
12699         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12700         alignment.
12701
12702 2008-05-30  Cary Coutant  <ccoutant@google.com>
12703
12704         * archive.cc (Archive::include_all_members) Correct to step
12705         over symbol table and extended name table in thin archives.
12706
12707 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12708
12709         PR 6407
12710         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12711         calculation.
12712
12713 2008-05-28  Caleb Howe  <cshowe@google.com>
12714
12715         * reduced_debug_output.cc: New file.
12716         * reduced_debug_output.h: New file.
12717         * options.h (class General_options): Add --strip-debug-non-line.
12718         * options.cc (General_options::finalize): Add strip_debug_non_line
12719         to the strip heirarchy.
12720         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12721         fields.
12722         * layout.cc: Include "reduced_debug_output.h".
12723         (Layout::Layout): Initialize new fields.
12724         (line_only_debug_sections): New static array.
12725         (is_lines_only_debug_sections): New static inline function.
12726         (Layout::include_section): Handle --strip-debug-non-line.
12727         (Layout::make_output_section): If --strip-debug-non-line, build
12728         new output sections for .debug_abbrev and .debug_info.
12729         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12730         gold.  Warn about possible overflow.
12731         (read_signed_LEB_128): Likewise.
12732         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12733         (read_signed_LEB_128): Declare.
12734         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12735         (HFILES): Add reduced_debug_output.h.
12736         * Makefile.in: Rebuild.
12737
12738 2008-05-21  Ian Lance Taylor  <iant@google.com>
12739
12740         * mapfile.cc: New file.
12741         * mapfile.h: New file.
12742         * options.h (class General_options): Add -M/--print-map and -Map.
12743         * options.cc (General_options::finalize): Make -M equivalent to
12744         -Map -.
12745         * main.cc: Include <cstdio> and "mapfile.h".
12746         (main): Open mapfile if requested.
12747         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12748         constructor.  Change caller.
12749         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12750         (queue_middle_tasks): Likewise.
12751         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12752         declarations.
12753         * archive.cc: Include "mapfile.h".
12754         (Archive::add_symbols): Add mapfile parameter.  Change all
12755         callers.  Pass mapfile, symbol, and reason to include_member.
12756         (Archive::include_all_members): Add mapfile parameter.  Change all
12757         callers.
12758         (Archive::include_member): Add mapfile, sym, and why parameters.
12759         Change all callers.  Report inclusion to map file.
12760         * archive.h: Include "fileread.h".
12761         (class Archive): Update declarations.
12762         (Archive::file): New const method.
12763         (class Add_archive_symbols): Add mapfile_ field.  Update
12764         constructor.  Change all callers.
12765         * readsyms.h (class Read_symbols): Likewise.
12766         (class Finish_group): Likewise.
12767         (class Read_script): Likewise.
12768         * common.cc: Include "mapfile.h".
12769         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12770         all callers.
12771         (Symbol_table::do_allocate_commons): Likewise.
12772         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12773         symbol allocation to mapfile.
12774         * common.h (class Allocate_commons_task): Add mapfile_ field.
12775         Update constructor.  Change all callers.
12776         * symtab.h (class Symbol_table): Update declarations.
12777         * layout.cc: Include "mapfile.h".
12778         (Layout_task_runner::run): Print information to mapfile.
12779         (Layout::create_gold_note): Change Output_data_fixed_space to
12780         Output_data_zero_fill.
12781         (Layout::create_build_id): Likewise.
12782         (Layout::print_to_mapfile): New function.
12783         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12784         constructor.  Change caller.
12785         (class Layout): Declare print_to_mapfile.
12786         * output.cc (Output_section::Input_section::print_to_mapfile): New
12787         function.
12788         (Output_section::add_input_section): If producing a map, always
12789         add to input_sections_ list.
12790         (Output_section::do_print_to_mapfile): New function.
12791         (Output_segment::print_sections_to_mapfile): New function.
12792         (Output_segment::print_section_list_to_mapfile): New function.
12793         * output.h: Include "mapfile.h".
12794         (Output_data::print_to_mapfile): New function.
12795         (Output_data::do_print_to_mapfile): New virtual function.
12796         (Output_segment_headers::do_print_to_mapfile): New function.
12797         (Output_file_header::do_print_to_mapfile): New function.
12798         (Output_data_const::do_print_to_mapfile): New function.
12799         (class Output_data_const_buffer): Add map_name_ field.  Update
12800         constructor.  Change all callers.  Add do_print_to_mapfile
12801         function.
12802         (class Output_data_fixed_space): Likewise.
12803         (class Output_data_space): Likewise.
12804         (class Output_data_zero_fill): New class.
12805         (Output_data_strtab::do_print_to_mapfile): New function.
12806         (Output_data_reloc_base::do_print_to_mapfile): New function.
12807         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12808         (Output_data_group::do_print_to_mapfile): New function.
12809         (Output_data_got::do_print_to_mapfile): New function.
12810         (Output_data_dynamic::do_print_to_mapfile): New function.
12811         (Output_symtab_xindex::do_print_to_mapfile): New function.
12812         (class Output_section): Declare do_print_to_mapflie.  Declare
12813         print_to_mapfile in Input_section.
12814         (class Output_segment): Declare new functions.
12815         * object.h (Sized_relobj::symbol_count): New function.
12816         * script-sections.cc
12817         (Output_section_element_dot_assignment::set_section_addresses):
12818         Change Output_data_fixed_space to Output_data_zero_fill.
12819         (Output_data_expression::do_print_to_mapfile): New function.
12820         * script.cc (read_input_script): Add mapfile parameter.  Change
12821         all callers.
12822         * script.h (read_input_script): Update declaration.
12823         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12824         (Eh_frame::do_print_to_mapfile): New function.
12825         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12826         (Output_merge_string::do_print_to_mapfile): New function.
12827         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12828         function.
12829         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12830         function.
12831         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12832         function.
12833         * Makefile.am (CCFILES): Add mapfile.cc.
12834         (HFILES): Add mapfile.h.
12835         * Makefile.in: Rebuild.
12836
12837 2008-05-19  Ian Lance Taylor  <iant@google.com>
12838
12839         * options.h (class General_options): Add -z relro.
12840         * layout.cc (Layout::Layout): Initialize relro_segment_.
12841         (Layout::add_output_section_data): Return the output section.
12842         (Layout::make_output_section): Rcognize relro sections and mark
12843         them appropriately.
12844         (Layout::attach_allocated_section_to_segment): Put relro sections
12845         in a PT_GNU_RELRO segment.
12846         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12847         section as relro.
12848         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12849         PT_TLS segments.
12850         (Layout::linkonce_mapping): Map d.rel.ro.local to
12851         .data.rel.ro.local.
12852         (Layout::output_section_name): Us .data.rel.ro.local for any
12853         section which begins with that.
12854         * layout.h (class Layout): Update add_output_section_data
12855         declaration.  Add relro_segment_ field.
12856         * output.cc (Output_section::Output_section): Initialize is_relro_
12857         and is_relro_local_ fields.
12858         (Output_segment::add_output_section): Group relro sections.
12859         (Output_segment::is_first_section_relro): New function.
12860         (Output_segment::maximum_alignment): If there is a relro section,
12861         align the segment to the common page size.
12862         (Output_segment::set_section_addresses): Track whether we are
12863         looking at relro sections.  If the last section is a relro
12864         section, align to the common page size.
12865         (Output_segment::set_section_list_addresses): Add in_relro
12866         parameter.  Change all callers.  Align to the page size when
12867         moving from relro to non-relro section.
12868         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12869         segment.
12870         * output.h (class Output_section): Add is_relro_ and
12871         is_relro_local_ fields.
12872         (Output_section::is_relro): New function.
12873         (Output_section::set_is_relro): New function.
12874         (Output_section::is_relro_local): New function.
12875         (Output_section::set_is_relro_local): New function.
12876         (class Output_segment): Update declarations.
12877         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12878         * sparc.cc (Target_sparc::got_section): Likewise.
12879         * x86_64.cc (Target_x86_64::got_section): Likewise.
12880         * testsuite/relro_test_main.cc: New file.
12881         * testsuite/relro_test.cc: New file.
12882         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12883         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12884         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12885         (relro_test.so, relro_test_pic.o): New targets.
12886         * testsuite/Makefile.in: Rebuild.
12887
12888 2008-05-16  Ian Lance Taylor  <iant@google.com>
12889
12890         * output.cc (Output_segment::add_output_section): Remove front
12891         parameter.
12892         * output.h (class Output_segment): Remove
12893         add_initial_output_section and overloaded add_output_section.
12894         Update declaration of remaining add_output_section.
12895         * layout.cc (Layout::create_interp): Call add_output_section
12896         rather than add_initial_output_section.
12897         (Layout::finish_dynamic_section): Likewise.
12898
12899         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12900         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12901         know the dynamic type.
12902         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12903         field.  Initialize it in constructor.
12904         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12905         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12906         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12907         reloc.
12908
12909         * output.cc (Output_reloc::get_address): Change return type to
12910         Elf_Addr.
12911         * output.h (class Output_reloc): Update get_address declaration.
12912         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12913         for section addresses.
12914
12915 2008-05-09  Ian Lance Taylor  <iant@google.com>
12916
12917         PR 6493
12918         * gold.cc (gold_nomem): Use return value of write.
12919
12920 2008-05-08  Ian Lance Taylor  <iant@google.com>
12921
12922         * symtab.c (Symbol::init_base_output_data): Add version
12923         parameter.  Change all callers.
12924         (Symbol::init_base_output_segment): Likewise.
12925         (Symbol::init_base_constant): Likewise.
12926         (Symbol::init_base_undefined): Likewise.
12927         (Sized_symbol::init_output_data): Likewise.
12928         (Sized_symbol::init_output_segment): Likewise.
12929         (Sized_symbol::init_constant): Likewise.
12930         (Sized_symbol::init_undefined): Likewise.
12931         (Symbol_table::do_define_in_output_data): If the new symbol has a
12932         version, mark it as the default.
12933         (Symbol_table::do_define_in_output_segment): Likewise.
12934         (Symbol_table::do_define_as_constant): Likewise.
12935         * symtab.h (class Symbol): Update declarations.
12936         (class Sized_symbol): Likewise.
12937         * resolve.cc (Symbol::override_version): New function.
12938         (Symbol::override_base): Call override_version.
12939         (Symbol::override_base_with_special): Likewise.
12940         * testsuite/ver_script_8.script: New file.
12941         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
12942         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
12943         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
12944         (ver_test_8_1.so, ver_test_8_2.so): New targets.
12945
12946 2008-05-06  Ian Lance Taylor  <iant@google.com>
12947
12948         PR 6049
12949         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
12950         functions.
12951         (class General_options): Remove existing --undefined, and add
12952         --no-undefined instead.  Add new --undefined as synonym for -u.
12953         * archive.cc (Archive::add_symbols): Check whether symbol was
12954         named with -u.
12955         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
12956         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
12957         all uses.  Add IS_UNDEFINED.  Update declarations to split
12958         different versions of init_base.  Declare init_base_undefined.
12959         (Symbol::is_defined): Handle IS_UNDEFINED.
12960         (Symbol::is_undefined): Likewise.
12961         (Symbol::is_weak_undefined): Call is_undefined.
12962         (Symbol::is_absolute): Handle IS_CONSTANT.
12963         (class Sized_symbol): Update declarations to split different
12964         versions of init.  Declare init_undefined.
12965         (class Symbol_table): Declare new functions.
12966         * symtab.cc (Symbol::init_base_object): Rename from init_base.
12967         Change all callers.
12968         (Symbol::init_base_output_data): Likewise.
12969         (Symbol::init_base_output_segment): Likewise.
12970         (Symbol::init_base_constant): Likewise.
12971         (Symbol::init_base_undefined): New function.
12972         (Sized_symbol::init_object): Rename from init.  Change all
12973         callers.
12974         (Sized_symbol::init_output_data): Likewise.
12975         (Sized_symbol::init_output_segment): Likewise.
12976         (Sized_symbol::init_constant): Likewise.
12977         (Sized_symbol::init_undefined): New function.
12978         (Symbol_table::add_undefined_symbols_from_command_line): New
12979         function.
12980         (Symbol_table::do_add_undefined_symbols_from_command_line): New
12981         function.
12982         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
12983         (Symbol::output_section): Likewise.
12984         (Symbol::set_output_section): Likewise.
12985         (Symbol_table::sized_finalize_symbol): Likewise.
12986         (Symbol_table::sized_write_globals): Likewise.
12987         * resolve.cc (Symbol_table::should_override): Likewise.
12988         (Symbol::override_base_with_special): Likewise.
12989
12990         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
12991         symbol, change it to have default visibility.
12992         * testsuite/protected_1.cc: New file.
12993         * testsuite/protected_2.cc: New file.
12994         * testsuite/protected_3.cc: New file.
12995         * testsuite/protected_main_1.cc: New file.
12996         * testsuite/protected_main_2.cc: New file.
12997         * testsuite/protected_main_3.cc: New file.
12998         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
12999         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13000         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13001         (protected_1.so): New target.
13002         (protected_1_pic.o, protected_2_pic.o): New targets.
13003         (protected_3_pic.o): New target.
13004         (check_PROGRAMS): Add protected_2.
13005         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13006         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13007         * testsuite/Makefile.in: Rebuild.
13008
13009         * options.h (DEFINE_var): Add set_user_set_##varname__.
13010         (DEFINE_bool_alias): New macro.
13011         (class General_options): Define -Bstatic using DEFINE_bool_alias
13012         rather than DEFINE_special.  Add --undefined as an alias for -z
13013         defs.
13014         * options.cc (General_options::parse_Bstatic): Remove.
13015
13016         * options.h (class General_options): Add --fatal-warnings.
13017         * main.cc (main): Implement --fatal-warnings.
13018         * errors.h (Errors::warning_count): New function.
13019
13020         * options.h (class General_options): Add -Bsymbolic-functions.
13021         * symtab.h (Symbol::is_preemptible): Check for
13022         -Bsymbolic-functions.
13023
13024 2008-05-05  Ian Lance Taylor  <iant@google.com>
13025
13026         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13027         as noVARNAME rather than no-VARNAME.
13028         (class General_options): Add option -z combreloc.
13029         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13030         get_address.
13031         (Output_reloc::sort_before) [SHT_REL]: New function.
13032         (Output_reloc::sort_before) [SHT_RELA]: New function.
13033         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13034         Sort_relocs_comparison.
13035         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13036         parameter.  Change all callers.
13037         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13038         sort_relocs parameter.  Change all callers.
13039         * output.cc (Output_reloc::get_address): New function, broken out
13040         of write_rel.
13041         (Output_reloc::write_rel): Call it.
13042         (Output_reloc::compare): New function.
13043         (Output_data_reloc_base::do_write): Optionally sort relocs.
13044
13045         * configure.ac: If targ_extra_obj is set, link it in.
13046         * configure.tgt: Initialize all variables.
13047         (x86_64*): Set targ_extra_obj and targ_extra_size.
13048         * configure: Rebuild.
13049
13050         * object.cc (Sized_relobj::include_section_group): Adjust section
13051         indexes read from group data.  Build vector to pass to
13052         layout_group.
13053         * layout.cc (Layout::layout_group): Add flags and shndxes
13054         parameters.  Remove contents parameter.  Change caller.  Update
13055         explicit instantiations.
13056         * layout.h (class Layout): Update layout_group declaration.
13057         * output.cc (Output_data_group::Output_data_group): Add flags and
13058         input_shndxes parameters.  Remove contents parameter.  Change
13059         caller.
13060         (Output_data_group::do_write): Change input_sections_ to
13061         input_shndxes_.
13062         * output.h (class Output_data_group): Update constructor
13063         declaration.  Rename input_sections_ to input_shndxes_.
13064         * testsuite/many_sections_test.cc: Add template.
13065
13066 2008-04-30  Cary Coutant  <ccoutant@google.com>
13067
13068         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13069
13070         * layout.cc (Layout::include_section): Refactored check for debug
13071         info section.
13072         (Layout::add_comdat): Add new parameters.  Change type
13073         of signature parameter.  Add object and shndx to signatures table.
13074         (Layout::find_kept_object): New function.
13075         * layout.h: Include <cstring>.
13076         (Layout::is_debug_info_section): New function.
13077         (Layout::add_comdat): Add new parameters.
13078         (Layout::find_kept_object): New function.
13079         (Layout::Kept_section): New struct.
13080         (Layout::Signatures): Change type of map range.
13081         * object.cc (Relobj::output_section_address): New function.
13082         (Sized_relobj::include_section_group): Add new parameters.  Change
13083         calls to Layout::add_comdat.  Change to build table of kept comdat
13084         groups and table mapping discarded sections to kept sections.
13085         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13086         (Sized_relobj::do_layout): Change calls to include_section_group and
13087         include_linkonce_section.
13088         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13089         value to zero when section is discarded.
13090         (Sized_relobj::map_to_kept_section): New function.
13091         * object.h (Relobj::output_section_address): New function.
13092         (Relobj::Comdat_group): New type.
13093         (Relobj::find_comdat_group): New function.
13094         (Relobj::Comdat_group_table): New type.
13095         (Relobj::Kept_comdat_section): New type.
13096         (Relobj::Kept_comdat_section_table): New type.
13097         (Relobj::add_comdat_group): New function.
13098         (Relobj::set_kept_comdat_section): New function.
13099         (Relobj::get_kept_comdat_section): New function.
13100         (Relobj::comdat_groups_): New field.
13101         (Relobj::kept_comdat_sections_): New field.
13102         (Symbol_value::input_value): Update comment.
13103         (Sized_relobj::map_to_kept_section) New function.
13104         (Sized_relobj::include_linkonce_section): Add new parameter.
13105         * target-reloc.h (Comdat_behavior): New type.
13106         (get_comdat_behavior): New function.
13107         (relocate_section): Add code to map a discarded section to the
13108         corresponding kept section when applying a relocation.
13109
13110 2008-04-30  Craig Silverstein  <csilvers@google.com>
13111
13112         * dwarf_reader.cc (next_generation_count): New static var.
13113         (Addr2line_cache_entry): New struct.
13114         (addr2line_cache): New static var.
13115         (Dwarf_line_info::one_addr2line): Added caching.
13116         (Dwarf_line_info::clear_addr2line_cache): New function.
13117         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13118         cache-size parameter.
13119         (Dwarf_line_info::one_addr2line_cache): New function.
13120         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13121         new cache-size argument to one_addr2line(), and clear cache.
13122
13123 2008-04-28  Cary Coutant  <ccoutant@google.com>
13124
13125         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13126         R_386_PC8 relocations.
13127
13128 2008-04-23  Ian Lance Taylor  <iant@google.com>
13129
13130         * object.cc (Sized_relobj::include_section_group): Check for
13131         invalid section group.
13132
13133         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13134         header size.
13135
13136         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13137         than read for file header.
13138         * archive.cc (Archive::include_member): Likewise.
13139
13140 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13141
13142         * aclocal.m4: Regenerate.
13143         * configure: Regenerate.
13144
13145 2008-04-19  Ian Lance Taylor  <iant@google.com>
13146
13147         * version.cc (version_string): Bump to 1.6.
13148
13149         * testsuite/Makefile.am (many_sections_r_test): New target.
13150         (many_sections_r_test_SOURCES): Remove.
13151         (many_sections_r_test_DEPENDENCIES): Remove.
13152         (many_sections_r_test_LDFLAGS): Remove.
13153         (many_sections_r_test_LDADD): Remove.
13154
13155         * object.cc (Sized_relobj::do_add_symbols): Always pass
13156         local_symbol_count_ to add_from_relobj.
13157
13158         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13159         every thousand variables.
13160         * testsuite/Makefile.in: Rebuild.
13161
13162         * object.cc (Xindex::initialize_symtab_xindex): New function.
13163         (Xindex::read_symtab_xindex): New function.
13164         (Xindex::sym_xindex_to_shndx): New function.
13165         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13166         available.
13167         (Sized_relobj::do_initialize_xindex): New function.
13168         (Sized_relobj::do_read_symbols): Adjust section links.
13169         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13170         parameter.  Change all callers.
13171         (Sized_relobj::include_section_group): Adjust section links and
13172         symbol section indexes.
13173         (Sized_relobj::do_layout): Adjust section links.
13174         (Sized_relobj::do_count_local_symbols): Adjust section links and
13175         symbol section indexes.
13176         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13177         ordinary and special symbols.
13178         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13179         dynsym_xindex parameters.  Change all callers.  Adjust section
13180         links.  Use SHN_XINDEX when needed.
13181         (Sized_relobj::get_symbol_location_info): Adjust section links.
13182         Don't get fooled by special symbols.
13183         * object.h (class Xindex): Define.
13184         (class Object): Add xindex_ parameter.  Declare virtual functoin
13185         do_initialize_xindex.
13186         (Object::adjust_sym_shndx): New function.
13187         (Object::set_xindex): New protected function.
13188         (class Symbol_value): Add is_ordinary_shndx_ field.
13189         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13190         (Symbol_value::value): Assert ordinary section.
13191         (Symbol_value::initialize_input_to_output_map): Likewise.
13192         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13193         Change all callers.
13194         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13195         all callers.
13196         (class Sized_relobj): Update declarations.
13197         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13198         parameter.  Change all callers.
13199         (Sized_relobj::adjust_shndx): New function.
13200         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13201         field.
13202         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13203         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13204         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13205         (Sized_dynobj::read_dynsym_section): Adjust section links.
13206         (Sized_dynobj::read_dynamic): Likewise.
13207         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13208         section links.
13209         (Sized_dynobj::do_initialize_xindex): New function.
13210         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13211         do_initialize_xindex.
13212         (Sized_dynobj::adjust_shndx): New function.
13213         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13214         dynsym_xindex_ fields.
13215         (Layout::finalize): Add a call to set_section_indexes before
13216         creating the symtab sections.
13217         (Layout::set_section_indexes): Don't do anything if the section
13218         already has a section index.
13219         (Layout::create_symtab_sections): Add shnum parameter.  Change
13220         caller.  Create .symtab_shndx section if needed.
13221         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13222         caller.
13223         (Layout::allocated_output_section_count): New function.
13224         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13225         needed.
13226         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13227         fields.  Update declarations.
13228         (Layout::symtab_xindex): New function.
13229         (Layout::dynsym_xindex): New function.
13230         (class Write_symbols_task): Add layout_ field.
13231         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13232         Change caller.
13233         * output.cc (Output_section_headers::Output_section_headers): Add
13234         shstrtab_section parameter.  Change all callers.
13235         (Output_section_headers::do_sized_write): Store overflow values
13236         for section count and section string table section index in
13237         section header zero.
13238         (Output_file_header::do_sized_write): Check for overflow of
13239         section count and section string table section index.
13240         (Output_symtab_xindex::do_write): New function.
13241         (Output_symtab_xindex::endian_do_write): New function.
13242         * output.h (class Output_section_headers): Add shstrtab_section_.
13243         Update declarations.
13244         (class Output_symtab_xindex): Define.
13245         (Output_section::has_out_shndx): New function.
13246         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13247         field.
13248         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13249         Change all callers.
13250         (Sized_symbol::init): Likewise.
13251         (Symbol::output_section): Check for ordinary symbol.
13252         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13253         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13254         callers.
13255         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13256         Change all callers.  Simplify handling of symbols from sections
13257         not included in the link.
13258         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13259         distinction.
13260         (Weak_alias_sorter::operator()): Assert that symbols are
13261         ordinary.
13262         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13263         distinction.
13264         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13265         parameters.  Change all callers.
13266         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13267         symbol distinction.  Use SHN_XINDEX when needed.
13268         (Symbol_table::write_section_symbol): Add symtab_xindex
13269         parameter.  Change all callers.
13270         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13271         SHN_XINDEX when needed.
13272         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13273         declarations.
13274         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13275         (Symbol::is_defined): Check is_ordinary.
13276         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13277         (Symbol::is_absolute, Symbol::is_common): Likewise.
13278         (class Sized_symbol): Update declarations.
13279         (class Symbol_table): Update declarations.
13280         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13281         parameters.  Change all callers.
13282         (Sized_symbol::override): Likewise.
13283         (Symbol_table::override): Likewise.
13284         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13285         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13286         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13287         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13288         to be in an ordinary section.
13289         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13290         object and is_ordinary parameters.  Change all callers.
13291         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13292         Change all callers.  Don't add undefined or non-ordinary symbols
13293         to reloc_map_.
13294         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13295         Change all callers.
13296         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13297         declarations.
13298         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13299         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13300         (Sized_relobj::relocate_sections): Likewise.
13301         * target-reloc.h (scan_relocs): Adjust section symbol index.
13302         (scan_relocatable_relocs): Likewise.
13303         * i386.cc (Scan::local): Check for ordinary symbols.
13304         * sparc.cc (Scan::local): Likewise.
13305         * x86_64.cc (Scan::local): Likewise.
13306         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13307         to symbol_section_and_value.
13308         * testsuite/many_sections_test.cc: New file.
13309         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13310         (check_PROGRAMS): Add many_sections_test.
13311         (many_sections_test_SOURCES): Define.
13312         (many_sections_test_DEPENDENCIES): Define.
13313         (many_sections_test_LDFLAGS): Define.
13314         (BUILT_SOURCES): Add many_sections_define.h.
13315         (many_sections_define.h): New target.
13316         (BUILT_SOURCES): Add many_sections_check.h.
13317         (many_sections_check.h): New target.
13318         (check_PROGRAMS): Add many_sections_r_test.
13319         (many_sections_r_test_SOURCES): Define.
13320         (many_sections_r_test_DEPENDENCIES): Define.
13321         (many_sections_r_test_LDFLAGS): Define.
13322         (many_sections_r_test_LDADD): Define.
13323         (many_sections_r_test.o): New target.
13324         * testsuite/Makefile.in: Rebuild.
13325
13326 2008-04-17  Cary Coutant  <ccoutant@google.com>
13327
13328         * errors.cc (Errors::info): New function.
13329         (gold_info): New function.
13330         * errors.h (Errors::info): New function.
13331         * gold.h (gold_info): New function.
13332         * object.cc (Input_objects::add_object): Print trace output.
13333         * options.cc (options::parse_set): New function.
13334         (General_options::parse_wrap): Deleted.
13335         (General_options::General_options): Deleted initializer.
13336         * options.h (options::String_set): New typedef.
13337         (options::parse_set): New function.
13338         (DEFINE_set): New macro.
13339         (General_options::wrap): Changed to use DEFINE_set. Changed
13340         callers of any_wrap_symbols and is_wrap_symbol.
13341         (General_options::trace, General_options::trace_symbol):
13342         New options.
13343         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13344         (General_options::wrap_symbols_): Deleted.
13345         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13346
13347 2008-04-17  David S. Miller  <davem@davemloft.net>
13348
13349         * options.cc (General_options::parse_V): New function.
13350         * options.h: Add entries for -V and -Qy.
13351
13352 2008-04-17  Ian Lance Taylor  <iant@google.com>
13353
13354         * common.cc (Symbol_table::allocate_commons): Remove options
13355         parameter.  Change caller.
13356         (Symbol_table::do_allocate_commons): Remove options parameter.
13357         Change caller.  Just call do_allocate_commons_list twice.
13358         (Symbol_table::do_allocate_commons_list): New function, broken out
13359         of do_allocate_commons.
13360         * common.h (class Allocate_commons_task): Remove options_ field.
13361         Update constructor.
13362         * symtab.cc (Symbol_table::Symbol_table): Initialize
13363         tls_commons_.
13364         (Symbol_table::add_from_object): Put TLS common symbols on
13365         tls_commons_ list.
13366         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13367         which are IN_OUTPUT_DATA.
13368         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13369         allocate_commons and do_allocate_commons declarations.  Declare
13370         do_allocate_commons_list.
13371         * gold.cc (queue_middle_tasks): Update creation of
13372         Allocate_commons_task to not pass options.
13373         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13374         (TLS_TEST_C_FLAGS): New variable.
13375         (tls_test_c_pic.o): New target.
13376         (tls_test_shared.so): Link in tls_test_c_pic.o.
13377         (tls_test_c_pic_ie.o): New target.
13378         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13379         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13380         (tls_test_c.o): New target.
13381         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13382         (tls_pic_test_LDADD): Likewise.
13383         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13384         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13385         (tls_test_c_gnu2.o): New target.
13386         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13387         tls_test_c_gnu2.o.
13388         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13389         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13390         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13391         * testsuite/tls_test.cc: Include "config.h".
13392         (t_last): Call t11_last.
13393         * testsuite/tls_test.h (t11, t11_last): Declare.
13394         * testsuite/tls_test_c.c: New file.
13395         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13396         * configure.ac: Check for OpenMP support.
13397         * configure, config.in, Makefile.in: Rebuild.
13398         * testsuite/Makefile.in: Rebuild.
13399
13400 2008-04-16  Cary Coutant  <ccoutant@google.com>
13401
13402         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13403         (Target_i386::tls_base_symbol_defined_): New field.
13404         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13405         (Target_i386::Scan::global): Likewise.
13406         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13407         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13408         (Target_x86_64::tls_base_symbol_defined_): New field.
13409         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13410         (Target_x86_64::Scan::global): Likewise.
13411
13412 2008-04-16  Cary Coutant  <ccoutant@google.com>
13413
13414         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13415         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13416         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13417         building shared libraries.
13418         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13419         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13420         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13421         * testsuite/Makefile.in: Rebuild.
13422         * testsuite/weak_undef.h: New file.
13423         * testsuite/weak_undef_file1.cc: Add extra test cases.
13424         * testsuite/weak_undef_file2.cc: Likewise.
13425         * testsuite/weak_undef_test.cc: Likewise.
13426
13427 2008-04-16  David S. Miller  <davem@davemloft.net>
13428
13429         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13430         Add issued_non_pic_error_ field.  Declare check_non_pic.
13431         (Target_sparc::Scan::check_non_pic): New function.
13432         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13433         (Target_sparc::Scan::global): Likewise.
13434
13435         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13436         * configure: Rebuild.
13437
13438         * options.h (DEFINE_enable): New macro.
13439         (new_dtags): New enable option.
13440         (initfirst, interpose, loadfltr, nodefaultlib,
13441         nodelete, nodlopen, nodump): New -z options.
13442         * layout.cc (Layout:finish_dynamic_section): If new
13443         dtags enabled, emit DT_RUNPATH.  Also, emit a
13444         DT_FLAGS_1 containing any specified -z flags.
13445
13446 2008-04-16  Ian Lance Taylor  <iant@google.com>
13447
13448         * copy-relocs.cc: New file.
13449         * copy-relocs.h: New file.
13450         * reloc.cc: Remove Copy_relocs code.
13451         * reloc.h: Likewise.
13452         * reloc-types.h (struct Reloc_types) [both versions]: Add
13453         get_reloc_addend_noerror.
13454         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13455         variants of add_global which take an addend which must be zero.
13456         * i386.cc: Include "copy-relocs.h".
13457         (class Target_i386): Change type of copy_relocs_ to variable,
13458         update initializer.
13459         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13460         Change all callers.
13461         (Target_i386::do_finalize_sections): Change handling of
13462         copy_relocs_.
13463         * sparc.cc: Include "copy-relocs.h".
13464         (class Target_sparc): Change type of copy_relocs_ to variable,
13465         update initializer.
13466         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13467         Change all callers.
13468         (Target_sparc::do_finalize_sections): Change handling of
13469         copy_relocs_.
13470         * x86_64.cc: Include "copy-relocs.h".
13471         (class Target_x86_64): Change type of copy_relocs_ to variable,
13472         update initializer.
13473         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13474         class.  Change all callers.
13475         (Target_x86_64::do_finalize_sections): Change handling of
13476         copy_relocs_.
13477         * Makefile.am (CCFILES): Add copy-relocs.cc.
13478         (HFILES): Add copy-relocs.h.
13479
13480         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13481
13482         * testsuite/script_test_4.sh: Permit leading zeroes.
13483
13484 2008-04-15  Ian Lance Taylor  <iant@google.com>
13485
13486         * script-sections.cc (Script_sections::create_segments): Use
13487         header_size_adjustment even when there is enough room for the
13488         headers.
13489         * testsuite/script_test_4.sh: New file.
13490         * testsuite/script_test_4.t: New file.
13491         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13492         (check_DATA): Add script_test_4.stdout.
13493         (MOSTLYCLEANFILES): Likewise.
13494         (script_test_4): New target.
13495         (script_test_4.stdout): New target.
13496         * testsuite/Makefile.in: Rebuild.
13497
13498         * sparc.cc: Add definitions for Output_data_plt_sparc class
13499         constants.
13500
13501 2008-04-14  David S. Miller  <davem@davemloft.net>
13502
13503         * sparc.cc: New file.
13504         * Makefile.am (TARGETSOURCES): Add sparc.cc
13505         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13506         * configure.tgt: Document targ_extra_size and
13507         targ_extra_big_endian.  Add entries for sparc-* and
13508         sparc64-*.
13509         * configure.ac: Handle targ_extra_size and
13510         targ_extra_big_endian.
13511         * Makefile.in: Rebuild.
13512         * configure: Likewise.
13513         * po/POTFILES.in: Likewise.
13514         * po/gold.pot: Likewise.
13515
13516 2008-04-14  Ian Lance Taylor  <iant@google.com>
13517
13518         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13519         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13520         in the name/type/flags to section mapping.  Don't call
13521         allocate_output_section.
13522         (Layout::choose_output_section): Change parameter from adjust_name
13523         to is_input_section.  Don't permit input sections after sections
13524         are attached to segments.  Don't call allocate_output_section.
13525         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13526         not write_enable_output_section.
13527         (Layout::make_output_section): Don't push to
13528         unattached_section_list_ nor call attach_to_segment.  Call
13529         attach_section_to_segment if sections are attached.
13530         (Layout::attach_sections_to_segments): New function.
13531         (Layout::attach_section_to_segment): New function.
13532         (Layout::attach_allocated_section_to_segment): Rename from
13533         attach_to_segment.  Remove flags parameter.
13534         (Layout::allocate_output_section): Remove function.
13535         (Layout::write_enable_output_section): Remove function.
13536         * layout.h (class Layout): Update for above changes.  Add new
13537         field sections_are_attached_.
13538         * output.h (Output_section::update_flags_for_input_section): New
13539         function.
13540         * output.cc (Output_section::add_input_section): Call
13541         update_flags_for_input_section.
13542         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13543
13544 2008-04-11  Cary Coutant  <ccoutant@google.com>
13545
13546         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13547         thought unnecessary.
13548         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13549
13550 2008-04-11  Ian Lance Taylor  <iant@google.com>
13551
13552         * output.h (class Output_section_data): Remove inline definition
13553         of set_addralign.
13554         * output.cc (Output_section_data::set_addralign): New function.
13555
13556 2008-04-11  Cary Coutant  <ccoutant@google.com>
13557
13558         Add support for TLS descriptors for i386 and x86_64.
13559         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13560         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13561         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13562         GOT_TYPE_TLS_DESC.
13563         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13564         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13565         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13566         relocations.
13567         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13568         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13569         Fix problem with initial-exec relocations.
13570         (Target_i386::Relocate::relocate_tls): Likewise.
13571         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13572         relaxation.
13573         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13574         support for section-plus-offset dynamic table entries.
13575         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13576         (Output_data_dynamic::Dynamic_entry): Add support for
13577         section-plus-offset dynamic table entries.
13578         (Output_data_dynamic::Classification): Likewise.
13579         (Output_data_dynamic::classification_): Renamed offset_.
13580         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13581         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13582         (Target_x86_64::make_plt_section): New function.
13583         (Target_x86_64::reserve_tlsdesc_entries): New function.
13584         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13585         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13586         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13587         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13588         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13589         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13590         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13591         add extra PLT entry for TLS descriptors.
13592         (Output_data_plt_x86_64::got_): New field.
13593         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13594         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13595         fields.
13596         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13597         descriptors.
13598         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13599         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13600         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13601         R_386_TLS_DESC_CALL relocations.
13602         (Target_x86_64::Scan::global): Likewise.
13603         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13604         for TLS descriptors.
13605         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13606         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13607         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13608         GD-to-IE relaxation.
13609         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13610         and TLS_DESCRIPTORS.
13611         * Makefile.in: Rebuild.
13612         * configure: Rebuild.
13613         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13614         (tls_test_shared2.so): New target.
13615         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13616         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13617         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13618         (tls_shared_gd_to_ie_test_LDADD): New variable.
13619         (tls_shared_gnu2_gd_to_ie_test): New target.
13620         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13621         New targets.
13622         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13623         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13624         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13625         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13626         (tls_shared_gnu2_test): New target.
13627         (tls_test_gnu2_shared.so): New target.
13628         (tls_shared_gnu2_test_SOURCES): New variable.
13629         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13630         (tls_shared_gnu2_test_LDFLAGS): New variable.
13631         (tls_shared_gnu2_test_LDADD): New variable.
13632         * testsuite/Makefile.in: Rebuild.
13633         * testsuite/Makefile.
13634
13635 2008-04-11  Ian Lance Taylor  <iant@google.com>
13636
13637         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13638         justsyms.t.
13639         * testsuite/Makefile.in: Rebuild.
13640
13641         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13642         long.
13643         * testsuite/script_test_2.cc (main): Adjust test.
13644
13645 2008-04-11  David S. Miller  <davem@davemloft.net>
13646             Ian Lance Taylor  <iant@google.com>
13647
13648         * options.h (General_options): Add entries for '-Y' and
13649         '-relax'.
13650         * options.cc (General_options:finalize): If -Y was used, add those
13651         entries to the library path instead of the default "/lib" and
13652         "/usr/lib".
13653
13654 2008-04-11  David S. Miller  <davem@davemloft.net>
13655
13656         * testsuite/justsyms.t: Start at 0x100.
13657         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13658         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13659         long.
13660         * testsuite/script_test_2.cc: Adjust string and section length
13661         checks.
13662
13663 2008-04-09  Ian Lance Taylor  <iant@google.com>
13664
13665         PR gold/5996
13666         * script-sections.cc (Sections_element::allocate_to_segment): Add
13667         orphan parameter.
13668         (Output_section_definition::allocate_to_segment): Likewise.
13669         (Orphan_output_section::allocate_to_segment): Likewise.
13670         (Script_sections::attach_sections_using_phdrs_clause): Don't
13671         propagate non-PT_LOAD segments to orphan sections.
13672         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13673         readelf rather than objdump.
13674         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13675         .interp section and PT_INTERP segment are the same size.
13676         * testsuite/Makefile.in: Rebuild.
13677
13678         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13679         aliases for symbols defined in the same object.
13680         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13681         (weak_alias_test_SOURCES): New variable.
13682         (weak_alias_test_DEPENDENCIES): New variable.
13683         (weak_alias_test_LDFLAGS): New variable.
13684         (weak_alias_test_LDADD): New variable.
13685         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13686         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13687         (weak_alias_test_3.o): New target.
13688         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13689         * testsuite/weak_alias_test_main.cc: New file.
13690         * testsuite/weak_alias_test_1.cc: New file.
13691         * testsuite/weak_alias_test_2.cc: New file.
13692         * testsuite/weak_alias_test_3.cc: New file.
13693
13694 2008-04-08  Ian Lance Taylor  <iant@google.com>
13695
13696         * options.h (class General_options): Add --noinhibit-exec option.
13697         * main.cc (main): Check --noinhibit-exec.
13698
13699         * options.h (class General_options): Define --wrap as a special
13700         option.  Add wrap_symbols_ field.
13701         (General_options::any_wrap_symbols): New function.
13702         (General_options::is_wrap_symbol): New function.
13703         * options.cc (General_options::parse_wrap): New function.
13704         (General_options::General_options): Initialize wrap_symbols_.
13705         * symtab.cc (Symbol_table::wrap_symbol): New function.
13706         (Symbol_table::add_from_object): Handle --wrap.
13707         * symtab.h (class Symbol_table): Declare wrap_symbol.
13708         * target.h (Target::wrap_char): New function.
13709         (Target::Target_info): Add wrap_char field.
13710         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13711         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13712         * testsuite/testfile.cc (Target_test::test_target_info):
13713         Likewise.
13714
13715         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13716         there is one.
13717
13718         * layout.h (class Layout): Add added_eh_frame_data_ field.
13719         * layout.cc (Layout::Layout): Initialize new field.
13720         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13721         output section until we find a section we merged successfully.
13722         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13723         that the size be non-zero.
13724
13725         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13726         qualifier.
13727
13728 2008-04-08  Craig Silverstein  <csilvers@google.com>
13729
13730         * configure.ac: Export new conditional variable HAVE_ZLIB.
13731         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13732         on HAVE_ZLIB.
13733         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13734         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13735
13736 2008-04-07  Ian Lance Taylor  <iant@google.com>
13737
13738         * version.cc (version_string): Set to "1.5".
13739
13740         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13741         Add issued_non_pic_error_ field.  Declare check_non_pic.
13742         (Target_x86_64::Scan::check_non_pic): New function.
13743         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13744         (Target_x86_64::Scan::global): Likewise.
13745
13746         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13747         addend parameter.  Change caller.  Handle merge sections.
13748         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13749         Address to Addend.  Don't add in the result of
13750         local_section_offset, pass down the addend and use the returned
13751         value.
13752         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13753         Update declarations of local_section_offset and symbol_value.
13754         * testsuite/two_file_test_1.cc (t18): New function.
13755         * testsuite/two_file_test_2.cc (f18): New function.
13756         * testsuite/two_file_test_main.cc (main): Call t18.
13757         * testsuite/two_file_test.h (t18, f18): Declare.
13758
13759         * configure.ac: Don't test for objdump, c++filt, or readelf.
13760         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13761         conditionals.
13762         (TEST_READELF): New variable.
13763         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13764         (check_PROGRAMS): Add two_file_strip_test.
13765         (two_file_strip_test): New target.
13766         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13767         (two_file_same_shared_strip_test_SOURCES): New variable.
13768         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13769         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13770         (two_file_same_shared_strip_test_LDADD): New variable.
13771         (two_file_shared_strip.so): New target.
13772         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13773         (ver_test_5.syms, ver_test_7.syms): Likewise.
13774         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13775         (strip_test_3.stdout): Use TEST_OBJDUMP.
13776         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13777
13778 2008-04-04  Cary Coutant  <ccoutant@google.com>
13779
13780         * symtab.h (Symbol::is_weak_undefined): New function.
13781         (Symbol::is_strong_undefined): New function.
13782         (Symbol::is_absolute): New function.
13783         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13784         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13785         absolute symbols.
13786         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13787         (weak_undef_test): New target.
13788         * testsuite/Makefile.in: Rebuild.
13789         * testsuite/weak_undef_file1.cc: New file.
13790         * testsuite/weak_undef_file2.cc: New file.
13791         * testsuite/weak_undef_test.cc: New file.
13792
13793 2008-04-03  Craig Silverstein  <csilvers@google.com>
13794
13795         * compressed_output.h (class Output_compressed_section): Use
13796         unsigned buffer.
13797         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13798         add zlib header.
13799         (zlib_compressed_suffix): Removed.
13800         (Output_compressed_section::set_final_data_size): Use unsigned
13801         buffers.
13802         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13803         Fix linker invocation.
13804         (flagstest_o_specialfile_and_compress_debug_sections):
13805         Likewise.
13806         * testsuite/Makefile.in: Regenerated.
13807
13808 2008-04-02  David S. Miller  <davem@davemloft.net>
13809
13810         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13811         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13812
13813 2008-04-02  Craig Silverstein  <csilvers@google.com>
13814
13815         * TODO: New file.
13816
13817 2008-04-02  Ian Lance Taylor  <iant@google.com>
13818
13819         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13820         parameters.  Update for new key type to views_.  Change all
13821         callers.
13822         (File_read::read): Adjust for byteshift in returned view.
13823         (File_read::add_view): New function, broken out of
13824         find_and_make_view.
13825         (File_read::make_view): New function, broken out of
13826         find_and_make_view.
13827         (File_read::find_or_make_view): Add offset and aligned
13828         parameters.  Rewrite accordingly.  Change all callers.
13829         (File_read::get_view): Add offset and aligned parameters.  Adjust
13830         for byteshift in return value.
13831         (File_read::get_lasting_view): Likewise.
13832         * fileread.h (class File_read): Update declarations.
13833         (class File_read::View): Add byteshift_ field.  Add byteshift to
13834         constructor.  Add byteshift method.
13835         * archive.h (Archive::clear_uncached_views): New function.
13836         (Archive::get_view): Add aligned parameter.  Change all callers.
13837         * object.h (Object::get_view): Add aligned parameter.  Change all
13838         callers.
13839         (Object::get_lasting_view): Likewise.
13840
13841         * fileread.cc (File_read::release): Don't call clear_views if
13842         there are multiple objects.
13843         * fileread.h (File_read::clear_uncached_views): New function.
13844         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13845         on the archive.
13846
13847 2008-03-31  Cary Coutant  <ccoutant@google.com>
13848
13849         Add thin archive support.
13850         * archive.cc (Archive::armagt): New const.
13851         (Archive::setup): Remove task parameter and calls to unlock.
13852         (Archive::unlock_nested_archives): New function.
13853         (Archive::read_header): Add nested_off parameter. Change
13854         all callers.
13855         (Archive::interpret_header): Likewise.
13856         (Archive::include_all_members): Change to handle thin
13857         archives.
13858         (Archive::include_member): Likewise.
13859         * archive.h (Archive::Archive): Add new parameters and
13860         initializers.
13861         (Archive::armagt): New const.
13862         (Archive::setup): Remove task parameter.
13863         (Archive::unlock_nested_archives): New function.
13864         (Archive::read_header): Add nested_off parameter.
13865         (Archive::interpret_header): Likewise.
13866         (Archive::Nested_archive_table): New typedef.
13867         (Archive::is_thin_archive_): New field.
13868         (Archive::nested_archives_): New field.
13869         (Archive::options_): New field.
13870         (Archive::dirpath_): New field.
13871         (Archive::task_): New field.
13872         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13873         for thin archives.  Pass additional parameters to
13874         Archive::Archive.  Unlock the archive file after calling
13875         Archive::setup.
13876
13877 2008-03-29  Ian Lance Taylor  <iant@google.com>
13878
13879         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13880         version symbol to be local.
13881         * testsuite/ver_test_4.sh: New file.
13882         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13883         (check_DATA): Add ver_test_4.syms.
13884         (ver_test_4.syms): New target.
13885         * testsuite/Makefile.in: Rebuild.
13886
13887         * output.cc
13888         (Output_section::Input_section_sort_entry::has_priority): New
13889         function.
13890         (Output_section::Input_section_sort_entry::match_file_name): New
13891         function.
13892         (Output_section::Input_section_sort_entry::match_section_name):
13893         Remove.
13894         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13895         Remove.
13896         (Output_section::Input_section_sort_entry::match_section_file):
13897         Remove.
13898         (Output_section::Input_section_sort_compare::operator()): Rewrite
13899         using new Input_section_sort_entry functions.  Sort crtbegin and
13900         crtend first.  Sort sections with no priority before sections with
13901         a priority.
13902         * testsuite/initpri1.c (d3): Check j != 4.
13903         (cd5): New constructor/destructor function.
13904         (main): Check j != 2.
13905
13906         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13907         new symbol when resolving, don't call set_is_default.
13908         * testsuite/ver_test_7.cc: New file.
13909         * testsuite/ver_test_7.sh: New file.
13910         * testsuite/Makefile.am (ver_test_7.so): New target.
13911         (ver_test_7.o): New target.
13912         (check_SCRIPTS): Add ver_test_7.sh.
13913         (check_DATA): Add ver_test_7.syms.
13914         (ver_test_7.syms): New target.
13915
13916 2008-03-28  Ian Lance Taylor  <iant@google.com>
13917
13918         * layout.cc (Layout::layout): If we see an input section with a
13919         name that needs sorting, set the must_sort flag for the output
13920         section.
13921         (Layout::make_output_section): If the name of the output section
13922         indicates that it might require sorting, set the may_sort flag.
13923         * output.h (Output_section::may_sort_attached_input_sections): New
13924         function.
13925         (Output_section::set_may_sort_attached_input_sections): New
13926         function.
13927         (Output_section::must_sort_attached_input_sections): New
13928         function.
13929         (Output_section::set_must_sort_attached_input_sections): New
13930         function.
13931         (class Output_section): Declare Input_section_sort_entry.  Define
13932         Input_section_sort_compare.  Declare
13933         sort_attached_input_sections.  Add new fields:
13934         may_sort_attached_input_sections_,
13935         must_sort_attached_input_sections_,
13936         attached_input_sections_are_sorted_.
13937         * output.cc (Output_section::Output_section): Initialize new
13938         fields.
13939         (Output_section::add_input_section): Add an entry to
13940         input_sections_ if may_sort or must_sort are true.
13941         (Output_section::set_final_data_size): Call
13942         sort_attached_input_sections if necessary.
13943         (Output_section::Input_section_sort_entry): Define new class.
13944         (Output_section::Input_section_sort_compare::operator()): New
13945         function.
13946         (Output_section::sort_attached_input_sections): New function.
13947         * configure.ac: Check whether the compiler supports constructor
13948         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
13949         * testsuite/initpri1.c: New file.
13950         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
13951         CONSTRUCTOR_PRIORITY.
13952         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
13953         (initpri1_LDFLAGS): New variable.
13954         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13955
13956 2008-03-27  Ian Lance Taylor  <iant@google.com>
13957
13958         * common.cc (Sort_commons::operator): Correct sorting algorithm.
13959         * testsuite/common_test_1.c: New file.
13960         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
13961         (common_test_1_SOURCES): New variable.
13962         (common_test_1_DEPENDENCIES): New variable.
13963         (common_test_1_LDFLAGS): New variable.
13964
13965         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
13966         and commons_ correctly when NAME/VERSION does not override
13967         NAME/NULL.
13968         * testsuite/ver_test_6.c: New file.
13969         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
13970         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
13971         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
13972
13973 2008-03-26  Ian Lance Taylor  <iant@google.com>
13974
13975         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
13976         of an undefined symbol from a version script.
13977         * testsuite/Makefile.am (ver_test_5.so): New target.
13978         (ver_test_5.o): New target.
13979         (check_SCRIPTS): Add ver_test_5.sh.
13980         (check_DATA): Add ver_test_5.syms.
13981         (ver_test_5.syms): New target.
13982         * testsuite/ver_test_5.cc: New file.
13983         * testsuite/ver_test_5.script: New file.
13984         * testsuite/ver_test_5.sh: New file.
13985         * Makefile.in, testsuite/Makefile.in: Rebuild.
13986
13987         PR gold/5986
13988         Fix problems building gold with gcc 4.3.0.
13989         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
13990         (gold_error_at_location, gold_warning_at_location): Use it.
13991         * configure.ac: Check whether we can compile and use a template
13992         function with a printf attribute.
13993         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
13994         when jumping over bytes.
13995         * object.cc: Instantiate Object::read_section_data.
13996         * debug.h: Include <cstring>
13997         * dwarf_reader.cc: Include <algorithm>
13998         * main.cc: Include <cstring>.
13999         * options.cc: Include <cstring>.
14000         * output.cc: Include <cstring>.
14001         * script.cc: Include <cstring>.
14002         * script.h: Include <string>.
14003         * symtab.cc: Include <cstring> and <algorithm>.
14004         * target-select.cc: Include <cstring>.
14005         * version.cc: Include <string>.
14006         * testsuite/testmain.cc: Include <cstdlib>.
14007         * configure, config.in: Rebuild.
14008
14009 2008-03-25  Ian Lance Taylor  <iant@google.com>
14010
14011         * options.cc: Include "../bfd/bfdver.h".
14012         (options::help): Print bug reporting address.
14013
14014         * version.cc (print_version): Adjust output for current value of
14015         BFD_VERSION_STRING.
14016
14017         * NEWS: New file.
14018
14019         * options.cc (options::help): Print list of supported targets.
14020         * target-select.h: Include <vector>.
14021         (class Target_selector): Make machine_, size_, and is_big_endian_
14022         fields const.  Add bfd_name_ and instantiated_target_ fields.
14023         (Target_selector::Target_selector): Add bfd_name parameter.
14024         (Target_selector::recognize): Make non-virtual, call
14025         do_recognize.
14026         (Target_selector::recognize_by_name): Make non-virtual, call
14027         do_recognize_by_name.
14028         (Target_selector::supported_names): New function.
14029         (Target_selector::bfd_name): New function.
14030         (Target_selector::do_instantiate_target): New pure virtual
14031         function.
14032         (Target_selector::do_recognize): New virtual function.
14033         (Target_selector::do_recognize_by_name): New virtual function.
14034         (Target_selector::instantiate_target): New private function.
14035         (supported_target_names): Declare.
14036         * target-select.cc (Target_selector::Target_selector): Update for
14037         new parameter and fields.
14038         (select_target_by_name): Check that the name matches before
14039         calling recognize_by_name.
14040         (supported_target_names): New function.
14041         * i386.cc (class Target_selector_i386): Update Target_selector
14042         constructor call.  Remove recognize and recognize_by_name.  Add
14043         do_instantiate_target.
14044         * x86_64.cc (class Target_selector_x86_64): Likewise.
14045         * testsuite/testfile.cc (class Target_selector_test): Update for
14046         changes to Target_selector.
14047
14048         * README: Rewrite, with some notes on unsupported features.
14049
14050 2008-03-24  Cary Coutant  <ccoutant@google.com>
14051
14052         * i386.cc (Target_i386::Got_type): New enum declaration.
14053         (Target_i386::Scan::local): Updated callers of Output_data_got
14054         member functions.
14055         (Target_i386::Scan::global): Likewise.
14056         (Target_i386::Relocate::relocate): Likewise.
14057         (Target_i386::Relocate::relocate_tls): Likewise.
14058         * object.h (Got_offset_list): New class.
14059         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14060         (Sized_relobj::local_got_offset): Likewise.
14061         (Sized_relobj::set_local_got_offset): Likewise.
14062         (Sized_relobj::local_has_tls_got_offset): Removed.
14063         (Sized_relobj::local_tls_got_offset): Removed.
14064         (Sized_relobj::set_local_tls_got_offset): Removed.
14065         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14066         * output.cc (Output_data_got::add_global): Added got_type parameter.
14067         (Output_data_got::add_global_with_rel): Likewise.
14068         (Output_data_got::add_global_with_rela): Likewise.
14069         (Output_data_got::add_global_pair_with_rel): New function.
14070         (Output_data_got::add_global_pair_with_rela): New function.
14071         (Output_data_got::add_local): Added got_type parameter.
14072         (Output_data_got::add_local_with_rel): Likewise.
14073         (Output_data_got::add_local_with_rela): Likewise.
14074         (Output_data_got::add_local_pair_with_rel): New function.
14075         (Output_data_got::add_local_pair_with_rela): New function.
14076         (Output_data_got::add_global_tls): Removed.
14077         (Output_data_got::add_global_tls_with_rel): Removed.
14078         (Output_data_got::add_global_tls_with_rela): Removed.
14079         (Output_data_got::add_local_tls): Removed.
14080         (Output_data_got::add_local_tls_with_rel): Removed.
14081         (Output_data_got::add_local_tls_with_rela): Removed.
14082         * output.h (Output_data_got::add_global): Added got_type parameter.
14083         (Output_data_got::add_global_with_rel): Likewise.
14084         (Output_data_got::add_global_with_rela): Likewise.
14085         (Output_data_got::add_global_pair_with_rel): New function.
14086         (Output_data_got::add_global_pair_with_rela): New function.
14087         (Output_data_got::add_local): Added got_type parameter.
14088         (Output_data_got::add_local_with_rel): Likewise.
14089         (Output_data_got::add_local_with_rela): Likewise.
14090         (Output_data_got::add_local_pair_with_rel): New function.
14091         (Output_data_got::add_local_pair_with_rela): New function.
14092         (Output_data_got::add_global_tls): Removed.
14093         (Output_data_got::add_global_tls_with_rel): Removed.
14094         (Output_data_got::add_global_tls_with_rela): Removed.
14095         (Output_data_got::add_local_tls): Removed.
14096         (Output_data_got::add_local_tls_with_rel): Removed.
14097         (Output_data_got::add_local_tls_with_rela): Removed.
14098         * resolve.cc (Symbol::override_base_with_special): Removed
14099         reference to has_got_offset_ field.
14100         * symtab.cc (Symbol::init_fields): Replaced initialization
14101         of got_offset_ with got_offsets_.  Removed initialization
14102         of has_got_offset_
14103         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14104         (Symbol::got_offset): Likewise.
14105         (Symbol::set_got_offset): Likewise.
14106         (Symbol::has_tls_got_offset): Removed.
14107         (Symbol::tls_got_offset): Removed.
14108         (Symbol::set_tls_got_offset): Removed.
14109         (Symbol::got_offset_): Removed.
14110         (Symbol::tls_mod_got_offset_): Removed.
14111         (Symbol::tls_pair_got_offset_): Removed.
14112         (Symbol::got_offsets_): New field.
14113         (Symbol::has_got_offset): Removed.
14114         (Symbol::has_tls_mod_got_offset): Removed.
14115         (Symbol::has_tls_pair_got_offset): Removed.
14116         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14117         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14118         member functions.
14119         (Target_x86_64::Scan::global): Likewise.
14120         (Target_x86_64::Relocate::relocate): Likewise.
14121         (Target_x86_64::Relocate::relocate_tls): Likewise.
14122
14123 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14124
14125         * yyscript.y: Fix spelling error in comment.
14126
14127 2008-03-24  Ian Lance Taylor  <iant@google.com>
14128
14129         * options.h (class General_options): Define build_id option.
14130         * layout.h (class Layout): Declare write_build_id, create_note,
14131         create_build_id.  Add build_id_note_ member.
14132         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14133         "libiberty.h", "md5.h", "sha1.h".
14134         (Layout::Layout): Initialize eh_frame_data_,
14135         eh_frame_hdr_section_, and build_id_note_.
14136         (Layout::finalize): Call create_build_id.
14137         (Layout::create_note): New function, broken out of
14138         Layout::create_gold_note.
14139         (Layout::create_gold_note): Call create_note.
14140         (Layout::create_build_id): New function.
14141         (Layout::write_build_id): New function.
14142         (Close_task_runner::run): Call write_build_id.
14143
14144         * x86_64.cc: Correct license to GPLv3.
14145
14146 2008-03-23  Ian Lance Taylor  <iant@google.com>
14147
14148         * options.cc: Include "demangle.h".
14149         (parse_optional_string): New function.
14150         (parse_long_option): Handle takes_optional_argument.
14151         (parse_short_option): Update dash_z initializer.  Handle
14152         takes_optional_argument.
14153         (General_options::General_options): Initialize do_demangle_.
14154         (General_options::finalize): Set do_demangle_.  Handle demangling
14155         style.
14156         * options.h (parse_optional_string): Declare.
14157         (struct One_option): Add optional_arg field.  Update constructor.
14158         Update call constructor calls.  Add takes_optional_argument
14159         function.
14160         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14161         (DEFINE_optional_string): Define.
14162         (General_options::demangle): Change from DEFINE_bool to
14163         DEFINE_optional_string.
14164         (General_options::no_demangle): New function.
14165         (General_options::do_demangle): New function.
14166         (General_options::set_do_demangle): New function.
14167         (General_options::execstack_status_): Move definition to end of
14168         class definition.
14169         (General_options::static_): Likewise.
14170         (General_options::do_demangle_): New field.
14171         * object.cc (big_endian>::get_symbol_location_info): Call
14172         Options::do_demangle, not Options::demangle.
14173         * symtab.cc (demangle): Likewise.
14174
14175 2008-03-22  Ian Lance Taylor  <iant@google.com>
14176
14177         * gold.h: Include <cstddef> and <sys/types.h>
14178         * options.h: Include <cstring>.
14179
14180 2008-03-21  Ian Lance Taylor  <iant@google.com>
14181
14182         * Added source code to GNU binutils.
14183 \f
14184 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14185
14186 Copying and distribution of this file, with or without modification,
14187 are permitted in any medium without royalty provided the copyright
14188 notice and this notice are preserved.
14189
14190 Local Variables:
14191 mode: change-log
14192 left-margin: 8
14193 fill-column: 74
14194 version-control: never
14195 End: